IEnumerator Drowing() { yield return(new WaitForSeconds(5f)); Debug.Log("Uhuk"); playerDamagable.TakeDamage(gameObject); StartCoroutine(Drowing()); }
private void OnTriggerEnter2D(Collider2D collision) { Damagable other = collision.gameObject.GetComponent <Damagable>(); if (other != null) { other.TakeDamage(Damage); } }
private void OnTriggerEnter2D(Collider2D collision) { Damagable otherDamagable = collision.gameObject.GetComponent <Damagable>(); if (otherDamagable != null) { otherDamagable.TakeDamage(50); print("That's a lotta damage!"); } }
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); } }
public void OnTriggerEnter(Collider otherObject) { Damagable damagable = otherObject.GetComponentInParent <Damagable>(); if (damagable != null) { damagable.TakeDamage(bulletDamage); } Die(); }
public override void OnCollisionEnter2D(Collision2D collision) { Damagable other = collision.gameObject.GetComponent <Damagable>(); if (other != null) { other.TakeDamage(damage); } Release(); }
public void OnTriggerEnter(Collider other) { if (canKill) { Damagable enemy = other.GetComponent <Damagable>(); if (enemy != null) { enemy.TakeDamage(); } } }
private void OnTriggerEnter2D(Collider2D collision) { if (rigid.velocity.sqrMagnitude >= MinSpeedForDamage * MinSpeedForDamage) { Damagable damage = collision.GetComponent <Damagable>(); if (damage != null) { damage.TakeDamage(4); } } }
private void OnTriggerEnter2D(Collider2D collision) { Debug.Log(collision.name); Damagable enemy = collision.GetComponent <Damagable>(); if (enemy != null) { cam.Shake(); enemy.TakeDamage(damage); } }
// 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; } }
public virtual void OnCollisionEnter2D(Collision2D collision) { Damagable other = collision.gameObject.GetComponent <Damagable>(); if (other != null) { other.TakeDamage(damage); Release(); } else { life /= 2; } }
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); } }
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(); } }
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; } } }
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; }
public void DamagePlayerOnClients(GameObject obj) { Damagable damagable = obj.GetComponent <Damagable>(); damagable.TakeDamage(0); }
private IEnumerator ChainedPartDestroy(Damagable damagable) { yield return(new WaitForSeconds(chainDestroyDelay)); damagable.TakeDamage(float.MaxValue); }
private void PoisonTick() { combatScript.TakeDamage(poisonDamage, Color.magenta); }
public void MakeDamage(Damagable objectToDamage) { objectToDamage.TakeDamage(damage); }