public void TakeDamage(int damage) { if (Health < 0) { return; } if (Fortified) { damage = (int)(damage * .8f); } health -= damage; // Add armour to the equation if (EntityBar != null) { EntityBar.GetComponent <EntityBar>().SetHealthSize(health / maxHealth); } Debug.Log(String.Format("{0} took {1} points of damage, {2} health remaining.", name, damage, Health)); if (Destroyed()) { //gameObject.SetActive(false); if (PSystem != null) { PSystem.Play(); } Destroy(this.gameObject, 1f); } }
public override void OnStrike() { MovementLeft--; //change to the travel cost StrikesLeft--; Owner.ChangeFuel(Cost); EntityBar.GetComponent <EntityBar>().SetStrikeSize(StrikesLeft / MaxStrikes); EntityBar.GetComponent <EntityBar>().SetMoveSize(MovementLeft / MaxMovement); }
public override void Rest() { Debug.Log(string.Format("{0} at {1}", name, Tile.name)); MovementLeft = MaxMovement; StrikesLeft = MaxStrikes; EntityBar.GetComponent <EntityBar>().Rest(1f, 1f); }
public override void OnMove(Tile target) { Path path = Pathfinding.FindPath(Tile, target); Fortified = false; MovementLeft -= path.movementCost; Owner.ChangeFuel(Cost); EntityBar.GetComponent <EntityBar>().SetMoveSize(MovementLeft / MaxMovement); StartCoroutine(Move(target)); }