示例#1
0
    protected IEnumerator MoveToPosition(Vector3 toPosition, float inTime, bool destroy)
    {
        var fromPosition = transform.localPosition;

        for (var t = 0f; t < 1; t += Time.deltaTime / inTime)
        {
            transform.localPosition = Vector3.Lerp(fromPosition, toPosition, t);
            yield return(null);
        }

        elevator.Unlock();

        timeAlive = 0.0f;
        if (destroy)
        {
            Destroy(this.gameObject);
        }
    }
示例#2
0
    IEnumerator UnlockAfterTime(float seconds)
    {
        yield return(new WaitForSeconds(seconds));

        elevator.Unlock();
    }