コード例 #1
0
ファイル: Radar.cs プロジェクト: LinkPact/The-Sun-Will-Go-Out
        public void Update(GameTime gameTime, List <GameObjectOverworld> objectsInOverworld, Vector2 cameraPos)
        {
            objectsVisibleOnRadar.Clear();
            missionArrows.Clear();
            availableMainMissionArrows.Clear();
            availableMainMissionLocationNames.Clear();

            availableMainMissionLocationNames = MissionManager.GetAvailableMainMissionLocationNames();

            colorSwapCounter += 1 * MathFunctions.FPSSyncFactor(gameTime);

            foreach (GameObjectOverworld obj in objectsInOverworld)
            {
                // Adds visible game objects
                if (CollisionDetection.IsPointInsideCircle(obj.position, game.player.position, viewRadius))
                {
                    objectsVisibleOnRadar.Add(obj);
                }

                // Adds mission arrows for non-visible mission coordinates
                else if (MissionManager.IsCurrentObjectiveDestination(obj) ||
                         MissionManager.IsFailedMissionDestination(obj))
                {
                    Boolean isMain = MissionManager.IsMainMissionDestination(obj);
                    missionArrows.Add(new DirectionArrow(spriteSheet, obj.position, playerpos, isMain));
                }

                else if (MissionManager.IsNoMainMissionActive())
                {
                    foreach (String str in availableMainMissionLocationNames)
                    {
                        if (obj.name.ToLower().Equals(str.ToLower()))
                        {
                            availableMainMissionArrows.Add(new DirectionArrow(spriteSheet, obj.position, playerpos, true));
                            break;
                        }
                    }
                }
            }

            playerpos = game.player.position;
            Origin    = new Vector2(cameraPos.X + Game1.ScreenSize.X / 2 - background.SourceRectangle.Value.Width,
                                    cameraPos.Y + Game1.ScreenSize.Y / 2 - background.SourceRectangle.Value.Height);
        }