示例#1
0
    void OnTriggerEnter2D(Collider2D other)
    {
        Debug.Log("Collided with " + other.ToString());
        foreach (Block block in other.gameObject.GetComponents<Block>())
        {
            block.health -= damage;
            //block.GetComponentInParent<Rigidbody2D>().AddForce(transform.TransformVector(body.velocity*100f), ForceMode2D.Force);
            OnKill();

        }
    }
 public string GetDescription()
 {
     if (collider2DRef == null)
     {
         return(collider2DVal != null?collider2DVal.ToString() : "Null");
     }
     else
     {
         return(collider2DRef.Key);
     }
 }
 public override void OnTriggerEnter2D(Collider2D other)
 {
     Debug.Log(other.ToString() + " has entered trigger zone " + this.name);
 }
 public override void OnTriggerStay2D(Collider2D other)
 {
     Debug.Log(other.ToString() + " is staying in trigger zone " + this.name);
 }