private void ProcessNextTurn(Player.ActionType action) { RoadSegment road = UnprossedRoads.Dequeue(); EnteredNewRoad(); while (road.RoadType == Player.ActionType.Straight) { Waypoints.Enqueue(road.GetRandomMidpoint()); Waypoints.Enqueue(road.GetRandomEndpoint()); road = UnprossedRoads.Dequeue(); EnteredNewRoad(); } // Process the actual turn road.enteredType = action; if (action == road.RoadType) { Waypoints.Enqueue(road.GetRandomMidpoint()); Waypoints.Enqueue(road.GetRandomEndpoint()); road.wasCorrect = true; } // Incorrect input, get degree of failure else { road.wasCorrect = false; int diff = action - road.RoadType; // MISS RIGHT if (diff > 0) { Debug.Log("MISS RIGHT"); Waypoints.Enqueue(road.MidMissRight); Waypoints.Enqueue(road.MissRight); } // MISS LEFT else if (diff < 0) { Debug.Log("MISS LEFT"); Waypoints.Enqueue(road.MidMissLeft); Waypoints.Enqueue(road.MissLeft); } } EnteredNewRoad(); HighlightNextRoad(); }
public void AddTurnImageToList(Player.ActionType actionType) { if (turnImageQueue.Count == 5) { Destroy(turnImageQueue.Dequeue().gameObject); } TurnImage newTurn = Instantiate(turnImage, playerTurnInputList); newTurn.transform.SetAsFirstSibling(); switch (actionType) { case Player.ActionType.Straight: newTurn.image.sprite = straight; break; case Player.ActionType.RightTurn: newTurn.image.sprite = rightTurn; break; case Player.ActionType.RightSquare: newTurn.image.sprite = rightSquare; break; case Player.ActionType.RightAcute: newTurn.image.sprite = rightAcute; break; case Player.ActionType.LeftTurn: newTurn.image.sprite = leftTurn; break; case Player.ActionType.LeftSquare: newTurn.image.sprite = leftSquare; break; case Player.ActionType.LeftAcute: newTurn.image.sprite = leftAcute; break; } turnImageQueue.Enqueue(newTurn); }
public PlayerAction(Player.ActionType actionType, params int[] values) { this.actionType = actionType; this.values = values; }
public void OnPlayerInput(Player.ActionType action) { ProcessNextTurn(action); BuildAllPaths(); }