Created
November 23, 2021 07:58
-
-
Save GT3000/07186e260d496a791de7cbc96cd7cc27 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 UnityEngine; | |
//By inheiriting from IDamagable we are required to establish the interface properties and methods | |
public class EnemyInterface : MonoBehaviour, IDamagable | |
{ | |
//property Health, now this enemy has a Health property that you can use | |
public int Health { get; set; } | |
//Like the property the empty method from the interface the enemy also has a Damage method that passes in a damage amount parameter | |
public void Damage(int damageAmount) | |
{ | |
throw new System.NotImplementedException(); | |
} | |
private void SomeOtherEnemyMethod() | |
{ | |
//Enemy logic | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment