コード例 #1
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     Debug.Log(collision.gameObject.name);
     if (collision.gameObject.name == "Player")
     {
         Entity_Logic playerE = collision.gameObject.GetComponent <Entity_Logic>();
         playerE.TakeDamage(4);
         collidedWithPlayer = true;
     }
 }
コード例 #2
0
 //enemy/ally check
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (targetLayer.Contains((CustomGCOTypes.CollisionLayerKey)collision.gameObject.layer))
     {
         Entity_Logic temp = collision.gameObject.GetComponent <Entity_Logic>();
         if (temp != null)
         {
             temp.TakeDamage(damage);
         }
     }
 }
コード例 #3
0
 //enemy/ally check
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (targetLayer.Contains((CustomGCOTypes.CollisionLayerKey)collision.gameObject.layer))
     {
         Entity_Logic temp = collision.gameObject.GetComponent <Entity_Logic>();
         if (temp != null)
         {
             temp.TakeDamage(damage);
         }
     }
     if ((CustomGCOTypes.CollisionLayerKey)collision.gameObject.layer != CustomGCOTypes.CollisionLayerKey.platforms)
     {
         PoofObject();
     }
 }