/// <summary> /// On init we grab our CharacterMovement ability /// </summary> protected override void Initialization() { _characterMovement = this.gameObject.GetComponentInParent <Character>()?.FindAbility <CharacterMovement>(); _characterPathfinder3D = this.gameObject.GetComponentInParent <CharacterPathfinder3D>(); _aiActionMovePatrol3D = this.gameObject.GetComponent <AIActionMovePatrol3D>(); GameObject backToPatrolBeacon = new GameObject(); backToPatrolBeacon.name = this.gameObject.name + "BackToPatrolBeacon"; _backToPatrolTransform = backToPatrolBeacon.transform; }
/// <summary> /// Gets and stores components for further use /// </summary> protected virtual void Initialization() { BindAnimator(); _controller = GetComponent <TopDownController>(); _controller2D = GetComponent <TopDownController2D>(); _controller3D = GetComponent <TopDownController3D>(); _model = _character.CharacterModel; _characterMovement = GetComponent <CharacterMovement>(); _spriteRenderer = GetComponent <SpriteRenderer>(); _health = GetComponent <Health> (); _inputManager = _character.LinkedInputManager; _state = _character.CharacterState; _movement = _character.MovementState; _condition = _character.ConditionState; _abilityInitialized = true; }
/// <summary> /// On init we grab all the components we'll need /// </summary> protected override void Initialization() { _collider = this.gameObject.GetComponent <Collider>(); _controller = this.gameObject.GetComponent <TopDownController>(); _character = this.gameObject.GetComponent <Character>(); _characterMovement = this.gameObject.GetComponent <CharacterMovement>(); _health = this.gameObject.GetComponent <Health>(); _mmPath = this.gameObject.GetComponent <MMPath>(); // initialize the start position _startPosition = transform.position; _initialPosition = this.transform.position; _initialDirection = _direction; _initialScale = transform.localScale; _currentIndex = 0; _indexLastFrame = -1; LastReachedPatrolPoint = this.transform.position; }
/// <summary> /// On init we grab all the components we'll need /// </summary> protected override void Initialization() { _controller = this.gameObject.GetComponentInParent <TopDownController>(); _character = this.gameObject.GetComponentInParent <Character>(); _orientation2D = _character?.FindAbility <CharacterOrientation2D>(); _characterMovement = _character?.FindAbility <CharacterMovement>(); _health = _character?._health; _mmPath = this.gameObject.GetComponentInParent <MMPath>(); // initialize the start position _startPosition = transform.position; // initialize the direction _direction = _orientation2D.IsFacingRight ? Vector2.right : Vector2.left; _initialScale = transform.localScale; _currentIndex = 0; _indexLastFrame = -1; _waitingDelay = 0; _initialized = true; }
/// <summary> /// Sets the weapon's owner /// </summary> /// <param name="newOwner">New owner.</param> public virtual void SetOwner(Character newOwner, CharacterHandleWeapon handleWeapon) { Owner = newOwner; if (Owner != null) { CharacterHandleWeapon = handleWeapon; _characterMovement = Owner.GetComponent <CharacterMovement>(); _controller = Owner.GetComponent <TopDownController>(); if (CharacterHandleWeapon.AutomaticallyBindAnimator) { if (CharacterHandleWeapon.CharacterAnimator != null) { _ownerAnimator = CharacterHandleWeapon.CharacterAnimator; } } } }
/// <summary> /// On init we grab our CharacterMovement ability /// </summary> protected override void Initialization() { _characterMovement = this.gameObject.GetComponentInParent <Character>()?.FindAbility <CharacterMovement>(); }
/// <summary> /// On init we grab our CharacterMovement ability /// </summary> protected override void Initialization() { _characterMovement = this.gameObject.GetComponent <CharacterMovement>(); }
/// <summary> /// On start we grab our character movement component and pick a random direction /// </summary> protected override void Initialization() { _characterMovement = this.gameObject.GetComponent <CharacterMovement>(); _collider = this.gameObject.GetComponent <Collider>(); PickRandomDirection(); }
/// <summary> /// On Awake we grab our components /// </summary> protected virtual void Awake() { AgentPath = new NavMeshPath(); _topDownController = GetComponent <TopDownController>(); _characterMovement = GetComponent <CharacterMovement>(); }