Example #1
0
 public void Init(IDeath iDeath)
 {
     _iDeath = iDeath;
     _entityStats.CalculFinalStats();
     _baseHP    = _entityStats.HP;
     _currentHP = _baseHP;
 }
Example #2
0
    public void TakeDamage(int damage)
    {
        CurrentHealth -= damage;
        if (CurrentHealth > 0)
        {
            return;
        }

        IGiveScore obj = GetComponent <IGiveScore>();

        if (obj != null)
        {
            obj.GiveScore();
        }

        IDeath death = GetComponent <IDeath>();

        if (death != null)
        {
            death.Destroy();
        }

        if (deathEffect != null)
        {
            SimplePool.Spawn(deathEffect.gameObject, transform.position, Quaternion.identity);
        }

        Destroy(gameObject);
    }
Example #3
0
        public void Init(float health, float defense, IDeath mortalObj)
        {
            m_health    = health;
            m_defense   = defense;
            m_mortalObj = mortalObj;

            ResetHealth();
        }
Example #4
0
        public bool DeathOf(IPlayer player, out IDeath death)
        {
            death = default;

            death = AllDeaths().FirstOrDefault(death => death.Victim == player);

            return(death != default);
        }
Example #5
0
    private void OnCollisionEnter(Collision collision)
    {
        IDeath deathTarget = collision.gameObject.GetComponent <IDeath>();

        if (deathTarget != null)
        {
            deathTarget.DoDeath();
        }
    }
Example #6
0
 /// <summary>
 /// When the ball dies by an attack, it destroyes the owner as long as an owner exists. If the ball
 /// is deactivated or destroyed, this method is not called. You must use the attack system for
 /// this component to work.
 /// </summary>
 private void OnDeath(GameObject killer)
 {
     if (Owner != null)
     {
         IDeath death = Owner.GetComponent <IDeath>();
         if (death != null)
         {
             death.Die(killer);
         }
     }
 }
Example #7
0
 private void Awake()
 {
     deathInterface = GetComponent <IDeath>();
 }
 /// <summary>
 ///     Obtain he death actions on this character
 /// </summary>
 void getDeathType()
 {
     death = GetComponent <IDeath>();
 }
Example #9
0
 private void Awake()
 {
     body           = GetComponent <Rigidbody2D>();
     deathInterface = GetComponent <IDeath>();
 }
Example #10
0
 private void Awake()
 {
     death        = GetComponent <IDeath>();
     death.Death += ReturnObjectToPool;
 }
Example #11
0
 private void Awake()
 {
     _currentHealth = maxHealth;
     _death         = GetComponent <IDeath>();
 }