Exemplo n.º 1
0
    void GoEnd()
    {
        Debug.Log("Attempting to go to end");

        if (cartController.IsLocked())
        {
            Debug.Log("Cart is locked!");
            return;
        }

        var oldState = cartState;

        cartState = (CartMachineState)CartMachineFromLeftToEnd((int)cartState);
        cartState = (CartMachineState)CartMachineFromRightToEnd((int)cartState);

        if (cartState == oldState)
        {
            Debug.Log("Can't move to end from here");
        }
        else
        {
            cartController.Poke(pointEnd.transform.position);
        }
    }
Exemplo n.º 2
0
    void GoRight()
    {
        Debug.Log("Attempting to go to right");

        if (cartController.IsLocked())
        {
            Debug.Log("Cart is locked!");
            return;
        }

        var oldState = cartState;

        cartState = (CartMachineState)CartMachineFromStartToRight((int)cartState, (int)switchState);
        cartState = (CartMachineState)CartMachineFromEndToRight((int)cartState);

        if (cartState == oldState)
        {
            Debug.Log("Can't move to right from here");
        }
        else
        {
            cartController.Poke(pointRight.transform.position);
        }
    }