Created
November 23, 2021 08:07
-
-
Save GT3000/7903f612e904da0fa2fc228f51f00277 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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