// Sets foreign references protected void SetReferences() { // Get the scripts from GameController GameObject gameContObj = GameObject.FindWithTag("GameController"); if (gameContObj == null) { Debug.Log("Could not find a gameobject with the tag GameController"); } // Get the MoveAttackController _mAContRef = gameContObj.GetComponent <MoveAttackController>(); if (_mAContRef == null) { Debug.Log("Could not MoveAttackController attached to " + gameContObj.name); } // Get the audio manager try { _audManRef = GameObject.FindWithTag("AudioManager").GetComponent <AudioManager>(); } catch { Debug.Log("Could not get AudioManager"); } }
/// <summary> /// Sets the reference to the MoveAttackController /// </summary> private void SetReferences() { GameObject gameControllerObj = GameObject.FindWithTag("GameController"); if (gameControllerObj == null) { Debug.Log("Could not find any GameObject with the tag GameController"); } else { _mAContRef = gameControllerObj.GetComponent <MoveAttackController>(); if (_mAContRef == null) { Debug.Log("Could not find MoveAttackController attached to " + gameControllerObj.name); } } // Get the audio manager try { _audManRef = GameObject.FindWithTag("AudioManager").GetComponent <AudioManager>(); } catch { Debug.Log("Could not get AudioManager"); } }
private bool isPaused; // If the game is paused or not // Set references private void Awake() { scriptsToTurnOff = new List <MonoBehaviour>(); // Get the scripts on the GameController GameObject gameController = GameObject.FindWithTag("GameController"); if (gameController == null) { Debug.Log("Could not find any GameObject with the tag GameController"); } else { inpContRef = gameController.GetComponent <InputController>(); if (inpContRef == null) { Debug.Log("Could not find InputController attached to " + gameController.name); } mAContRef = gameController.GetComponent <MoveAttackController>(); if (mAContRef == null) { Debug.Log("Could not find MoveAttackController attached to " + gameController.name); } scriptsToTurnOff.Add(mAContRef); mAGUIContRef = gameController.GetComponent <MoveAttackGUIController>(); if (mAGUIContRef == null) { Debug.Log("Could not find MoveAttackGUIController attached to " + gameController.name); } scriptsToTurnOff.Add(mAGUIContRef); enemyMAAIRef = gameController.GetComponent <EnemyMoveAttackAI>(); if (enemyMAAIRef == null) { Debug.Log("Could not find EnemyMoveAttackAI attached to " + gameController.name); } scriptsToTurnOff.Add(enemyMAAIRef); turnSysRef = gameController.GetComponent <TurnSystem>(); if (turnSysRef == null) { Debug.Log("Could not find TurnSystem attached to " + gameController.name); } scriptsToTurnOff.Add(turnSysRef); } }
// Set references private void Awake() { _mAContRef = this.GetComponent <MoveAttackController>(); if (_mAContRef == null) { Debug.Log("Could not find MoveAttackController attached to " + this.name); } _inpContRef = this.GetComponent <InputController>(); if (_inpContRef == null) { Debug.Log("Could not find InputController attached to " + this.name); } // We don't put this in OnEnable because this component will get disabled // When we confirm stat changes, try to reselect the character (if we have one selected) CharDetailedMenuController.OnStatConfirm += ReselectCurrentCharacter; }
// Set References private void Awake() { GameObject gameController = GameObject.FindWithTag("GameController"); // Make sure a GameController exists if (gameController == null) { Debug.Log("Could not find any GameObject with the tag GameController"); } else { _mAContRef = gameController.GetComponent <MoveAttackController>(); // Make sure we verify we actually found a MoveAttackController if (_mAContRef == null) { Debug.Log("There was no MoveAttackController attached to " + gameController.name); } } _enemiesMA = new List <MoveAttack>(); }
// Called before start // Set references private void Awake() { try { // GameController references GameObject gameContObj = GameObject.FindWithTag("GameController"); _mAContRef = gameContObj.GetComponent <MoveAttackController>(); } catch { Debug.LogError("Could not set references to GameController"); } try { // Self references _mARef = this.GetComponent <MoveAttack>(); } catch { Debug.Log("Could not set reference to self"); } }