void ObjFinder()
    {
        if (player == null)
        {
            player = GameObject.Find("Player");
        }
        if (controller == null)
        {
            controller = player.GetComponent <PlayerController>();
        }

        if (timeText == null)
        {
            toggy    = this.GetComponent <ToggleUI>();
            timeText = toggy.getTextObject("time").GetComponent <Text>();
        }
    }
Exemplo n.º 2
0
 void ObjFinder()
 {
     //automatically find objects
     if (player == null)
     {
         player = GameObject.Find("Player");
     }
     if (playerSpeed == null)
     {
         playerSpeed = player.GetComponent <Rigidbody2D>();
     }
     if (controller == null)
     {
         controller = player.GetComponent <PlayerController>();
     }
     if (speedTxt == null)
     {
         toggy    = this.GetComponent <ToggleUI>();
         speedTxt = toggy.getTextObject("speed").GetComponent <Text>();
     }
 }