Пример #1
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "Wall")
     {
         EP.Flip();
     }
 }
Пример #2
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (!shieldReduced && (col.gameObject.name == "frontCheck" || col.gameObject.name == "BackCollider"))
        {
            thisCollider.enabled = false;

            if (col.gameObject.name == "frontCheck")
            {
                EnemyPatrol ep = col.transform.root.GetComponent <EnemyPatrol> ();
                ep.Flip();

                Invoke("ReduceShield", 0.1f);
            }
            else if (col.gameObject.name == "BackCollider")
            {
                Invoke("ReduceShield", 0.1f);
            }
            AddForceToPlayer(XForceToPlayer, YForceToPlayer);
            shieldReduced = true;
        }
    }