Esempio n. 1
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.CompareTag("Trigger"))
     {
         TriggerItem item = other.gameObject.GetComponent <TriggerItem>();
         if (item != null)
         {
             item.ColEnter(this);
         }
     }
 }
Esempio n. 2
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag("Enemy"))
        {
            other.gameObject.GetComponent <Enemy>().TakeDamage(damage);
        }

        if (other.gameObject.CompareTag("Trigger"))
        {
            TriggerItem item = other.gameObject.GetComponent <TriggerItem>();
            if (item != null)
            {
                item.ColEnter();
            }
        }
    }
Esempio n. 3
0
    private void OnCollisionEnter2D(Collision2D other)
    {
        if (other.gameObject.CompareTag("Enemy") && _hurtEnable)
        {
            Hurt(other.gameObject.GetComponent <Enemy>().GetDamage());
        }

        if (other.gameObject.CompareTag("Depot1"))
        {
            PowerUp1();
        }

        if (other.gameObject.CompareTag("Depot2"))
        {
            PowerUp2();
        }

        if (other.gameObject.CompareTag("Trigger"))
        {
            TriggerItem item = other.gameObject.GetComponent <TriggerItem>();
            if (item != null)
            {
                item.ColEnter(this);
            }
        }

        if (other.gameObject.CompareTag("Slate"))
        {
            this.transform.parent = other.transform;
        }

        if (other.gameObject.CompareTag("CommandSlate"))
        {
            this.transform.parent = other.transform;
            TriggerItem item = other.gameObject.GetComponent <TriggerItem>();
            if (item != null)
            {
                item.ColEnter(this);
            }
        }
    }
Esempio n. 4
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.CompareTag("Enemy"))
        {
            other.GetComponent <Enemy>().TakeDamage(damage);
        }

        if (other.gameObject.CompareTag("Ground") || other.gameObject.CompareTag("TwoWaysPlatform"))
        {
            Destroy(gameObject);
        }

        if (other.gameObject.CompareTag("Trigger"))
        {
            TriggerItem item = other.gameObject.GetComponent <TriggerItem>();
            if (item != null)
            {
                item.ColEnter();
            }
        }
    }