public void takeDamage(float v) { if (isDead) { return; } health -= v; if (health <= 0) { isDead = true; if (EffectDirector.instance != null) { EffectDirector.instance.playInPlace(transform.position, StaticStrings.SKULL); } health = 0; TD_Character c = GetComponent <TD_Character>(); if (c != null) { if (c.getBall()) { c.haveBall(false); TD_PancakeBall.instance.loseBall(); } c.Dead(true); } } }
private void OnTriggerEnter(Collider other) { if (isTaked) { return; } if (other.tag == StaticStrings.AI || other.tag == StaticStrings.player || other.tag == StaticStrings.helper || other.tag == StaticStrings.cpu) { TD_Character c = other.GetComponent <TD_Character>(); if (c != null) { isTaked = true; c.haveBall(true); possessorTm = c.team; gm.GivePossessor(c.team); takeIn_Hand(c.getHand()); if (onTakingBall != null) { onTakingBall(possessorTm, other.transform); } else { Debug.Log("on taking ball is null"); } } } }