Beispiel #1
0
        private GameLogic()
        {
            mPlayerView = new List<IVisible>();
              mComputerView = new List<IVisible>();
              mObjectList = new List<GameObject>();
              mAi = new Ai(mObjectList);
              mSpaceshipAi = new SpaceshipAi();

              mGameStateManager = new GameStateManager();
              mGameObjectManager = GameObjectManager.GetInstance();
              mGameObjectManager.Init(mObjectList);
        }
Beispiel #2
0
        public Ai(List<GameObject> objectList)
        {
            mGom = GameObjectManager.GetInstance();
              mObjectList = objectList;

             mUpgradeCount = 0;

             mAiObjects = new List<GameObject>();
              mPlayerObjectsVisible = new List<GameObject>();
              mAiSpaceships = new List<Spaceship>();
              mAiPlanets = new List<Planet>();
              mNeutralPlanetsVisible = new List<Planet>();
              mPlayerPlanetsVisible = new List<Planet>();
              mSharingPlanets = new List<Planet>();
              mRandom = new Random();
        }
        public void Init(GraphicsDevice device,
            ContentManager content,
            GraphicObjectManager graphicObjMgr,
            Renderer renderer)
        {
            mSelectionManager.Init(renderer.GetCamera(), graphicObjMgr.GetList());
              mSound.Init(content);
              graphicObjMgr.SetSoundRef(mSound);

              mGom = GameObjectManager.GetInstance();

              mDevice = device;
              mRenderer = renderer;
              mCamera = mRenderer.GetCamera();

              mInput.Init();
              mInput.SetKey(new KeyAssignment(Keys.Escape, MenuSwitch));

              mInput.SetKey(new KeyAssignment(Keys.F1, ShowHelpScreen));
              mInput.SetKey(new KeyAssignment(Keys.F2, ShowStatsScreen));

              mInput.SetKey(new KeyAssignment(Keys.F4, LoadGame));
              mInput.SetKey(new KeyAssignment(Keys.F5, SaveGame));

              mInput.SetKey(new KeyAssignment(Keys.LeftControl, LeftControlHelper));
              mInput.SetKey(new KeyAssignment(Keys.RightControl, mSelectionManager.SetMultiSelection));
              mInput.SetKey(new KeyAssignment(Keys.LeftShift, ShiftClickHelper));

              mInput.SetKey(new KeyAssignment(Keys.W, mCamera.MoveCameraUp, false));
              mInput.SetKey(new KeyAssignment(Keys.A, mCamera.MoveCameraLeft, false));
              mInput.SetKey(new KeyAssignment(Keys.S, mCamera.MoveCameraDown, false));
              mInput.SetKey(new KeyAssignment(Keys.D, mCamera.MoveCameraRight, false));
              mInput.SetKey(new KeyAssignment(Keys.OemPlus, mCamera.ZoomIn, false));
              mInput.SetKey(new KeyAssignment(Keys.OemMinus, mCamera.ZoomOut, false));

              mInput.SetKey(new KeyAssignment(Keys.X, mInput.SetHotkey, 0)); // StarFleet/Interceptor
              mInput.SetKey(new KeyAssignment(Keys.C, mInput.SetHotkey, 1)); // MinionBoost/Predator
              mInput.SetKey(new KeyAssignment(Keys.V, mInput.SetHotkey, 2)); // Satelite/Defender
              mInput.SetKey(new KeyAssignment(Keys.B, mInput.SetHotkey, 3)); // Shield
              mInput.SetKey(new KeyAssignment(Keys.N, mInput.SetHotkey, 4)); // Deathstar

              mInput.SetKey(new KeyAssignment(Keys.F10, mRenderer.ToggleFogOfWar));
        }
 public static GameObjectManager GetInstance()
 {
     if (sUniqueInstance == null)
     sUniqueInstance = new GameObjectManager();
       return sUniqueInstance;
 }