/// <summary> /// Unity's method called right after the object is created. /// </summary> protected void Awake() { // Retrieves the desired components _transform = transform; _helpController = GameObject.FindGameObjectWithTag(Tags.GameController).GetComponent<GameControllerHelp>(); _gcic = _helpController.GetComponent<GameControllerIndependentControl>(); helpObjects = GetComponentsInChildren<HelpItem>(); }
protected override void OnAwake() { // Retrieves the desired components base.OnAwake(); _aiComponent = GetComponentInParent<AIBase>(); _independentControl = GameObject.FindGameObjectWithTag(Tags.GameController).GetComponent<GameControllerIndependentControl>(); // Registers itself to the AIBase events _aiComponent.AddListener(this); }
void Start() { // Retrieves the desired components // This needs to be done on the start method since this object // is going to be instantiated _irrigate = GetComponentInParent<Irrigate>(); _independentControl = GameObject.FindGameObjectWithTag(Tags.GameController).GetComponent<GameControllerIndependentControl>(); // Registers itself to the Irrigate events _irrigate.AddListener(this); }
/// <summary> /// Unity's method (only called if the Object is active): /// This function is called just after the object is enabled. /// </summary> public void OnEnable() { // If we can ground drop if (CalculateSpawnPos()) { // Get reference to independent control _independentControl = GameObject.FindGameObjectWithTag(Tags.GameController).GetComponent<GameControllerIndependentControl>(); // Create the character of target size _independentControl.CreateDrop(_spawnPosition, controlled, addToControlList, size); } Object.Destroy(this.gameObject); }
protected override void OnAwake() { base.OnAwake(); // Retrieves the desired components _characterSize = GetComponentInParent<CharacterSize>(); _renderers = GetComponentsInChildren<Renderer>(); _gcic = GameObject.FindGameObjectWithTag(Tags.GameController).GetComponent<GameControllerIndependentControl>(); _character = _characterSize.gameObject; // Selects an index for this object _index = -indexStep * nextAvailableIndex; // The index is negative nextAvailableIndex++; // Sets the controlled flag to false by default _wasControlled = false; // Sets the renderers' order to the index foreach (Renderer renderer in _renderers) renderer.sortingOrder += _index; }
protected override void OnAwake() { // Retrieves the desired components base.OnAwake(); _independentControl = GameObject.FindGameObjectWithTag(Tags.GameController).GetComponent<GameControllerIndependentControl>(); }
/// <summary> /// Unity's method called when this entity is created, even if it is disabled. /// </summary> void Awake() { // Looks for the independent controller component _independentControl = FindObjectOfType<GameControllerIndependentControl>(); // Looks for the independent controller component _inputControl = FindObjectOfType<GameControllerInput>(); // Get component depth of field _dof = GetComponent<DepthOfField>(); // Sets the camera's target to the current character SetObjective(_independentControl.currentCharacter); }
// Use this for initialization void Awake() { _independentControl = GameObject.FindGameObjectWithTag(Tags.GameController) .GetComponent<GameControllerIndependentControl>(); _characterSize = GetComponent<CharacterSize>(); }
void Start() { // Retrives the independent control component _switcher = GetComponent<GameControllerIndependentControl>(); //_mainCameraController = GetComponentInChildren<MainCameraController>(); _helpController = GetComponent<GameControllerHelp>(); _ui = GameObject.FindGameObjectWithTag(Tags.Menus).GetComponent<MenuNavigator>(); _enabled = true; }
/// <summary> /// Unity's method called the first frame this object is active. /// </summary> void Awake() { // Retrieves the desired componentss _gcic = GameObject.FindGameObjectWithTag(Tags.GameController).GetComponent<GameControllerIndependentControl>(); }
/// <summary> /// Initialization method. /// The character start with size one /// </summary> public void Awake() { //get the independ control to know if the detected drop is under control _independentControl = GameObject.FindGameObjectWithTag(Tags.GameController) .GetComponent<GameControllerIndependentControl>(); //get the animator of the enemy _animator = commonParameters.enemy.GetComponent<Animator>(); _animator.SetInteger("LimitSizeDrop", commonParameters.sizeLimitDrop); commonParameters.rootEntityPosition = transform; commonParameters.initialPositionEnemy = commonParameters.enemy.transform.position; commonParameters.initialRotationEnemy = commonParameters.enemy.transform.rotation; commonParameters.AI = this; }
/// <summary> /// Unity's method called right after the object is created. /// </summary> void Awake() { // Retrieves the desired components _ccc = GetComponentInParent<CharacterControllerCustom>(); _characterSize = GetComponentInParent<CharacterSize>(); _characterFusion = GetComponentInParent<CharacterFusion>(); _characterShoot = GetComponentInParent<CharacterShoot>(); _animator = GetComponent<Animator>(); _gcic = GameObject.FindGameObjectWithTag(Tags.GameController).GetComponent<GameControllerIndependentControl>(); _drop = transform.parent.gameObject; }
/// <summary> /// Unity's method called when the entity is created. /// Recovers the desired componentes of the entity. /// </summary> public void Awake() { ccc = GetComponent<CharacterControllerCustom>(); _shootTrajectory = GetComponent<CharacterShootTrajectory>(); size = GetComponent<CharacterSize>(); _independentControl = GameObject.FindGameObjectWithTag(Tags.GameController) .GetComponent<GameControllerIndependentControl>(); }
void Awake() { // Retrieves the desired components _transform = transform; _ccc = GetComponent<CharacterControllerCustom>(); _characterSize = GetComponent<CharacterSize>(); _characterFusion = GetComponent<CharacterFusion>(); _characterShoot = GetComponent<CharacterShoot>(); _controller = GetComponent<CharacterController>(); _gcic = GameObject.FindGameObjectWithTag(Tags.GameController).GetComponent<GameControllerIndependentControl>(); }
void Start() { // Get reference to input controller _gci = GameObject.FindGameObjectWithTag(Tags.GameController).GetComponent<GameControllerInput>(); // Get reference to independent control _gcic = GameObject.FindGameObjectWithTag(Tags.GameController).GetComponent<GameControllerIndependentControl>(); // Get reference to level transition controller _levelTransitionController = GetComponent<LevelTransitionController>(); if (_data == null) { _nextScene = new Scene(); Debug.LogWarning("Next Scene not setted, using Menu by default, please, assign an scene"); _nextScene.name = "Menu"; } else { string nameScene = SceneManager.GetActiveScene().name; _nextScene = _data.GetNextScene(nameScene, out _nextLevel); _actualLevel = _data.GetInfoScene(nameScene); if (_nextScene==null) { _nextScene = _data.GetDefaultScene(); _nextScene.name = "Thanks"; } } }
/// <summary> /// Initialization method. /// The character start with size one /// </summary> public void Awake() { // Retrieves the desired components _layerCast = (1 << LayerMask.NameToLayer("Scene")); _dropTransform = gameObject.transform; _ratioRadius = GetComponent<CharacterController>().radius; _controller = GetComponent<CharacterControllerCustom>(); _independentControl = GameObject.FindGameObjectWithTag(Tags.GameController) .GetComponent<GameControllerIndependentControl>(); // Initialization _setState = false; _listeners = new List<CharacterSizeListener>(); //set the motionless situation clear _motionless = false; _motionlessTime = 0; //set the initial size if (initialSize <= 0) { initialSize = 1; } ChangeScale(Vector3.one * initialSize); _targetSize = initialSize; SetSize(initialSize); }
/// <summary> /// Unity's method called at the beginning of each frame. /// Checks if at least one trigger is attached to the object. /// </summary> void Start() { // Initialization _stayingColliders = new List<Collider>(); GameObject gameController = GameObject.FindGameObjectWithTag(Tags.GameController); if (gameController == null) Debug.LogError("Error: No Game Controller was found on the scene."); else { _gameControllerIndependentControl = gameController.GetComponent<GameControllerIndependentControl>(); if (_gameControllerIndependentControl == null) Debug.LogError("Error: No Independent Control component was found in the Game Controller."); } // Checks if the colliders are valid _colliders = GetComponents<Collider>(); if (_colliders.Length == 0) Debug.LogWarning("Warning: No collider attached to the trigger area!"); else { bool atLeastOneTrigger = false; foreach (Collider collider in _colliders) if (collider.isTrigger) { atLeastOneTrigger = true; break; } if (!atLeastOneTrigger) Debug.LogWarning("Warning: None of the attached colliders is a trigger!"); } }
/// <summary> /// Unity's method called right after the object is created. /// </summary> public void Awake() { // Retrieves the desired components _originalAudioSource = GetComponent<AudioSource>(); _gcic = GetComponent<GameControllerIndependentControl>(); // Creates the audio sources _audioSources = new AudioSource[musicClips.Length]; // Checks if there is at least one clip if (musicClips.Length == 0) { Debug.LogWarning("Error: No clips where specified. Disabling the music."); enabled = false; return; } // The first audio source is the original one _audioSources[0] = _originalAudioSource; _audioSources[0].clip = musicClips[0].clip; // Creates a copy of the audio source for the other music clip for (int i = 1; i < musicClips.Length; i++) { _audioSources[i] = SoundUtility.CopyAudioSource(_originalAudioSource, gameObject); _audioSources[i].clip = musicClips[i].clip; } //Apply the stored options of the user RestoreSettings(); }
/// <summary> /// Unity's method called on start script only one time /// </summary> void Start() { // Retrieves the components of the entities. _collider = gameObject.GetComponent<BoxCollider>(); // Retrieves the components of the entity. _cameraController = FindObjectOfType<MainCameraController>(); // Looks for the independent controller component _independentControl = GameObject.FindGameObjectWithTag("GameController").GetComponent<GameControllerIndependentControl>(); }