private void PerformAutoAttack(Vector3 lookDirection) { m_ActionState.ActionState = m_AutoAttackAction; m_RotationController.LookAt(lookDirection, AADURATION); var setIdleCondition = new TimedContinueCondition(AADURATION); setIdleCondition.ContinueEvent += (CallReason cr) => m_ActionState.ActionState = ActionCode.Idle; setIdleCondition.ContinueEvent += FinishedAutoAttack; setIdleCondition.Start(); }
private void OnActionStateUpdateEvent(string name, ActionCode newState, Vector3?lookDir) { if (gameObject.name != name) { return; } ActionState = newState; if (lookDir == null) { return; } float lockDuration = GetCastDuration(newState); m_RotationController.LookAt(lookDir.Value, lockDuration); }
/// <summary> /// Changes the position depending on the input. /// </summary> private void UpdatePosition() { var inputVector = new Vector3(CrossPlatformInputManager.GetAxisRaw("Horizontal"), 0, CrossPlatformInputManager.GetAxisRaw("Vertical")); //Move to eval start if (Input.GetButtonDown(ToggleAiKey)) { transform.position = new Vector3(3.5F, 0, 3.5F); } if (inputVector == Vector3.zero) { m_MovementState.MovementState = MovementState.Idle; return; } inputVector = inputVector.normalized; transform.position += inputVector * m_MovementSpeed.MovementSpeed * Time.deltaTime; m_RotationController.LookAt(inputVector); m_MovementState.MovementState = MovementState.Moving; }
private void UpdateRotation(Vector3 newPosition) { m_RotationController.LookAt(newPosition - transform.position); }