Esempio n. 1
0
    IEnumerator Drowing()
    {
        yield return(new WaitForSeconds(5f));

        Debug.Log("Uhuk");
        playerDamagable.TakeDamage(gameObject);
        StartCoroutine(Drowing());
    }
Esempio n. 2
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        Damagable other = collision.gameObject.GetComponent <Damagable>();

        if (other != null)
        {
            other.TakeDamage(Damage);
        }
    }
Esempio n. 3
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        Damagable otherDamagable = collision.gameObject.GetComponent <Damagable>();

        if (otherDamagable != null)
        {
            otherDamagable.TakeDamage(50);
            print("That's a lotta damage!");
        }
    }
Esempio n. 4
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        Damagable damagable = collision.gameObject.GetComponent <Damagable>();

        if (damagable && !damagedAlready.Contains(collision.gameObject))
        {
            damagable.TakeDamage(damageType, amount);
            damagedAlready.Add(collision.gameObject);
        }
    }
Esempio n. 5
0
    public void OnTriggerEnter(Collider otherObject)
    {
        Damagable damagable = otherObject.GetComponentInParent <Damagable>();

        if (damagable != null)
        {
            damagable.TakeDamage(bulletDamage);
        }
        Die();
    }
Esempio n. 6
0
    public override void OnCollisionEnter2D(Collision2D collision)
    {
        Damagable other = collision.gameObject.GetComponent <Damagable>();

        if (other != null)
        {
            other.TakeDamage(damage);
        }
        Release();
    }
Esempio n. 7
0
 public void OnTriggerEnter(Collider other)
 {
     if (canKill)
     {
         Damagable enemy = other.GetComponent <Damagable>();
         if (enemy != null)
         {
             enemy.TakeDamage();
         }
     }
 }
Esempio n. 8
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (rigid.velocity.sqrMagnitude >= MinSpeedForDamage * MinSpeedForDamage)
     {
         Damagable damage = collision.GetComponent <Damagable>();
         if (damage != null)
         {
             damage.TakeDamage(4);
         }
     }
 }
Esempio n. 9
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        Debug.Log(collision.name);

        Damagable enemy = collision.GetComponent <Damagable>();

        if (enemy != null)
        {
            cam.Shake();
            enemy.TakeDamage(damage);
        }
    }
Esempio n. 10
0
    // register any newly currently colliding objects with collisions and deal damage if it's an enemy
    private void OnTriggerEnter2D(Collider2D other)
    {
        Debug.Log(other.gameObject);
        playerHealth = other.GetComponent <PlayerState> ();
        enemyhealth  = other.GetComponent <Damagable> ();

        if (other.gameObject.CompareTag("Enemy"))
        {
            enemyhealth.TakeDamage(damage);
            hitSwitch = false;
        }
    }
Esempio n. 11
0
    public virtual void OnCollisionEnter2D(Collision2D collision)
    {
        Damagable other = collision.gameObject.GetComponent <Damagable>();

        if (other != null)
        {
            other.TakeDamage(damage);
            Release();
        }
        else
        {
            life /= 2;
        }
    }
Esempio n. 12
0
    private void DealMeleeDamage(Damagable damagable)
    {
        _ready_to_deal_damage = false;
        Invoke(nameof(ResetReadyness), 1 / _attack_speed);

        damagable.TakeDamage(_melee_damage);

        if (_animate)
        {
            _animator.Play("Attack");
        }

        OnDamageDeal?.Invoke(damagable);
    }
    protected virtual void OnCollisionEnter2D(Collision2D col)
    {
        //Debug.Log("proj colide with" + col.gameObject);
        Damagable damagable = col.collider.GetComponent <Damagable>();

        if (damagable)
        {
            damagable.TakeDamage(damage, damageType);
        }

        if (!col.gameObject.CompareTag("Projectile"))
        {
            Destroy(gameObject);
        }
    }
Esempio n. 14
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        Debug.Log(other.name);
        Damagable damagedObject = other.GetComponent <Damagable>();
        Bullet    bullet        = other.GetComponent <Bullet>();

        if (damagedObject != null)
        {
            damagedObject.TakeDamage(1);
            OnAsteroidHit();
        }
        else if (bullet != null)
        {
            OnAsteroidHit();
        }
    }
Esempio n. 15
0
    public void ApplyDamage(Damagable hitDamagable, int amount)
    {
        bool targetKilled = hitDamagable.TakeDamage(amount);

        if (targetKilled)
        {
            Player p = hitDamagable.GetComponent <Player>();
            if (p != null && (p != this.player) && (p.team != this.player.team))
            {
                player.team.AddPoints(Game.round.mode.playerKillScoreAmount);
                player.gold += Game.round.mode.playerKillGoldAmount;
            }
            Chicken c = hitDamagable.GetComponent <Chicken>();
            if (c != null)
            {
                player.team.AddPoints(Game.round.mode.chickenKillScoreAmount);
                player.gold += Game.round.mode.chickenKillGoldAmount;
            }
        }
    }
Esempio n. 16
0
    private void Attack()
    {
        Collider[] colliders = Physics.OverlapSphere(transform.position + (transform.forward * 2.5f), 1.5f);

        foreach (Collider col in colliders)
        {
            Damagable damagable = col.GetComponent <Damagable>();

            if (col.tag == "Player")
            {
                damagable = Game.instance.player.GetComponent <Damagable>();
            }

            if (damagable == null || col.tag == "Bear")
            {
                continue;
            }

            damagable.TakeDamage(attackDamage, transform.forward);
        }

        attackTime = 3.0f;
    }
Esempio n. 17
0
        public void DamagePlayerOnClients(GameObject obj)
        {
            Damagable damagable = obj.GetComponent <Damagable>();

            damagable.TakeDamage(0);
        }
Esempio n. 18
0
    private IEnumerator ChainedPartDestroy(Damagable damagable)
    {
        yield return(new WaitForSeconds(chainDestroyDelay));

        damagable.TakeDamage(float.MaxValue);
    }
Esempio n. 19
0
 private void PoisonTick()
 {
     combatScript.TakeDamage(poisonDamage, Color.magenta);
 }
Esempio n. 20
0
 public void MakeDamage(Damagable objectToDamage)
 {
     objectToDamage.TakeDamage(damage);
 }