示例#1
0
    private IEnumerator MoveTo(Vector3 target)
    {
        if (eventSwitch != null)
        {
            eventSwitch.Lock();
        }
        Vector3 direction  = (target - transform.position).normalized;
        float   localSpeed = moveSpeed / 25;

        while (Vector3.Distance(transform.position, target) > localSpeed)
        {
            yield return(new WaitForFixedUpdate());

            transform.position += direction * localSpeed;
        }

        transform.position = target;
        locked             = false;
        if (eventSwitch != null)
        {
            eventSwitch.Unlock();
        }

        yield return(Hold());
    }
示例#2
0
    private IEnumerator LockAndUnlockLoop(EventSwitch eventSwitch)
    {
        eventSwitch.Lock();
        yield return(new WaitForFixedUpdate());

        yield return(new WaitForFixedUpdate());

        yield return(new WaitForFixedUpdate());

        eventSwitch.Unlock();
    }