コード例 #1
0
 public void IncreaseHealth(float recovery)
 {
     CurrentHealth += recovery;
     // If we later have some sort of healing make sure that it cannot go over its initial full health.
     CurrentHealth = Mathf.Clamp(CurrentHealth, 0, MaxHealth);
     //if (this.currentHealth >= this.health) { this.currentHealth = this.health; }
     UnitGameObject.UpdateHealthText();
 }
コード例 #2
0
        public void OnDeath()
        {
            GameObject loot =
                ((GameObject)GameObject.Instantiate(Resources.Load <GameObject>(FileLocations.lootPrefab)));

            UnitGameObject.Tile.Loot = loot.GetComponent <Loot>();
            UnitGameObject.Tile.Loot.SetLoot(CurrentLoot);
            loot.GetComponent <Loot>().Tile = UnitGameObject.Tile;
            loot.transform.position         = UnitGameObject.Tile.gameObject.transform.position;

            UnitGameObject.DestroyUnit();
        }
コード例 #3
0
 public Unit(UnitGameObject game, bool isHero, int attackRange, int moveRange, bool canAttackAfterMove,
             float maxHealth,
             float damage, int cost, int fowLos, float baseLoot, Dictionary <UnitTypes, float> modifiers)
 {
     UnitGameObject     = game;
     IsHero             = isHero;
     HasMoved           = false;
     HasAttacked        = false;
     AttackRange        = attackRange;
     MoveRange          = moveRange;
     CanAttackAfterMove = canAttackAfterMove;
     CurrentHealth      = maxHealth;
     MaxHealth          = maxHealth;
     Damage             = damage;
     Cost = cost;
     FowLineOfSightRange = fowLos;
     BaseLoot            = baseLoot;
     CurrentLoot         = baseLoot;
     Modifiers           = modifiers;
 }
コード例 #4
0
 public void DecreaseHealth(float damage)
 {
     CurrentHealth -= damage;
     UnitGameObject.UpdateHealthText();
 }