void Start() { player = GameObject.FindGameObjectWithTag("Player"); magicLantern = UtilFinder._GetComponentOfGameObjectWithTag <MagicLantern>("MagicLanternLogic"); fillSpriteRenderers(); setRenderersZeroAlpha(); wasActive = active; sendExistence(); }
static public T _GetComponentOfGameObjectWithTag <T> (string _tag) { GameObject ob = UtilFinder._FindGameObjectByTag(_tag); if (ob == null) { //Debug.Log ("_WARNING_ - NOT FOUND gameobject with tag '" + _tag + "' inside the scene, during getting its component '" + typeof(T) + "'"); return(default(T)); } else { T comp = ob.GetComponent <T> (); if (comp.ToString() == "null") { Debug.Log("_WARNING_ - NOT FOUND component '" + typeof(T) + "' inside '" + ob.name + "'"); } return(comp); } }
static public T _GetComponentOfChildrenWithTag <T> (GameObject _gameObject, string _tag) { GameObject ob = UtilFinder._FindChildByTag(_tag, _gameObject); if (ob != null) { T comp = ob.GetComponent <T> (); if (comp.ToString() == "null") { Debug.Log("_WARNING_ - NOT FOUND component '" + typeof(T) + "' inside '" + ob.name + "'"); } return(comp); } else { Debug.Log("_WARNING_ - NOT FOUND gameobject child with tag '" + _tag + "' inside the gameobejct '" + _gameObject.name + "', during getting its component '" + typeof(T) + "'"); //T comp = null; return(default(T)); } }
static public T[] _GetComponentsOfChildrenWithTag <T>(GameObject _gameObject, string _tag) { GameObject [] ob = UtilFinder._FindChildrenByTag(_tag, _gameObject); ArrayList tempT = new ArrayList(); if (ob.Length > 0) { foreach (GameObject obb in ob) { T comp = obb.GetComponent <T>(); if (comp.ToString() != "null") { tempT.Add(comp); } } if (tempT.Count > 0) { T [] comps = (T[])tempT.ToArray(typeof(T)); return(comps); } else { Debug.Log("_WARNING_ - NOT FOUND components '" + typeof(T) + "' into children with tag '" + _tag + "' inside the gameobejct '" + _gameObject.name + "'"); //T comp = null; return(default(T[])); } } else { Debug.Log("_WARNING_ - NOT FOUND gameobject child with tag '" + _tag + "' inside the gameobejct '" + _gameObject.name + "', during getting its component '" + typeof(T) + "'"); //T comp = null; return(default(T[])); } }
// Use this for initialization void Awake() { controller = GameObject.FindGameObjectWithTag("Controller"); if (controller != null) { cursorHandler = controller.GetComponent <CursorHandler>(); } player = GameObject.FindGameObjectWithTag("Player"); if (player != null) { playerMovements = player.GetComponent <PlayerMovements>(); } magicLanternLogicOBJ = GameObject.FindGameObjectWithTag("MagicLanternLogic"); if (magicLanternLogicOBJ != null) { magicLanternLogic = magicLanternLogicOBJ.GetComponent <MagicLantern>(); magicLanternGraphic = magicLanternLogicOBJ.GetComponent <GraphicLantern>(); glassesManager = magicLanternLogicOBJ.GetComponent <GlassesManager>(); } magicLantern = GameObject.FindGameObjectWithTag("Lantern"); canvasPlayingUI = GameObject.FindGameObjectWithTag("CanvasPlayingUI"); if (canvasPlayingUI != null) { playingUI = canvasPlayingUI.GetComponent <PlayingUI>(); playingUILateral = canvasPlayingUI.GetComponent <PlayingUILateral>(); playingUIGameOver = canvasPlayingUI.GetComponent <PlayingUIGameOver>(); } canvasMenu = UtilFinder._FindGameObjectByTag("CanvasMenu"); unlockableContentUI = UtilFinder._GetComponentOfGameObjectWithTag <UnlockableContentUI> ("Controller"); informativeManager = UtilFinder._GetComponentOfGameObjectWithTag <InformativeManager> ("MenuController"); menuManager = UtilFinder._GetComponentOfGameObjectWithTag <MenuManager> ("MenuController"); playStatusTracker = UtilFinder._GetComponentOfGameObjectWithTag <PlayStatusTracker> ("Controller"); testInformativeManager = UtilFinder._GetComponentOfGameObjectWithTag <TestInformativeManager> ("TestController"); testingController = GameObject.FindGameObjectWithTag("TestController"); if (testingController != null) { hintAnalyzer = testingController.GetComponent <HintAnalyzer>(); } hubController = GameObject.FindGameObjectWithTag("HubController"); if (hubController != null) { unlockedLevelControl = hubController.GetComponent <UnlockedLevelControl>(); hubLadderControl = hubController.GetComponent <HubLadderControl>(); hubLanternControl = hubController.GetComponent <HubLanternControl>(); } if (controller != null) { inputKeeper = controller.GetComponent <InputKeeper>(); } camera = Camera.main.gameObject; if (camera != null) { cameraMovements = camera.GetComponent <CameraMovements>(); cameraHandler = camera.GetComponent <CameraHandler>(); } GameObject levelChanger = GameObject.FindGameObjectWithTag("CanvasLoadLevel"); if (levelChanger != null) { levelChangerGeneral = levelChanger.GetComponent <LevelChangerGeneral> (); } GameObject buttonControllerOBJ = GameObject.FindGameObjectWithTag("ButtonControllerLink"); if (buttonControllerOBJ != null) { buttonController = buttonControllerOBJ.GetComponent <ButtonController> (); inputManager = buttonControllerOBJ.GetComponent <InputManager>(); buttonKeyboardMouse = buttonControllerOBJ.GetComponent <ButtonKeyboardMouse>(); } }
void initializeComponents() { cursorHandler = UtilFinder._GetComponentOfGameObjectWithTag <CursorHandler> ("Controller"); }
void getPlayer() { player = UtilFinder._FindGameObjectByTag("Player"); }