Skip to content

Instantly share code, notes, and snippets.

@robotron2084
Created July 11, 2021 21:37
Show Gist options
  • Save robotron2084/0314a793a8e2733981c7d36fb02dad9d to your computer and use it in GitHub Desktop.
Save robotron2084/0314a793a8e2733981c7d36fb02dad9d to your computer and use it in GitHub Desktop.
public class EnemyUnit
{
public bool Enabled; // Is the object active within the environment?
public bool IsAlive; // Has the object been killed yet?
public bool CanBeHit; // Can the enemy be hit or is it currently invulnerable or dead?
public void OnHit()
{
if(Enabled)
{
if(IsAlive)
{
if(CanBeHit)
{
DoDamage();
}
}else
{
if(CanBeHit)
{
PlayCorpsehit();
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment