示例#1
0
        public bool ForwardAction(TimeMachine timeMachine, GameState state)
        {
            if (isTie)
            {
                // TODO: Handle tie.
                return(false);
            }

            if (loser is Sub)
            {
                // Cleanup the sub.
                if (loser.GetSpecialistManager().GetSpecialistCount() > 0)
                {
                    loser.GetSpecialistManager().captureAll();
                    ((Sub)loser).IsCaptured = true;
                }
                else
                {
                    // Remove the sub
                    state.RemoveSub((Sub)loser);
                }
            }

            if (loser is Outpost)
            {
                // Transfer Ownership and give drillers.
                loser.SetOwner(winner.GetOwner());

                // Remove the winning sub and make it arrive at the outpost.
                loser.SetDrillerCount(0);
                loser.AddDrillers(winner.GetDrillerCount());

                // Transfer any specialists to the outpost.
                loser.GetSpecialistManager().captureAll();
                winner.GetSpecialistManager().transferSpecialistsTo(loser.GetSpecialistManager());

                // Remove the incoming sub.
                state.RemoveSub((Sub)winner);
            }

            this.isSuccess = true;
            return(isSuccess);
        }