コード例 #1
0
ファイル: Game.cs プロジェクト: local-minimum/suffertheking
        void SetupParticipantsNeededByMap()
        {
            var neededParticipants = Map.GetRequiredParticipants();

            SetActiveParticipants(neededParticipants.Keys.ToList());
            foreach (var kvp in neededParticipants)
            {
                if (!HasMatchingParticipant(kvp.Value, kvp.Key))
                {
                    //TODO: Here may need to add player type if multiplayer when supporting it
                    AddParticipant(kvp.Value != PlayerType.Active ? kvp.Value : PlayerType.AI, kvp.Key);
                }

                var participant = GetParticipant(kvp.Key);
                ParticipantController.SetupController(participant);
                Debug.Log(string.Format("{0} (ID {1}) setup as {2} ({3})",
                                        participant.name, participant.ID, participant.type, kvp.Value));
            }
        }
コード例 #2
0
ファイル: Game.cs プロジェクト: local-minimum/suffertheking
        void enactStep()
        {
            var participant = participants[gameState.activeParticipant];

            Debug.Log("Enacting turn: " + participant.turn);
            switch (participant.turn)
            {
            case PlayerTurn.CivilSociety:
                CivilSociety.Initiative(participant);
                break;

            case PlayerTurn.Leader:
                Leader.Initiative(participant.leaderData);
                break;

            case PlayerTurn.MilitaryConstruction:
                Military.BuildUnits(participant);
                break;

            case PlayerTurn.MilitaryOrders:
                ParticipantController.CollectOrders(participant);
                break;

            case PlayerTurn.MilitaryActions:
                StartCoroutine(OrderLog.ExecuteOrders());
                //OrderLog.ClearAllOrders();
                //Game.Step();
                break;

            default:
                Debug.LogError(string.Format("Requesting to enact {0} on {1} which is not possible",
                                             participant.turn,
                                             participant.name));
                Game.Step();
                break;
            }
        }