예제 #1
0
    void Start()
    {
        TankWheel[] tankWheels = GetComponentsInChildren <TankWheel>();
        wheels.AddChildObjects(tankWheels);

        body.AddGameObjects();
        turret.AddGameObjects();
        barrel.AddGameObjects();
        tracks.AddGameObjects();
        wheels.AddGameObjects();

        //Add all renderers to the activeRenderer list
        foreach (GameObject gameObject in body.gameObjectsList)
        {
            renderedObjects.Add(gameObject);
        }
        foreach (GameObject gameObject in turret.gameObjectsList)
        {
            renderedObjects.Add(gameObject);
        }
        foreach (GameObject gameObject in barrel.gameObjectsList)
        {
            renderedObjects.Add(gameObject);
        }
        foreach (GameObject gameObject in wheels.gameObjectsList)
        {
            renderedObjects.Add(gameObject);
        }
        foreach (GameObject gameObject in tracks.gameObjectsList)
        {
            renderedObjects.Add(gameObject);
        }

        body.SaveMaterials();
        turret.SaveMaterials();
        barrel.SaveMaterials();
        tracks.SaveMaterials();
        wheels.SaveMaterials();
    }