コード例 #1
0
        public override void Update(PlayTime playTime)
        {
            base.Update(playTime);

            if (askQuestion && GameStateManager.currentState.Equals("StationState") &&
                game.stateManager.stationState.Station.name.ToLower().Equals(locationName.ToLower()))
            {
                askQuestion = false;

                PopupHandler.DisplaySelectionMenu(question.Text, new List <String>()
                {
                    "Yes", "No"
                },
                                                  new List <System.Action>()
                {
                    delegate
                    {
                        progressObjective = true;
                        mission.MissionHelper.ShowEvent(yesEvent);
                        game.stateManager.stationState.OnEnter();
                    },
                    delegate
                    {
                        mission.MissionHelper.ShowEvent(noEvent);
                        game.stateManager.stationState.OnEnter();
                    }
                });
            }

            else if (GameStateManager.currentState.Equals("OverworldState"))
            {
                askQuestion = true;
            }
        }
コード例 #2
0
        public void Initialize()
        {
            //plating = ShipInventoryManager.equippedPlating;

            // Money
            Crebits = 100;

            // Fuel
            MaxFuel = 750;
            Fuel    = 750;

            progress   = 0;
            reputation = 0;

            PlayTime = new PlayTime();

            MaxFusionCells = 3;
            FusionCells    = new int[MaxFusionCells];
            for (int i = 0; i < MaxFusionCells; i++)
            {
                FusionCells[i] = 1;
            }

            discoveredBeacons = new List <Beacon>();
        }
コード例 #3
0
        public override void Update(PlayTime playTime)
        {
            base.Update(playTime);

            if (updateAction != null)
            {
                updateAction.Invoke();
            }
        }
コード例 #4
0
        public override void Update(PlayTime playTime)
        {
            base.Update(playTime);

            if (!levelStarted)
            {
                mission.MissionHelper.StartLevelAfterCondition(level, levelStartCondition);
                levelStarted = true;
            }
        }
コード例 #5
0
        public override void Update(PlayTime playTime)
        {
            base.Update(playTime);

            if (GameStateManager.currentState == "OverworldState" &&
                !startMessageDisplayed)
            {
                startMessageDisplayed = true;
                PopupHandler.DisplayMessage(startMessage);
            }

            if (!deviationAllowed &&
                !CollisionDetection.IsPointInsideCircle(game.player.position, shipsToFollow[0].position, deviationRadius) &&
                outOfRangeTimer <= 0)
            {
                outOfRangeTimer = 150;
                PopupHandler.DisplayMessage(deviationMessage);

                foreach (OverworldShip ship in shipsToFollow)
                {
                    ship.Wait();
                }
            }

            if (!deviationAllowed &&
                outOfRangeTimer > 0)
            {
                outOfRangeTimer--;

                if (outOfRangeTimer == 149)
                {
                    game.player.InitializeHyperSpeedJump(shipsToFollow[0].position, false);
                }

                if (outOfRangeTimer < 1)
                {
                    outOfRangeTimer = -100;

                    foreach (OverworldShip ship in shipsToFollow)
                    {
                        ship.Start();
                    }
                }
            }
        }
コード例 #6
0
        public override void Update(PlayTime playTime)
        {
            if (messageTime != -1 &&
                StatsManager.PlayTime.HasOverworldTimePassed(messageTime))
            {
                messageTime = -1;

                if (portraits != null &&
                    portraits.Count > 0)
                {
                    PopupHandler.DisplayRealtimePortraitMessage(messageDelay, portraits.ToArray(),
                                                                portraitTriggers, messages.ToArray());
                }
                else
                {
                    PopupHandler.DisplayRealtimeMessage(messageDelay, messages.ToArray());
                }
            }
            base.Update(playTime);
        }
コード例 #7
0
        public virtual void Update(PlayTime playTime)
        {
            if (isOnCompletedCalled)
            {
                if (mission.MissionHelper.IsTextCleared())
                {
                    if (!mission.MissionHelper.AllObjectivesCompleted())
                    {
                        mission.ObjectiveIndex++;
                    }
                }
            }

            else if (Failed())
            {
                OnFailed();
            }

            else if (Completed())
            {
                OnCompleted();
            }
        }
コード例 #8
0
        public override void Update(PlayTime playTime)
        {
            base.Update(playTime);

            if (mission.MissionResponse != 0)
            {
                if (mission.MissionResponse <= actions.Count)
                {
                    actions[mission.MissionResponse - 1].Invoke();
                }
            }

            if (delayResponse && mission.MissionHelper.IsTextCleared())
            {
                List <String>        responses = new List <String>();
                List <System.Action> a         = new List <System.Action>();

                foreach (EventText e in responseEvents.Value)
                {
                    responses.Add(e.Text);
                }

                for (int i = 0; i < actions.Keys.Count; i++)
                {
                    System.Action tempAction;

                    actions.TryGetValue(i, out tempAction);
                    a.Add(tempAction);
                }


                PopupHandler.DisplaySelectionMenu(responseEventText.Text, responses, a);

                delayResponse = false;
            }
        }
コード例 #9
0
 public override void Update(PlayTime playTime)
 {
     base.Update(playTime);
 }
コード例 #10
0
        public override void Update(PlayTime playTime)
        {
            base.Update(playTime);

            if (autofollow && started)
            {
                if (!escortDataCapsule.ShipToDefend.HasArrived)
                {
                    game.player.Direction.SetDirection(new Vector2(
                                                           escortDataCapsule.ShipToDefend.destination.X - game.player.position.X,
                                                           escortDataCapsule.ShipToDefend.destination.Y - game.player.position.Y));
                }

                game.player.speed = escortDataCapsule.ShipToDefend.speed;

                if (ControlManager.CheckPress(RebindableKeys.Pause) &&
                    GameStateManager.currentState.Equals("OverworldState"))
                {
                    PopupHandler.DisplaySelectionMenu("Do you want to skip travel?",
                                                      new List <string>()
                    {
                        "Yes", "No"
                    },
                                                      new List <System.Action>()
                    {
                        delegate
                        {
                            SkipForward();
                        },
                        delegate {}
                    });
                }
            }

            if (timedMessageCount >= 0 &&
                timedMessageCount < timedMessages.Count &&
                StatsManager.PlayTime.HasOverworldTimePassed(timedMessageTimes[timedMessageCount]))
            {
                if (timedMessagePortraits[timedMessageCount] != PortraitID.None)
                {
                    PopupHandler.DisplayRealtimePortraitMessage(3000, new [] { timedMessagePortraits[timedMessageCount] },
                                                                new List <int>(), timedMessages[timedMessageCount]);
                }
                else
                {
                    PopupHandler.DisplayRealtimeMessage(3000, timedMessages[timedMessageCount]);
                }
                timedMessageCount++;
            }

            // Player talks to freighter to begin escort
            if (!started &&
                GameStateManager.currentState.Equals("OverworldState") &&
                CollisionDetection.IsRectInRect(game.player.Bounds, escortDataCapsule.ShipToDefend.Bounds) &&
                ((ControlManager.CheckPress(RebindableKeys.Action1) || ControlManager.CheckKeyPress(Keys.Enter))))
            {
                if (showInventoryTutorial &&
                    ShipInventoryManager.equippedShield is EmptyShield)
                {
                    PopupHandler.DisplayPortraitMessage(introductionPortrait, "[Alliance Pilot] \"You need to equip a shield before we leave. Go to the shop next to Highfence and I will tell you what to do.");
                    game.tutorialManager.EnableEquipTutorial();
                }

                else
                {
                    if (introductionPortrait != PortraitID.None)
                    {
                        PopupHandler.DisplayPortraitMessage(introductionPortrait, introductionText);
                    }
                    else
                    {
                        PopupHandler.DisplayMessage(introductionText);
                    }

                    ((FreighterShip)escortDataCapsule.ShipToDefend).Start();
                    escortDataCapsule.ShipToDefend.speed = escortDataCapsule.FreighterSpeed;

                    started = true;

                    if (autofollow)
                    {
                        game.player.DisableControls();
                    }

                    this.Description = descriptions[0];

                    enemyAttackStartTime = StatsManager.PlayTime.GetFutureOverworldTime(escortDataCapsule.EnemyAttackStartTime);

                    for (int i = 0; i < timedMessages.Count; i++)
                    {
                        timedMessageTimes.Add(StatsManager.PlayTime.GetFutureOverworldTime(escortDataCapsule.TimedMessageTriggers[i]));
                    }
                    timedMessageCount = 0;
                }
            }

            // Escort mission begins
            if (started &&
                GameStateManager.currentState.Equals("OverworldState") &&
                numberOfEnemyShips > 0 &&
                StatsManager.PlayTime.HasOverworldTimePassed(enemyAttackStartTime))
            {
                // Ready to spawn a new enemy ship
                if (StatsManager.PlayTime.HasOverworldTimePassed(enemyNextWaveTime))
                {
                    int i = startingNumberOfEnemyShips - numberOfEnemyShips;

                    if (descriptions.Count > 0)
                    {
                        if (descriptions.Count > 1)
                        {
                            descriptions.RemoveAt(0);
                        }

                        this.Description = descriptions[0];
                    }

                    if (attackStartPortraits[i] != PortraitID.None)
                    {
                        PopupHandler.DisplayPortraitMessage(attackStartPortraits[i], attackStartText[i]);
                    }
                    else
                    {
                        PopupHandler.DisplayMessage(attackStartText[i]);
                    }

                    game.stateManager.overworldState.GetSectorX.shipSpawner.AddOverworldShip(
                        enemies[0],
                        escortDataCapsule.ShipToDefend.position +
                        (650 * escortDataCapsule.ShipToDefend.Direction.GetDirectionAsVector()),
                        levels[levelIndex], escortDataCapsule.ShipToDefend);

                    numberOfEnemyShips--;

                    if (numberOfEnemyShips > 0)
                    {
                        enemyNextWaveTime = StatsManager.PlayTime.GetFutureOverworldTime(escortDataCapsule.EnemyAttackFrequency);
                    }
                }
            }

            // Transfers freigter hp between levels
            for (int i = 0; i < levels.Count; i++)
            {
                if (GameStateManager.currentState.Equals("ShooterState") &&
                    game.stateManager.shooterState.CurrentLevel.Identifier.Equals(levels[i]) &&
                    game.stateManager.shooterState.GetLevel(levels[i]).IsObjectiveCompleted)
                {
                    shipToDefendHP = game.stateManager.shooterState.CurrentLevel.GetFreighterHP();

                    levelCompleted      = true;
                    levelCompletedIndex = i;
                    levelIndex          = i + 1;
                }
            }

            if (GameStateManager.currentState.Equals("OverworldState"))
            {
                if (levelCompleted &&
                    levelCompletedIndex > lastLevelCompletedIndex)
                {
                    levelCompleted          = false;
                    lastLevelCompletedIndex = levelCompletedIndex;

                    if (afterAttackPortraits[levelCompletedIndex] != PortraitID.None)
                    {
                        PopupHandler.DisplayPortraitMessage(afterAttackPortraits[levelCompletedIndex],
                                                            afterAttackMessages[levelCompletedIndex]);
                    }
                    else
                    {
                        PopupHandler.DisplayMessage(afterAttackMessages[levelCompletedIndex]);
                    }
                }
                else
                {
                    levelCompleted = false;
                }
            }

            Collision();
        }
コード例 #11
0
        public override void Update(PlayTime playTime)
        {
            base.Update(playTime);

            // Updates player direction and speed
            if (!HasAnyShipArrived())
            {
                game.player.Direction.SetDirection(new Vector2(
                                                       Destination.position.X - game.player.position.X,
                                                       Destination.position.Y - game.player.position.Y));

                if (ControlManager.CheckPress(RebindableKeys.Pause) &&
                    GameStateManager.currentState.Equals("OverworldState"))
                {
                    PopupHandler.DisplaySelectionMenu("Do you want to skip travel?",
                                                      new List <string>()
                    {
                        "Yes", "No"
                    },
                                                      new List <System.Action>()
                    {
                        delegate
                        {
                            SkipForward();
                        },
                        delegate {}
                    });
                }
            }
            game.player.speed = speed;

            // Displays timed messages
            if (timedMessages.Keys.Count > 0 &&
                StatsManager.PlayTime.HasOverworldTimePassed(nextMessageTime))
            {
                if (portraits.Count > 0)
                {
                    if (realTime)
                    {
                        PopupHandler.DisplayRealtimePortraitMessage(GetNextMessageDuration(), portraits[0].ToArray(),
                                                                    portraitTriggers[0], timedMessages.Keys.First());
                    }
                    else
                    {
                        realTimeSwitchIndex++;
                        PopupHandler.DisplayPortraitMessage(portraits[0], portraitTriggers[0], timedMessages.Keys.First());
                        if (useRealTimeSwitch &&
                            realTimeSwitchIndex >= activateRealTimeSwitchIndex)
                        {
                            realTime = true;
                        }
                    }

                    portraits.RemoveAt(0);
                    portraitTriggers.RemoveAt(0);
                }
                else
                {
                    if (realTime)
                    {
                        PopupHandler.DisplayRealtimeMessage(GetNextMessageDuration(), timedMessages.Keys.First());
                    }
                    else
                    {
                        realTimeSwitchIndex++;
                        PopupHandler.DisplayMessage(timedMessages.Keys.First());
                        if (useRealTimeSwitch &&
                            realTimeSwitchIndex >= activateRealTimeSwitchIndex)
                        {
                            realTime = true;
                        }
                    }
                }

                timedMessages.Remove(timedMessages.Keys.First());

                if (timedMessages.Keys.Count > 0)
                {
                    nextMessageTime = GetNextMessageStartTime();
                }
            }
        }