public void OnTimedEvent(ref bool isFinish)
        {
            mut.WaitOne();
            int?objectHit = Level.CheckIfObjectHere(startShotX, startShotY);

            if (objectHit == Constant.Level.ID_BARRICADE)
            {
                Level.ShootBaricade(startShotX, startShotY);
                isFinish = true;
            }
            else if (objectHit == Constant.Level.ID_ENNEMY)
            {
                Ennemies.HitEnnemy(startShotX, startShotY);
                isFinish = true;
            }
            else
            {
                Level.Erase(startShotX, startShotY, new string[] { PLAYERAMMO });
                Level.Write(startShotX, startShotY -= 1, new string[] { PLAYERAMMO }, ConsoleColor.Green);

                if (startShotY < 1)
                {
                    Level.Erase(startShotX, startShotY, new string[] { PLAYERAMMO });
                    isFinish = true;
                }
            }
            mut.ReleaseMutex();
        }
Esempio n. 2
0
 static void Main(string[] args)
 {
     //Provisoir
     UserInterface.CreateInterface();
     tmrMooveEnememy.Interval = 420;
     tmrMooveEnememy.Elapsed += new System.Timers.ElapsedEventHandler(MooveEnemy);
     tmrMooveEnememy.Start();
     Console.CursorVisible = false;
     Console.SetBufferSize(Constant.Level.WINDOWS_WIDTH, Constant.Level.WINDOWS_HEIGHT);
     Console.SetWindowSize(Constant.Level.WINDOWS_WIDTH, Constant.Level.WINDOWS_HEIGHT);
     Console.CursorVisible = false;
     Ennemies.CreateEnnemy();
     player.spawnSpaceShip();
     //initializes all the barricades
     Level.InitBaricades();
     player.Move();
     Console.ReadLine();
 }
Esempio n. 3
0
 public static void MooveEnemy(object sender, EventArgs e)
 {
     Ennemies.SleepTimer();
 }