protected void OnCollisionEnter(Collision collision)
    {
        KillableInterface ki = collision.gameObject.GetComponent <KillableInterface>();

        if (ki != null)
        {
            ki.Damage(damageOnTouch * Time.fixedDeltaTime);
        }
    }
예제 #2
0
 private void OnTriggerEnter(Collider other)
 {
     Debug.Log("yes");
     if (other.gameObject.tag == "Player")
     {
         KillableInterface kill = other.gameObject.GetComponent <KillableInterface>();
         kill.onDie();
     }
 }
 private void OnCollisionStay(Collision collision)
 {
     KillableInterface ki = collision.gameObject.GetComponent<KillableInterface>();
     simpleAIMoveTo ai = collision.gameObject.GetComponent<simpleAIMoveTo>();
     if (ki != null && ai == null)
     {
         ki.Damage(damageOnTouch * Time.fixedDeltaTime);
     }
     if (collision.contacts[0].normal.y > 0)
     {
         onGround = true;
     }
 }