Esempio n. 1
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "HOLE")
     {
         WallsController controller = other.GetComponentInParent <WallsController>();
         controller.ReverseDirection();
     }
 }
Esempio n. 2
0
    void OnTriggerEnter2D(Collider2D collider)
    {
        WallsController wall = collider.GetComponent <WallsController>();

        if (wall != null)
        {
            LevelController.addPointForWalls();
            wall.Destroy();
        }
    }
Esempio n. 3
0
    /*
     * -------------------------------------------------------------------------
     * MARK: LIFECYCLE FUNCTIONS
     * -------------------------------------------------------------------------
     */

    void Awake()
    {
        wallsController = GameObject.FindGameObjectWithTag("Walls").GetComponent <WallsController>();
        List <Transform> childTransforms = new List <Transform>();

        for (int i = 0; i < transform.childCount; i++)
        {
            childTransforms.Add(transform.GetChild(i));
        }
        wallSegmentControllers = childTransforms.ToArray()
                                 .Select((trans) => trans.gameObject.GetComponent <WallSegmentController>())
                                 .Cast <WallSegmentController>()
                                 .ToArray();
    }
Esempio n. 4
0
 public void Awake()
 {
     Instance = this;
 }