//<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< // M E T H O D S //>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> //Probably this should be in the gm, but I don't want to touch it because i feel there would be problems while merging void Start() { if (gm == null) { gm = FindObjectOfType <GameManager>(); UnityEditor.Selection.activeObject = gm.gameObject; } gm = GameManager.instance; lm = gm.GetComponent <LevelManager>(); sColors = gm.GetComponent <StoreColors>(); lr = gm.GetComponent <LevelReguards>(); //Search for the models in the current scene --------------------------Add new things if (gm.CurrentSceneName == "Inside") { insideMat = GameObject.Find("CoopInsideModel").GetComponentInChildren <MeshRenderer>().material; nestMat = GameObject.Find("NestHub").GetComponentInChildren <MeshRenderer>().material; perchMat = GameObject.Find("Perch").GetComponentInChildren <MeshRenderer>().material; fencesMat = new Material[1]; } else if (gm.CurrentSceneName == "Outside") { coopMat = GameObject.Find("CoopModel").GetComponentInChildren <MeshRenderer>().material; doorMat = GameObject.Find("Door/DoorFlap").GetComponentInChildren <MeshRenderer>().material; MeshRenderer[] fences = GameObject.Find("Fences").GetComponentsInChildren <MeshRenderer>(); fencesMat = new Material[fences.Length - 21]; int i = 0; foreach (MeshRenderer mesh in fences) { string matName = mesh.material.name; if (matName != "FencePlaneTileTexture (Instance)") { fencesMat[i] = mesh.material; i++; } } } StartCoroutine(PaintTextures()); //--------------------------------I have to do this early somewhere because when the scene begins we can se how the color change }
void Start() { lr = GetComponent <LevelReguards>(); //Should get the experience and the level from the loading script }