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));
                }
            }
        }
 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));
     }
 }
Example #3
0
 public void SwitchToHudMode()
 {
     if (_previousState != null)
     {
         NextState = new StateTransition(() => _previousState);
     }
     else
     {
         NextState = new StateTransition(() => new ActionSelection(GameState, GameState.ActiveUnit));
     }
 }
        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;
        }
Example #5
0
 private void NewGameClicked(Control sender, MouseEventArgs args)
 {
     NextState = new StateTransition(() => new GameState(_game, _squidInputManager));
 }
Example #6
0
 public virtual void OnEnter()
 {
     NextState = null;
 }
 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");
     }
 }
Example #8
0
 public void ReturnToMainMenu()
 {
     NextState = new StateTransition(() => DoomTacticsGame.CreateMenuState(GameInstance));
 }
 public void SwitchToWaitDirection()
 {
     NextState = new StateTransition(() => new SelectWaitDirection(GameState));
 }
 public void SwitchToTargetSelection(ActionInformation actionInformation)
 {
     NextState = new StateTransition(() => new AbilitySelection(GameState, this, actionInformation));
 }
 public void SwitchToFreeCamera()
 {
     NextState = new StateTransition(() => new FreeCamera(GameState, this));
 }
 public void PerformAction()
 {
     if (_targetedTile != null && _actionInformation.AbilityRange.IsTileValid(_targetedTile))
     {
         Func<IState> animationState = () =>
             new ActionAnimationPlaying(GameState, _actionInformation, _targetedTile);
         NextState = new StateTransition(animationState);
     }
 }
 public void ReturnToPrevious()
 {
     NextState = new StateTransition(() => _previousState);
 }
Example #14
0
 private void AIDecisionComplete(ActionInformation actionInformation, Tile targetTile)
 {
     Func<IState> state = () =>
         new ActionAnimationPlaying(GameState, actionInformation, targetTile);
     NextState = new StateTransition(state);
 }
Example #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;
     }
 }