Skip to content

Instantly share code, notes, and snippets.

@GT3000
Created November 23, 2021 07:58
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/07186e260d496a791de7cbc96cd7cc27 to your computer and use it in GitHub Desktop.
Save GT3000/07186e260d496a791de7cbc96cd7cc27 to your computer and use it in GitHub Desktop.
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