Ejemplo n.º 1
0
        public GameModel(Grid grMain, string levelsFolderName, string weaponFolderName)
        {
            isModelReady   = false;
            isLoadTimerEnd = false;

            lvlName = levelsFolderName;

            grGame       = (Grid)grMain.Children[0];
            grPauseMenu  = (PauseMenuGrid)grMain.Children[1];
            dlgDefeat    = (ChoiceDialog)grMain.Children[2];
            dlgVictory   = (ChoiceDialog)grMain.Children[3];
            grStats      = (StatsGrid)grMain.Children[4];
            grLoadScreen = (Grid)grMain.Children[grMain.Children.Count - 1];


            ClearGridGame();

            mediaPlayers = new List <MediaPlayer>();

            InitTimers();

            camera            = new Camera(GetImageFromGridGame(1), GetImageFromGridGame(2), GetImageFromGridGame(3), levelsFolderName, weaponFolderName);
            rifle             = new Rifle(GetImageFromGridGame(0), weaponFolderName);
            scope             = new Scope(GetImageFromGridGame(1), GetImageFromGridGame(2), GetImageFromGridGame(3), GetImageFromGridGame(0), weaponFolderName);
            listOfTargets     = new ListOfTargets(GetImageFromGridGame(1), GetImageFromGridGame(2), GetImageFromGridGame(3), levelsFolderName);
            interfaceElements = new InterfaceElements(grGame, grStats, dlgDefeat, dlgVictory);

            PrepareModel();

            isModelReady = true;
            loadTimer.Start();

            InterfaceElements.timer.timer.Start();
        }
Ejemplo n.º 2
0
        public static void Shoot(Point cursorPos, Point cursorScreenPos, bool isZoomIn, bool isAnimation)
        {
            if (isAnimation)
            {
                return;
            }
            if (curBullets == 0 || isNeedBolt)
            {
                StaticFunctions.PlaySound(soundNoBullet, GameModel.mediaPlayers);
                return;
            }

            curBullets--;
            InterfaceElements.bulletsCounter.ChangeBulletsCount(curBullets, addBullets);
            ListOfTargets.ControlOfHit(cursorPos, isZoomIn);
            StartShootAnimation(isZoomIn);
            StartRecoil(cursorScreenPos);
            isNeedBolt = true;
        }
Ejemplo n.º 3
0
 public static void MoveCamera(Point cursorScreenPos)
 {
     Camera.MoveBgs(cursorScreenPos);
     ListOfTargets.MoveTargets();
 }