/// protected override void Initialization() { if (LevelManager.Instance.Players.Count == 0) { Debug.LogError("No player found!"); return; } if (_controller == null) { _controller = this.gameObject.GetComponent <CorgiController>(); thisCharacter = this.gameObject.GetComponent <Character>(); } else { _controller = this.gameObject.GetComponentInParent <CorgiController>(); thisCharacter = this.gameObject.GetComponentInParent <Character>(); } _characterHorizontalMovement = thisCharacter?.FindAbility <CharacterHorizontalMovement>(); _characterRun = thisCharacter?.FindAbility <CharacterRun>(); _characterJump = thisCharacter?.FindAbility <CharacterJump>(); _jetpack = thisCharacter?.FindAbility <CharacterJetpack>(); thisCharacter.MovementState.ChangeState(CharacterStates.MovementStates.Idle); }
/// protected override void Initialization() { AgentFollowsPlayer = false; _target = LevelManager.Instance.Players[0].transform; _controller = GetComponent <CorgiController>(); _targetCharacter = GetComponent <Character>(); _characterBasicMovement = GetComponent <CharacterHorizontalMovement>(); _targetCharacter.MovementState.ChangeState(CharacterStates.MovementStates.Idle); _characterRun = GetComponent <CharacterRun>(); _characterJump = GetComponent <CharacterJump>(); _jetpack = GetComponent <CharacterJetpack>(); followSpeedStorage = followSpeed; }
/// <summary> /// Initialization /// </summary> protected virtual void Start() { if (LevelManager.Instance.Players.Count == 0) { return; } // we get the player _target = LevelManager.Instance.Players[0].transform; // we get its components _controller = GetComponent <CorgiController>(); _targetCharacter = GetComponent <Character>(); _characterHorizontalMovement = GetComponent <CharacterHorizontalMovement>(); _characterRun = GetComponent <CharacterRun>(); _characterJump = GetComponent <CharacterJump>(); _jetpack = GetComponent <CharacterJetpack>(); // we make the agent start following the player AgentFollowsPlayer = true; _targetCharacter.MovementState.ChangeState(CharacterStates.MovementStates.Idle); }
/// <summary> /// Here you should initialize our parameters /// </summary> protected override void Initialization() { base.Initialization(); _characterJetpack = transform.GetComponent <CharacterJetpack>(); }