GetSpawn() public method

public GetSpawn ( byte Team ) : Point
Team byte
return Point
コード例 #1
0
ファイル: Game.cs プロジェクト: FezodgeIII/Shooter2D
        public static void NewRound()
        {
            RoundTimer = 0; RoundEnded = false;
            for (byte i = 0; i < Players.Length; i++)
            {
                if (Players[i] != null)
                {
                    Players[i].Dead = false;
                }
            }
            Point Spawn = Map.GetSpawn(Self.Team);

            Self.Respawn(new Vector2(((Spawn.X * Tile.Width) + (Tile.Width / 2f)), ((Spawn.Y * Tile.Height) + (Tile.Height / 2f))));
            if (MultiPlayer.Type() == MultiPlayer.Types.Server)
            {
                MultiPlayer.Send(MultiPlayer.Construct(Packets.NewRound));
            }
        }
コード例 #2
0
 public override void Update(GameTime Time)
 {
     if ((Animation == null) || Animation.Finished)
     {
         ;
     }
     if (FireRate > 0)
     {
         FireRate -= Time.ElapsedGameTime.TotalSeconds;
     }
     if (this == Self)
     {
         if (Globe.Active && !Dead)
         {
             var OldPosition = Position;
             var Run         = (Keyboard.Holding(Keyboard.Keys.LeftShift) || Keyboard.Holding(Keyboard.Keys.RightShift));
             if (Keyboard.Holding(Keyboard.Keys.W))
             {
                 if (Keyboard.Holding(Keyboard.Keys.A))
                 {
                     Move(new Vector2(-(float)(Speed.X * Time.ElapsedGameTime.TotalSeconds),
                                      -(float)(Speed.Y * Time.ElapsedGameTime.TotalSeconds)));
                 }
                 else if (Keyboard.Holding(Keyboard.Keys.D))
                 {
                     Move(new Vector2((float)(Speed.X * Time.ElapsedGameTime.TotalSeconds),
                                      -(float)(Speed.Y * Time.ElapsedGameTime.TotalSeconds)));
                 }
                 else
                 {
                     Move(new Vector2(0, -(float)(Speed.Y * Time.ElapsedGameTime.TotalSeconds)));
                 }
             }
             else if (Keyboard.Holding(Keyboard.Keys.S))
             {
                 if (Keyboard.Holding(Keyboard.Keys.A))
                 {
                     Move(new Vector2(-(float)(Speed.X * Time.ElapsedGameTime.TotalSeconds),
                                      (float)(Speed.Y * Time.ElapsedGameTime.TotalSeconds)));
                 }
                 else if (Keyboard.Holding(Keyboard.Keys.D))
                 {
                     Move(new Vector2((float)(Speed.X * Time.ElapsedGameTime.TotalSeconds),
                                      (float)(Speed.Y * Time.ElapsedGameTime.TotalSeconds)));
                 }
                 else
                 {
                     Move(new Vector2(0, (float)(Speed.Y * Time.ElapsedGameTime.TotalSeconds)));
                 }
             }
             else if (Keyboard.Holding(Keyboard.Keys.A))
             {
                 Move(new Vector2(-(float)(Speed.X * Time.ElapsedGameTime.TotalSeconds), 0));
             }
             else if (Keyboard.Holding(Keyboard.Keys.D))
             {
                 Move(new Vector2((float)(Speed.X * Time.ElapsedGameTime.TotalSeconds), 0));
             }
             if (OldPosition != Position)
             {
             }
             Angle           = Globe.Lerp(Angle, Globe.Angle(Position, Mouse.CameraPosition), .1f);
             Camera.Position = Globe.Move(Position, Globe.Angle(Position, Mouse.CameraPosition), (Vector2.Distance(Position, Mouse.CameraPosition) / 4));
             //Camera.Angle = Angle;
             if (Mouse.Pressed(Mouse.Buttons.Left) && (FireRate <= 0))
             {
                 Fire(Position, Angle);
             }
         }
         if (RespawnTimer > 0)
         {
             RespawnTimer -= Time.ElapsedGameTime.TotalSeconds;
         }
         else if (Dead)
         {
             if ((GameType == GameTypes.Deathmatch) || (GameType == GameTypes.TeamDeathmatch))
             {
                 Point Spawn = Map.GetSpawn(Team);
                 Respawn(new Vector2(((Spawn.X * Tile.Width) + (Tile.Width / 2f)), ((Spawn.Y * Tile.Height) + (Tile.Height / 2f))));
             }
         }
         if ((Health <= 0) && !Dead)
         {
             Die();
         }
         if (Timers.Tick("Positions") && (MultiPlayer.Type("Game") == MultiPlayer.Types.Client))
         {
             MultiPlayer.Send("Game", MultiPlayer.Construct("Game", Game.Packets.Position, Position, Angle),
                              NetDeliveryMethod.UnreliableSequenced, 1);
         }
     }
     Globe.Move(ref InterpolatedPosition, Position, (Vector2.Distance(InterpolatedPosition, Position) / 6));
     InterpolatedAngle = Globe.Lerp(InterpolatedAngle, Angle, .125f);
     base.Update(Time);
 }