public IEnumerator TurnToTargetPositiom(Transform _target, EventHandler callback) { //cache the callback so we can call it before stopping coroutine if (callback != null) { handlers.Add(callback); } // MDebug.Log("Turn to"); yield return(new WaitForRotation(m_rotated.transform, M_Math.RotateToYSnapped(m_rotated.transform.position, _target.transform.position, 45), 0.35f)); // MDebug.Log("Rotated"); if (callback != null) { callback(); handlers.Remove(callback); } yield return(null); }
IEnumerator TurnToFinalPosition(Vector3 target) { // MDebug.Log("Turn to"); yield return(new WaitForRotation(m_rotated.transform, M_Math.RotateToYSnapped(m_rotated.transform.position, (target), 45), 0.35f)); // MDebug.Log("Rotated"); }
IEnumerator Rotate() { yield return(new WaitForRotation(transform, M_Math.RotateToYSnapped(transform.position, target.transform.position, snap), speed)); }