Skip to content

Instantly share code, notes, and snippets.

@GT3000
Created November 23, 2021 08:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GT3000/7903f612e904da0fa2fc228f51f00277 to your computer and use it in GitHub Desktop.
Save GT3000/7903f612e904da0fa2fc228f51f00277 to your computer and use it in GitHub Desktop.
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
//Once again calling IDamagable
public class Player : MonoBehaviour, IDamagable
{
public float speed = 100.0f;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
Vector3 playerPos = new Vector3(-Input.GetAxisRaw("Vertical"),0 , Input.GetAxisRaw("Horizontal"));
GetComponent<Rigidbody>().velocity = playerPos * Time.deltaTime * speed;
}
//Implementing the health property in IDamagable
public int Health { get; set; }
//Implementing the Damage method in IDamagable
public void Damage(int damageAmount)
{
throw new System.NotImplementedException();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment