Example #1
0
 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);
     }
 }
Example #2
0
 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);
 }
Example #3
0
        public override void Rest()
        {
            Debug.Log(string.Format("{0} at {1}", name, Tile.name));
            MovementLeft = MaxMovement;
            StrikesLeft  = MaxStrikes;

            EntityBar.GetComponent <EntityBar>().Rest(1f, 1f);
        }
Example #4
0
        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));
        }