Example #1
0
    void Start()                                                                                                                                // --> function Start
    {
        obj_Game_Manager = GameObject.Find("Manager_Game");                                                                                     // Find the gameObject Manager_Game
        if (obj_Game_Manager != null)
        {
            gameManager = obj_Game_Manager.GetComponent <Manager_Game>();                                                               // Access Manager_Game from obj_Game_Manager
        }
        sound_ = GetComponent <AudioSource>();                                                                                          // Access AudioSource Component

        if (obj_Led)
        {
            Led_Renderer = obj_Led.GetComponent <ChangeSpriteRenderer>();                                       // If obj_Led = true; Access ChangeSpriteRenderer Component
        }
        if (Toy)
        {
            toy = Toy.GetComponent <Toys>();                                                                                                            // access Toys component if needed
        }
    }
Example #2
0
    void Start()                                                                                                                //	--> Init
    {
        obj_Game_Manager = GameObject.Find("Manager_Game");                                                                     // Find the gameObject Manager_Game
        if (obj_Game_Manager != null)
        {
            gameManager = obj_Game_Manager.GetComponent <Manager_Game>();                                               // Access Manager_Game from obj_Game_Manager
        }
        sound_ = GetComponent <AudioSource>();                                                                          // Access AudioSource Component

        if (obj_Led)
        {
            Led_Renderer = obj_Led.GetComponent <ChangeSpriteRenderer>();                       // Access led component if needed
        }
        if (obj_Toy)
        {
            toy = obj_Toy.GetComponent <Toys>();                                                                                // Access led component if needed
        }
    }
Example #3
0
 void Start()                                                                                                                                                        // --> Function Start
 {
     Box_Col          = GetComponent <BoxCollider>();
     sound_           = GetComponent <AudioSource>();                                                                                        // Access AudioSource component
     obj_Game_Manager = GameObject.Find("Manager_Game");                                                                                     // Find Manager_Game gameObject
     if (obj_Game_Manager != null)
     {
         gameManager = obj_Game_Manager.GetComponent <Manager_Game>();                                                               // access to the script Manager_Game.js on gameObject Manager_Game on the hierarchy
     }
     if (obj_Led)
     {
         led_Renderer = obj_Led.GetComponent <ChangeSpriteRenderer>();                                       // obj_Led != null Access ChangeSpriteRenderer component
     }
     if (obj_Target)
     {
         target = obj_Target.GetComponent <Target>();                                                                                // obj_Target != null Access Target component
     }
     Transform[] tmp = gameObject.GetComponentsInChildren <Transform>(true);                                                         // Find Spawn Transform. WARNING Don't move spawn gameObject outside the Hole GameObject.
     foreach (Transform child in tmp)
     {
         if (child.name == "Spawn_Hole")
         {
             Spawn = child;
         }
     }
     if (Toy_Enter)
     {
         toyEnter = Toy_Enter.GetComponent <Toys>();                                                                         // Access component Toys from Toy_Enter
     }
     if (Toy_Exit)
     {
         toyExit = Toy_Exit.GetComponent <Toys>();                                                                                   // Access component Toys from Toy_Exit
     }
     if (MovingObjects)
     {
         MovingObjects.GetComponent <movingObject>();
     }
 }
Example #4
0
 void Start()
 {
     Led = GetComponent <ChangeSpriteRenderer>();
 }