コード例 #1
0
        public void ScriptCompletion(IDoomEvent doomEvent, string scriptName)
        {
            AnimationScriptEvent ase = (AnimationScriptEvent) doomEvent;
            if (ase.ScriptName == scriptName)
            {
                if (_actionInformation.ActionType == ActionType.Attack)
                    GameState.ActiveUnit.SetActioned();
                if (_actionInformation.ActionType == ActionType.Move)
                    GameState.ActiveUnit.SetMoved();

                if (_actionInformation.ActionType == ActionType.Wait)
                {
                    GameState.ActiveUnit.EndTurn();
                    GameState.ActiveUnit = GameState.GetNextActiveUnit();
                    NextState = GameState.ActiveUnit == null
                                    ? new StateTransition(() => new FreeCamera(GameState, null))
                                    : new StateTransition(() => new ActionSelection(GameState, GameState.ActiveUnit));
                }
                else if(!GameState.ActiveUnit.CanAction() && !GameState.ActiveUnit.CanMove() && !GameState.IsAIControlled(GameState.ActiveUnit))
                {
                    NextState = new StateTransition(() => new SelectWaitDirection(GameState));
                }
                else
                {
                    NextState = new StateTransition(() => new ActionSelection(GameState, GameState.ActiveUnit));
                }
            }
        }
コード例 #2
0
 public void FinalizeWaitDirection(Vector2 mousePosition)
 {
     Vector3? targetPoint = GetTargetPoint(mousePosition);
     if (targetPoint.HasValue)
     {
         ActionInformation ai = GameState.ActiveUnit.Wait(targetPoint.Value);
         NextState = new StateTransition(() => new ActionAnimationPlaying(GameState, ai, null));
     }
 }
コード例 #3
0
ファイル: FreeCamera.cs プロジェクト: doomtactics/doomtactics
 public void SwitchToHudMode()
 {
     if (_previousState != null)
     {
         NextState = new StateTransition(() => _previousState);
     }
     else
     {
         NextState = new StateTransition(() => new ActionSelection(GameState, GameState.ActiveUnit));
     }
 }
コード例 #4
0
        public override void OnEnter()
        {
            base.OnEnter();

            if (GameState.IsAIControlled(_actionActor))
            {
                NextState = new StateTransition(() => new AIDecision(GameState, _actionActor));
                return;
            }

            GameState.Desktop.Visible = true;
            GameState.Desktop.ShowCursor = true;

            if (_actionSubMenu == null)
            {
                var menuBuilder = new ActionMenuBuilder().AsSubMenu();
                foreach (var ability in _actionActor.AbilityList)
                {
                    var selectedAbility = ability;
                    menuBuilder.Action(ability.AbilityDetails.AbilityName, (ctl, e) => SwitchToTargetSelection(selectedAbility.AbilityMethod(GameState.Level, ability.AbilityDetails)));
                }
                menuBuilder.Size(200, 200);
                _actionSubMenu = menuBuilder.Build();
            }
            if (_actionMenu == null)
            {
                var actionMenuBuilder = new ActionMenuBuilder()
                    .ActorName(_actionActor.ActorId);

                if (_actionActor.CanAction())
                {
                    actionMenuBuilder
                        .Action("Action", (ctl, e) => _actionMenu.ShowSubMenu(_actionSubMenu));
                }
                if (_actionActor.CanMove())
                {
                    actionMenuBuilder
                        .Action("Move", (ctl, e) => SwitchToTargetSelection(_actionActor.MoveToTile(GameState.Level)));
                }

                actionMenuBuilder
                    .Action("Wait", (ctl, e) => SwitchToWaitDirection())
                    .Position(50, 100)
                    .Size(200, 200)
                    .Parent(GameState.Desktop);

                _actionMenu = actionMenuBuilder.Build();
            }
            _actionMenu.Visible = true;
            _actionSubMenu.Visible = true;
        }
コード例 #5
0
ファイル: MenuState.cs プロジェクト: doomtactics/doomtactics
 private void NewGameClicked(Control sender, MouseEventArgs args)
 {
     NextState = new StateTransition(() => new GameState(_game, _squidInputManager));
 }
コード例 #6
0
 public virtual void OnEnter()
 {
     NextState = null;
 }
コード例 #7
0
 public override void Update(GameTime gameTime)
 {
     base.Update(gameTime);
     if (_stopwatch.Elapsed > (AnnouncerSoundOneDuration + AnnouncerSoundTwoDuration) || GameState.GameInstance.SkipLevelIntros)
     {
         _stopwatch.Stop();
         NextState = new StateTransition(() => new FreeCamera(GameState, null));
     }
     else if (_stopwatch.Elapsed > AnnouncerSoundOneDuration && !_playedSecondSound)
     {
         _playedSecondSound = true;
         _drawOne = false;
         _drawTwo = true;
         var evt = new SoundEvent(DoomEventType.PlaySound, AnnouncerSoundTwo);
         MessagingSystem.DispatchEvent(evt, "MatchIntro");
     }
 }
コード例 #8
0
ファイル: GameState.cs プロジェクト: doomtactics/doomtactics
 public void ReturnToMainMenu()
 {
     NextState = new StateTransition(() => DoomTacticsGame.CreateMenuState(GameInstance));
 }
コード例 #9
0
 public void SwitchToWaitDirection()
 {
     NextState = new StateTransition(() => new SelectWaitDirection(GameState));
 }
コード例 #10
0
 public void SwitchToTargetSelection(ActionInformation actionInformation)
 {
     NextState = new StateTransition(() => new AbilitySelection(GameState, this, actionInformation));
 }
コード例 #11
0
 public void SwitchToFreeCamera()
 {
     NextState = new StateTransition(() => new FreeCamera(GameState, this));
 }
コード例 #12
0
 public void PerformAction()
 {
     if (_targetedTile != null && _actionInformation.AbilityRange.IsTileValid(_targetedTile))
     {
         Func<IState> animationState = () =>
             new ActionAnimationPlaying(GameState, _actionInformation, _targetedTile);
         NextState = new StateTransition(animationState);
     }
 }
コード例 #13
0
 public void ReturnToPrevious()
 {
     NextState = new StateTransition(() => _previousState);
 }
コード例 #14
0
ファイル: AIDecision.cs プロジェクト: doomtactics/doomtactics
 private void AIDecisionComplete(ActionInformation actionInformation, Tile targetTile)
 {
     Func<IState> state = () =>
         new ActionAnimationPlaying(GameState, actionInformation, targetTile);
     NextState = new StateTransition(state);
 }
コード例 #15
0
 public override void Update(GameTime gameTime)
 {
     base.Update(gameTime);
     if (_stopwatch.Elapsed > AnnouncerSoundOneDuration + AnnouncerSoundTwoDuration)
     {
         _stopwatch.Stop();
         NextState = new StateTransition(() => new FreeCamera(GameState, null));
     }
     else if (!_playedSoundTwo && _stopwatch.Elapsed > AnnouncerSoundOneDuration)
     {
         _playedSoundTwo = true;
         if (_playerWon)
             MessagingSystem.DispatchEvent(new SoundEvent(DoomEventType.PlaySound, AnnouncerWin), "EndGameState");
         else
             MessagingSystem.DispatchEvent(new SoundEvent(DoomEventType.PlaySound, AnnouncerLose), "EndGameState");
     }
     else if (!_playedSoundOne)
     {
         MessagingSystem.DispatchEvent(new SoundEvent(DoomEventType.PlaySound, AnnouncerYou), "EndGameState");
         _playedSoundOne = true;
     }
 }