public void Attack() { if (actionAllowed) { bool executedAttack = false; if (weapon.melee) { var defenderCoordinate = this.position + this.lookDirection; if (room.HasAgent(defenderCoordinate)) { executedAttack = MeleeSystem.Execute(this, room.GetAgent(defenderCoordinate)); } } else if (weapon.Shoot(_stats.position, _stats.lookDirection)) { executedAttack = true; } if (executedAttack) { _stats.shots++; actionPoints--; actionTick(); } } }
void Awake() { if (_instance == null) { _instance = this; } else if (_instance != this) { Destroy(this); } }
static void Spawn() { _instance = Tower.T.gameObject.AddComponent <MeleeSystem>(); }