コード例 #1
0
 public void Add(Ship ship)
 {
     if (Ships.TryAdd(ship.Player.ConnectionId, ship))
     {
         collisionManager.Add(ship);
     }
 }
コード例 #2
0
 public ShipMovement(Ship ship, Vector2 position)
 {
     this.ship = ship;
     Position = position;
     Velocity = Vector2.Zero;
     Acceleration = Vector2.Zero;
     Rotation = 0.0f;
 }
コード例 #3
0
ファイル: Bullet.cs プロジェクト: ronforbes/VectorArena_bak
        public Bullet(Vector2 position, Vector2 velocity, Ship ship)
            : base()
        {
            Id = Interlocked.Increment(ref idCounter);
            Movement = new BulletMovement(position, velocity);
            Radius = 10.0f;
            Ship = ship;

            createdAt = DateTime.Now;
        }
コード例 #4
0
ファイル: Game.cs プロジェクト: ronforbes/VectorArena_bak
        public int AddPlayer(string connectionId)
        {
            Ship ship = new Ship(new Vector2(random.Next(worldWidth) - worldWidth / 2, random.Next(worldHeight) - worldHeight / 2), bulletManager);
            Player player = new Player(connectionId, ship);

            PlayerManager.Add(player);
            shipManager.Add(ship);

            return ship.Id;
        }
コード例 #5
0
ファイル: Player.cs プロジェクト: ronforbes/VectorArena_bak
        public Player(string connectionId, Ship ship)
        {
            ConnectionId = connectionId;
            Ship = ship;

            if (ship != null)
            {
                ship.Player = this;
            }
        }
コード例 #6
0
        private object[] Compress(Ship ship)
        {
            object[] compressedShip = new object[10];

            compressedShip[0] = ship.Id;
            compressedShip[1] = ship.Movement.Position.X;
            compressedShip[2] = ship.Movement.Position.Y;
            compressedShip[3] = ship.Movement.Velocity.X;
            compressedShip[4] = ship.Movement.Velocity.Y;
            compressedShip[5] = ship.Movement.Acceleration.X;
            compressedShip[6] = ship.Movement.Acceleration.Y;
            compressedShip[7] = ship.Movement.Rotation;
            compressedShip[8] = ship.Alive;
            compressedShip[9] = ship.Health;

            return compressedShip;
        }
コード例 #7
0
 public ShipWeapons(Ship ship, BulletManager bulletManager)
 {
     lastBulletFiredAt = DateTime.Now;
     this.ship = ship;
     this.bulletManager = bulletManager;
 }