private void LateUpdate() { Vector3 inputPosition = GetInputWASD(); if (inputPosition != _moveComponent.Position) { _moveComponent.ClearTargetPositionsOnly(); _moveComponent.AddNewEndpos(inputPosition); _gotInputLastFrame = true; } else if (_gotInputLastFrame) { _moveComponent.ClearPath(); _gotInputLastFrame = false; } }
public sealed override void LogicalUpdate() { MoveComponent move = _attackMode.AICharacter.MoveComponent; Vector3 targetPos = _attackMode.Target.Position; _attackMode.Currentattack.Activate(true); move.ClearPath(); float distsqr = (targetPos - move.Position).sqrMagnitude; if (distsqr > _attackMode.Currentattack.Reach.Sq() * _attackMode.ratioTargetGettingFarSq) { _SM.ChangeState(_withinARMoveState); } else if (distsqr < _attackMode.Currentattack.Reach.Sq() * _attackMode.ratioTooClosesq) { _SM.ChangeState(_tooCloseState); } }
public virtual void Trigger() { enabled = true; if (Life.IsLifeOfCharacter) { _character = this.GetCharacter(); _character.enabled = false; _moveComponent = _character.MoveComponent; _moveComponent.gameObject.SetActive(false); _moveComponent.ClearPath(); transform.position = _moveComponent.Position; _rendStart = _character.Skin[0].Renderer; _rend = gameObject.AddComponent <SpriteRenderer>(); _rend.sortingOrder = _rendStart.sortingOrder; _rend.sprite = _rendStart.sprite; _rend.transform.rotation = _rendStart.transform.rotation; _rend.enabled = true; } else { _rend = GetComponent <SpriteRenderer>(); } InitateAnimation(); }
protected void OnDisable() { ClearState(); MoveComponent.ClearPath(); }