November 2017

  • Unity with C# interfaces

    Unity with C# interfaces

    Interfaces are a way to make our code reusable. Example: public interface IDamageable { void TakeDamage(float amount); } public class GoblinBehaviour : MonoBehaviour , IDamageable { float health; public void TakeDamage(float amount) { health-= amount; } } Now when someone wants to do damage to this GoblinBehaviour they can fetch…