Beispiel #1
0
        private static void UpdateFromGameState(UpdateRequest state)
        {
            Players.Clear();
            Players.AddRange(state.Players);

            LightPlayer lightPlayer = Players[Player.ID];

            if (lightPlayer.Deaths != Player.Deaths)
            {
                Player.Deaths = lightPlayer.Deaths;
                Sounds.PlayShort("pop");
            }
            if (lightPlayer.Score != Player.Score)
            {
                Player.Score = lightPlayer.Score;
                Sounds.PlayShort("tic");
            }

            Player.HasRespawned = lightPlayer.HasRespawned;
            if (lightPlayer.ReSpawn)
            {
                Respawn();
                Player.HasRespawned = true;
            }

            if (state.Shots == null)
            {
                return;
            }
            for (int i = 0; i < state.Shots.Length; ++i)
            {
                LightShot shot = state.Shots[i];
                if (ShotLog.Contains(shot.ID))
                {
                    continue;
                }
                ShotLog.Add(shot.ID);
                Sounds.PlayShort("shot");

                Color       color = new Color(255, 220, 200, 255);
                VertexArray line  = new VertexArray(PrimitiveType.Lines);
                line.Append(new Vertex(
                                Geometry.AdaptPoint(new Vector2f(shot.Origin.X, shot.Origin.Y)),
                                color
                                ));
                line.Append(new Vertex(
                                Geometry.AdaptPoint(new Vector2f(shot.Dest.X, shot.Dest.Y)),
                                color
                                ));
                Screen.Echoes.Add(line);
            }
        }
Beispiel #2
0
 public void FromLightPlayer(LightPlayer player)
 {
     ID        = player.ID;
     Rect.Left = player.Pos.X;
     Rect.Top  = player.Pos.Y;
     State     = player.State;
     Frame     = player.Frame;
     Direction = player.Direction;
     HookPoint = new Vector2i()
     {
         X = player.HookPoint.X,
         Y = player.HookPoint.Y
     };
     Hooked = player.Hooked;
 }
Beispiel #3
0
 public Player(LightPlayer player)
 {
     MakeRect();
     FromLightPlayer(player);
 }