Esempio n. 1
0
 void stopAction()
 {
     transform.localPosition = moveTo;
     moving = false;
     if (shakeCamera)
     {
         CameraFollow2D.stopShake();
     }
     if (switchCameraTo != null)
     {
         CameraFollow2D.changeTarget();
     }
 }
Esempio n. 2
0
    IEnumerator mover()
    {
        yield return(new WaitForSeconds(pauseBetweenActions));

        while (Vector3.SqrMagnitude(moveTo - transform.localPosition) > 0.01f)
        {
            yield return(null);

            transform.localPosition = Vector3.MoveTowards(transform.localPosition, moveTo, Time.deltaTime * moveSpeed);
            if (shakeCamera)
            {
                CameraFollow2D.shakeIt();
            }
        }
        if (shakeCamera)
        {
            CameraFollow2D.stopShake();
        }
        yield return(new WaitForSeconds(pauseBetweenActions));

        stopAction();
    }