Beispiel #1
0
    void OnPress(bool isPressed)
    {
        if (NumberOfTruckOnTop > 0)
        {
            return;
        }
        if (numberOfComingTrucks > 0)
        {
            return;
        }
        if (freeze)
        {
            return;
        }
        if (!isPressed)
        {
            return;
        }
        if (!isClickable)
        {
            return;
        }

        switch (TypeOfRotation)
        {
        case RoadRotationType.Green:
            myAnimator.SetBool("Next", true);
            StartingGreenRotation = StartingGreenRotation.Next();
            _direction            = StartingGreenRotation.toRoadDirection();
            break;

        case RoadRotationType.Blue:
            myAnimator.SetBool("Next", true);
            StartingGreenRotation = StartingGreenRotation.Next();
            StartingBlueRotation  = StartingGreenRotation.GreenToBlue();
            _direction            = StartingBlueRotation.toRoadDirection();
            break;

        case RoadRotationType.Purple:
            roadStartingPurple = roadStartingPurple.NextPurpleCardinalPoint(roadAnchorPurple, ref purpleDirection);
            direction          = RoadDirectionExtensions.ComposeRoadDirection(roadAnchorPurple, roadStartingPurple);
            TurnOffAllSprites();
            if (direction == RoadDirection.EW || direction == RoadDirection.NS)
            {
                RecalculateSprites(RoadDirectionExtensions.ComposeRoadDirection(roadAnchorPurple, roadStartingPurple.NextPurpleCardinalPoint(roadAnchorPurple, ref purpleDirection)));
            }
            break;

        case RoadRotationType.Gold:
            direction = possibleGoldRotations[0];
            possibleGoldRotations.RemoveAt(0);
            possibleGoldRotations.Add(direction);
            RecalculateSprites();
            break;

        default:
            break;
        }
    }
Beispiel #2
0
    public static RoadRotationBlue Next(this RoadRotationBlue blueRoadDirection)
    {
        switch (blueRoadDirection)
        {
        case RoadRotationBlue.EW:
            return(RoadRotationBlue.NS);

        case RoadRotationBlue.NS:
            return(RoadRotationBlue.EW);

        default:
            return(RoadRotationBlue.EW);
        }
    }
Beispiel #3
0
    public static RoadRotationGreen BlueToGreen(this RoadRotationBlue blueRoadDirection)
    {
        switch (blueRoadDirection)
        {
        case RoadRotationBlue.EW:
            return(RoadRotationGreen.SE);

        case RoadRotationBlue.NS:
            return(RoadRotationGreen.NW);

        default:
            return(RoadRotationGreen.NE);
        }
    }
Beispiel #4
0
    public static string blueDirtoString(RoadRotationBlue road)
    {
        string s;

        switch (road)
        {
        case RoadRotationBlue.EW:
            s = EW;
            break;

        case RoadRotationBlue.NS:
            s = NS;
            break;

        default:
            s = EW;
            break;
        }
        return(s);
    }