Esempio n. 1
0
 IEnumerator Hold()
 {
     while (mutableObject.ChangeState(true))
     {
         wheelRotation.z    += Time.deltaTime * wheelSpeed;
         wheel.localRotation = Quaternion.Euler(wheelRotation);
         yield return(null);
     }
 }
Esempio n. 2
0
    void SetState(State s)
    {
        state = s;
        Vector3 rot = lever.localRotation.eulerAngles;

        if (s == State.Up)
        {
            rot.z = upRotation;
            mutableObject.ChangeState(true);
        }
        else     // Down
        {
            rot.z = -upRotation;
            if (base.hasPower)
            {
                mutableObject.ChangeState(false);
            }
        }
        lever.localRotation = Quaternion.Euler(rot);
    }
Esempio n. 3
0
    void SetState(State s)
    {
        state = s;
        Vector3 pos = switchLever.localPosition;

        if (s == State.On)
        {
            pos.z = onPositionZ;
            mutableObject.ChangeState(true);
            green.EnableKeyword("_EMISSION");
            red.DisableKeyword("_EMISSION");
        }
        else     // Off
        {
            pos.z = -onPositionZ;
            mutableObject.ChangeState(false);
            red.EnableKeyword("_EMISSION");
            green.DisableKeyword("_EMISSION");
        }
        switchLever.localPosition = pos;
    }