Esempio n. 1
0
    // Update the state machine
    public void Update()
    {
        if (wall == null)
        {
            return;
        }

        //Debug.Log(CurrentState);

        switch (CurrentState)
        {
        case ObjectState.Idle:
            break;

        case ObjectState.Moving:
            if (wall.Grid.MoveToCell(RectTransform, destinationPosition))
            {
                CurrentState = ObjectState.Idle;
            }
            break;

        case ObjectState.Pressed:
        case ObjectState.Transformed:
            break;

        case ObjectState.Launched:
        case ObjectState.Released:
            if (Time.time - idleTime > wall.MaxIdleTime)
            {
                CurrentState = ObjectState.Idle;
                SetLayer(1);
                wall.UpdateLayers();
            }
            break;
        }

        ControlPosition();
        ControlRotation();
        ControlScale();
        ControlColor();
    }