コード例 #1
0
        private void NodeChosen(Node node, GameInfo gameInfo, IGameState waitState)
        {
            gameInfo.Fsm.Remove(waitState);
            gameInfo.ClearTargets();
            gameInfo.PanCameraToObject(gameInfo.CurrentPlayer);
            var currentPlayer = gameInfo.CurrentPlayer;

            currentPlayer.NextNode = node;

            // Give the player a passport for the island they are going to arrive at
            var assetResponse = currentPlayer.Accept(new PassportStamp(((Travel)node.BindedLogic.PureLogic).IslandType));

            // Give the player a car modification if required

            currentPlayer.SetTransport(TransportType);

            if (assetResponse == AssetResponse.CollectedAllPassportStamps)
            {
                if (gameInfo.GameRuleType == GameRuleType.Passport)
                {
                    gameInfo.Fsm.LazyPush(StateFactory.GetState(GameStates.GameStates.EndGame));
                }
            }

            gameInfo.CreateMessage(String.Format("You have been given a {0} passport token!", IslandType));

            gameInfo.Fsm.Push(StateFactory.GetState(GameStates.GameStates.VisuallyMovePlayer));
        }
コード例 #2
0
 private void PathChosen(Node selectedNode, GameInfo gameInfo, IGameState waitState)
 {
     gameInfo.ClearTargets();
     gameInfo.PanCameraToObject(gameInfo.CurrentPlayer);
     var currentPlayer = gameInfo.CurrentPlayer;
     currentPlayer.NextNode = selectedNode;
     gameInfo.Fsm.Remove(waitState);
 }
コード例 #3
0
        private void PathChosen(Node selectedNode, GameInfo gameInfo, IGameState waitState)
        {
            gameInfo.ClearTargets();
            gameInfo.PanCameraToObject(gameInfo.CurrentPlayer);
            var currentPlayer = gameInfo.CurrentPlayer;

            currentPlayer.NextNode = selectedNode;
            gameInfo.Fsm.Remove(waitState);
        }
コード例 #4
0
 private static void CleanUp(Node node, Vector2 location, GameInfo gameInfo)
 {
     gameInfo.CreateMessage(String.Empty);
     gameInfo.ClearTargets();
     foreach (var possibleNode in _possibleNodes) {
         possibleNode.RememberColorState(ColorState.None);
         possibleNode.SetColorState(ColorState.None);
         possibleNode.ListenMouseDown -= _cleanupCallback;
         possibleNode.ListenMouseDown -= _callback;
     }
 }
コード例 #5
0
 private static void CleanUp(Node node, Vector2 location, GameInfo gameInfo)
 {
     gameInfo.CreateMessage(String.Empty);
     gameInfo.ClearTargets();
     foreach (var possibleNode in _possibleNodes)
     {
         possibleNode.RememberColorState(ColorState.None);
         possibleNode.SetColorState(ColorState.None);
         possibleNode.ListenMouseDown -= _cleanupCallback;
         possibleNode.ListenMouseDown -= _callback;
     }
 }
コード例 #6
0
 public IGameState[] PerformLogic(GameTime gameTime, GameInfo gameInfo)
 {
     var spinnedNumber = gameInfo.Spinner.SpinnedNumber;
     gameInfo.ClearTargets();
     gameInfo.CurrentPlayer.RollAmount = spinnedNumber;
     gameInfo.PanCameraToObject(gameInfo.CurrentPlayer);
     switch (spinnedNumber) {
         case 1:
             return new[] {StateFactory.GetState(GameStates.ChangeWorld)};
         case 10: return gameInfo.GameRuleType == GameRuleType.Retirement ? new[] { StateFactory.GetState(GameStates.IncreaseAge) } : null;
     }
     return null;
 }
コード例 #7
0
        public IGameState[] PerformLogic(GameTime gameTime, GameInfo gameInfo)
        {
            var spinnedNumber = gameInfo.Spinner.SpinnedNumber;

            gameInfo.ClearTargets();
            gameInfo.CurrentPlayer.RollAmount = spinnedNumber;
            gameInfo.PanCameraToObject(gameInfo.CurrentPlayer);
            switch (spinnedNumber)
            {
            case 1:
                return(new[] { StateFactory.GetState(GameStates.ChangeWorld) });

            case 10: return(gameInfo.GameRuleType == GameRuleType.Retirement ? new[] { StateFactory.GetState(GameStates.IncreaseAge) } : null);
            }
            return(null);
        }
コード例 #8
0
        private void PlayerClicked(Player clickedPlayer, Vector2 location, GameInfo gameInfo, IGameState waitState)
        {
            //Cash will be entered negative, so "minus-minus" for you,
            //"plus-minus for the player you sued"
            clickedPlayer.Cash          += CashValue;
            gameInfo.CurrentPlayer.Cash -= CashValue;

            foreach (var player in gameInfo.PlayerList)
            {
                player.ListenMouseDown -= _clickPlayer;
                player.ListenMouseOver -= PlayerMouseIn;
                player.ListenMouseOut  -= PlayerMouseOut;
                player.ResetColorState();
            }
            gameInfo.ClearTargets();

            //Alert will be appear to confirm you sued them
            var alert = new Alert(gameInfo.Manager, String.Format("You successfully sue {0}!", clickedPlayer.Name), String.Format("Sue {0}!", clickedPlayer.Name), icon: "Images/AlertIcons/Loan");

            gameInfo.Manager.Add(alert);
            alert.Closed += (sender, args) => gameInfo.Fsm.Remove(waitState);
        }
コード例 #9
0
        private void PlayerClicked(Player clickedPlayer, Vector2 location, GameInfo gameInfo, IGameState waitState)
        {
            //Cash will be entered negative, so "minus-minus" for you,
            //"plus-minus for the player you sued"
            clickedPlayer.Cash += CashValue;
            gameInfo.CurrentPlayer.Cash -= CashValue;

            foreach (var player in gameInfo.PlayerList) {
                player.ListenMouseDown -= _clickPlayer;
                player.ListenMouseOver -= PlayerMouseIn;
                player.ListenMouseOut -= PlayerMouseOut;
                player.ResetColorState();
            }
            gameInfo.ClearTargets();

            //Alert will be appear to confirm you sued them
            var alert = new Alert(gameInfo.Manager, String.Format("You successfully sue {0}!", clickedPlayer.Name), String.Format("Sue {0}!", clickedPlayer.Name), icon : "Images/AlertIcons/Loan");
            gameInfo.Manager.Add(alert);
            alert.Closed += (sender, args) => gameInfo.Fsm.Remove(waitState);
        }
コード例 #10
0
ファイル: Travel.cs プロジェクト: AlanFoster/Game-of-Life
        private void NodeChosen(Node node, GameInfo gameInfo, IGameState waitState)
        {
            gameInfo.Fsm.Remove(waitState);
            gameInfo.ClearTargets();
            gameInfo.PanCameraToObject(gameInfo.CurrentPlayer);
            var currentPlayer = gameInfo.CurrentPlayer;
            currentPlayer.NextNode = node;

            // Give the player a passport for the island they are going to arrive at
            var assetResponse = currentPlayer.Accept(new PassportStamp(((Travel)node.BindedLogic.PureLogic).IslandType));
            // Give the player a car modification if required

            currentPlayer.SetTransport(TransportType);

            if (assetResponse == AssetResponse.CollectedAllPassportStamps) {
                if(gameInfo.GameRuleType == GameRuleType.Passport) {
                    gameInfo.Fsm.LazyPush(StateFactory.GetState(GameStates.GameStates.EndGame));
                }
            }

            gameInfo.CreateMessage(String.Format("You have been given a {0} passport token!", IslandType));

            gameInfo.Fsm.Push(StateFactory.GetState(GameStates.GameStates.VisuallyMovePlayer));
        }