Esempio n. 1
0
        public Ship(Vector2 position, BulletManager bulletManager)
            : base()
        {
            Id = Interlocked.Increment(ref idCounter);
            Movement = new ShipMovement(this, position);
            Weapons = new ShipWeapons(this, bulletManager);
            Radius = 15.0f;
            Alive = true;
            Health = maxHealth;

            Actions = new ConcurrentDictionary<Action, bool>();
            Actions.TryAdd(Action.TurnLeft, false);
            Actions.TryAdd(Action.TurnRight, false);
            Actions.TryAdd(Action.ThrustForward, false);
            Actions.TryAdd(Action.ThrustBackward, false);
            Actions.TryAdd(Action.Fire, false);
        }
Esempio n. 2
0
        public Game()
        {
            PlayerManager = new PlayerManager();
            collisionManager = new CollisionManager();
            shipManager = new ShipManager(collisionManager);
            bulletManager = new BulletManager(collisionManager);

            gameStateManager = new GameStateManager();

            updateTimer = new Timer(1000 / updatesPerSecond);
            updateTimer.AutoReset = true;
            updateTimer.Elapsed += updateTimer_Elapsed;
            updateTimer.Start();

            drawTimer = new Timer(1000 / drawsPerSecond);
            drawTimer.AutoReset = true;
            drawTimer.Elapsed += drawTimer_Elapsed;
            drawTimer.Start();
        }
Esempio n. 3
0
 public ShipWeapons(Ship ship, BulletManager bulletManager)
 {
     lastBulletFiredAt = DateTime.Now;
     this.ship = ship;
     this.bulletManager = bulletManager;
 }