void Move() { if (!Map.IsWalkable(m_TargetLocation)) { m_IsMoving = false; InterpreterLock.Set(); return; } Vector3 target = Map.PositionForLocation(m_TargetLocation); if (Vector3.Distance(transform.position, target) < 0.05f) { transform.position = target; m_IsMoving = false; m_LastLocation = m_CurrentLocation; m_CurrentLocation = m_TargetLocation; m_TogglePressables = true; InterpreterLock.Set(); } else { var step = Time.deltaTime * m_MovementSpeed; transform.position = Vector3.MoveTowards(transform.position, target, step); } }
void Rotate() { Quaternion target = m_TargetDirection.GetRotation(); var step = Time.deltaTime * m_RotationSpeed; if (Quaternion.Angle(transform.rotation, target) < step) { transform.rotation = target; m_IsRotating = false; m_CurrentDirection = m_TargetDirection; InterpreterLock.Set(); } else { transform.rotation = Quaternion.RotateTowards(transform.rotation, target, step); } }