示例#1
0
        public void TakeDamage(float damage)
        {
            //Debug.DrawLine(transform.position, transform.position + Vector3.up * damage, Color.red, 0.25f);
            if (_closeToPlayer)
            {
                if (_colorComponent != null) //this check... i dunno hah
                {
                    _colorComponent?.SetColor(Color.red, 30);
                }
            }
            Health -= (int)(damage * (1 - ArmourDamagePercentDiminished));
            TriggerHealthBarUpdate();
            if (Health > 0)
            {
                return;
            }
            if (Team == Teams.Baddies)
            {
                PlayerUser.ResourceUnits++; //gain when baddies killed off
                LevelsMgr.MenuInGameObject?.GetComponent <MenuInGame>()?.UpdateNow();
            }

            GameMgr.RegisterForUpdate(this, true);
            UnitMgr.Units.Remove(this);
            DeathSpawn.SpawnOnDeath(transform.position);
            Destroy(this.gameObject);
        }
示例#2
0
 void Awake()
 {
     if (_original == null)
     {
         _original          = this;
         _originalHeadstone = gameObject;
         gameObject.SetActive(false); //then hide
     }
 }