Пример #1
0
 void OnTriggerEnter2D(Collider2D coll)
 {
     if (coll.gameObject.tag == "Player")
     {
         if (playerControllerScript != null)
         {
             playerControllerScript.playerGetsHurt();
         }
         else
         {
             Debug.Log("SlimeController Script: PlayerControllerScript is null.");
         }
     }
     else if (coll.gameObject.tag == "ActiveBox")
     {
         boxCollided = coll.gameObject;
         if (boxCollided != null)
         {
             boxCollidedScript = boxCollided.GetComponent <BoxController>();
             boxCollidedScript.boxCheck();
         }
         else
         {
             Debug.Log("Error: Box Collided Null");
         }
         checkRebound();
     }
     else if (coll.gameObject.tag == "InActiveBox")
     {
     }
     else if (coll.gameObject.tag == "Wall")
     {
         checkRebound();
     }
     else if (coll.gameObject.tag == "StoneBlock")
     {
         checkRebound();
     }
     else if (coll.gameObject.tag == "SlimeMonster")
     {
     }
     else if (coll.gameObject.tag == "SpikeBall")
     {
     }
     else if (coll.gameObject.tag == "WingMan")
     {
     }
     else
     {
         Debug.Log("WingManController: Trigger Collision UnAccounted For" + coll.gameObject.name + "--" + coll.gameObject.tag);
     }
 }
    void OnTriggerEnter2D(Collider2D coll)
    {
        if (coll.gameObject.tag == "ActiveBox")
        {
            movingUpCheck();

            boxCollided = coll.gameObject;
            if (boxCollided != null)
            {
                boxCollidedScript = boxCollided.GetComponent <BoxController>();
                boxCollidedScript.boxCheck();
            }
            else
            {
                Debug.Log("PipeFlowerController Error: Box Collided Null");
            }
        }
    }
Пример #3
0
    void checkPhysics2DPoint(Vector3 point)
    {
        overlapPosition = Physics2D.OverlapPoint(point);

        if (overlapPosition == null)
        {
            //There is Nothing at that Point
        }
        else if (Physics2D.OverlapPoint(point).tag == "InActiveBox" || Physics2D.OverlapPoint(point).tag == "ActiveBox")
        {
            box = Physics2D.OverlapPoint(point).gameObject;
            boxControllerScript = box.GetComponent <BoxController> ();
            boxControllerScript.boxCheck();
        }
        else if (Physics2D.OverlapPoint(point).tag == "Telescope")
        {
            //Do nothing, don't build ontop of Telescope
        }
        else if (Physics2D.OverlapPoint(point).tag == "Spring")
        {
            //Do nothing, don't build ontop of Spring
        }
        else if (Physics2D.OverlapPoint(point).tag == "Pipe")
        {
            //Do nothing, don't build ontop of Pipe
        }
        else if (Physics2D.OverlapPoint(point).tag == "PipeFlower")
        {
            //Do nothing, don't build ontop of PipeFlower
        }
        else if (Physics2D.OverlapPoint(point).tag == "Rock")
        {
            //Do nothing, don't build ontop of PipeFlower
        }
        else
        {
            Debug.Log("PlayerController: OverlapPoint Unaccounted For.");
        }
    }
Пример #4
0
 void OnTriggerEnter2D(Collider2D coll)
 {
     if (coll.gameObject.tag == "Player")
     {
         //Do Nothing
     }
     else if (coll.gameObject.tag == "Spikes")
     {
         this.gameObject.DestroyAPS();            //Break Self
     }
     else if (coll.gameObject.tag == "Fireball")
     {
         //Do Nothing
     }
     else if (coll.gameObject.tag == "Rock")
     {
         this.gameObject.DestroyAPS();            //Break Self
     }
     else if (coll.gameObject.tag == "Wall")
     {
         this.gameObject.DestroyAPS();            //Break Self
     }
     else if (coll.gameObject.tag == "StoneBlock")
     {
         this.gameObject.DestroyAPS();            //Break Self
     }
     else if (coll.gameObject.tag == "ActiveBox")
     {
         boxControllerScript = coll.gameObject.GetComponent <BoxController>();
         boxControllerScript.boxCheck();
         this.gameObject.DestroyAPS();            //Break Self
     }
     else if (coll.gameObject.tag == "InActiveBox")
     {
         //Do Nothing
     }
     else if (coll.gameObject.tag == "SlimeMonster")
     {
         //Break SpikeBall - This is done in SlimeBallController
         this.gameObject.DestroyAPS();            //Break Self
     }
     else if (coll.gameObject.tag == "SpikeBall")
     {
         //Break SpikeBall - This is done in SpikeBallController
         this.gameObject.DestroyAPS();            //Break Self
     }
     else if (coll.gameObject.tag == "WingMan")
     {
         //Break SpikeBall - This is done in WingManController
         this.gameObject.DestroyAPS();            //Break Self
     }
     else if (coll.gameObject.tag == "Door")
     {
         //Do Nothing
     }
     else if (coll.gameObject.tag == "Key")
     {
         //Do Nothing
     }
     else if (coll.gameObject.tag == "Spring")
     {
         //Do Nothing
     }
     else
     {
         Debug.Log("FireballController: TriggerCollision UnAccounted For" + coll.gameObject.name + "--" + coll.gameObject.tag);
     }
 }