Ejemplo n.º 1
0
    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);
    }
Ejemplo n.º 2
0
 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");
 }
Ejemplo n.º 3
0
 IEnumerator Rotate()
 {
     yield return(new WaitForRotation(transform, M_Math.RotateToYSnapped(transform.position, target.transform.position, snap), speed));
 }