public override void OnPlayerPostDraw(PlayerEntity player, SpriteBatch sb) { if(player == RedFlagCarrier) { DrawManager.DrawBox(player.EntityPosition - CameraManager.cameraPosition - new Vector2(0, 70), 20, 20, Color.Red, sb); } if (player == BlueFlagCarrier) { DrawManager.DrawBox(player.EntityPosition - CameraManager.cameraPosition - new Vector2(0, 70), 20, 20, Color.Blue, sb); } base.OnPlayerPostDraw(player, sb); }
public override void OnGameModeEvent(string eventName, MiningGameServer.Packets.Packet data) { byte whichFlag; byte playerID; PlayerEntity player; switch (eventName) { case "drop": //Remove the flag from the player's back, basically playerID = data.ReadByte(); player = GameWorld.GetPlayer(playerID); if (player == RedFlagCarrier) RedFlagCarrier = null; if (player == BlueFlagCarrier) BlueFlagCarrier = null; break; case "pickup": whichFlag = data.ReadByte(); playerID = data.ReadByte(); player = GameWorld.GetPlayer(playerID); if (whichFlag == 0) BlueFlagCarrier = player; if (whichFlag == 1) RedFlagCarrier = player; break; } base.OnGameModeEvent(eventName, data); }
public PlayerClassDestroyer(PlayerEntity thePlayer) { Player = thePlayer; }
public override void Update(GameTime time) { if (MovingTowards == null) EntityMovement(); if (_timeAlive++ < 15) return; if (MovingTowards == null) return; MoveTowardsPoint(MovingTowards.EntityPosition, 4); if (HitTest(MovingTowards) || ++timeFlying >= 120) { if (MovingTowards == GameWorld.ThePlayer.PlayerEntity) Main.SoundManager.PlaySound("collectitem"); ShouldDestroy = !Incomplete; MovingTowards = null; timeFlying = 0; } base.Update(time); }
public virtual void OnPlayerUpdate(PlayerEntity player) { }
public virtual void OnPlayerPreDraw(PlayerEntity player, SpriteBatch sb) { }
public virtual void OnPlayerDisconnect(PlayerEntity player) { }
public virtual void OnPlayerDeath(PlayerEntity player) { }
public virtual void OnPlayerChooseTeam(PlayerEntity player, int team) { }
public virtual void OnPlayerChooseClass(PlayerEntity player, int classChosen) { }
public static void PlayerUpdating(Packet p) { int numToUpdate = p.ReadByte(); List<byte> playersUpdated = new List<byte>(); List<byte> allPlayers = GameWorld.OtherPlayers.Select(pl => pl.PlayerID).ToList(); for (int i = 0; i < numToUpdate; i++) { int playerID = p.ReadByte(); playersUpdated.Add((byte)playerID); PlayerEntity player; if (playerID == GameWorld.ThePlayer.PlayerEntity.PlayerID) player = GameWorld.ThePlayer.PlayerEntity; else { player = GameWorld.OtherPlayers.Where(pl => pl.PlayerID == playerID).FirstOrDefault(); } if (player == null) player = new PlayerEntity(Vector2.Zero, (byte)playerID); byte updateMask = p.ReadByte(); if ((updateMask & (int)PlayerUpdateFlags.Player_Position) != 0) { short x = p.ReadShort(); short y = p.ReadShort(); player.EntityPosition.X = x; player.EntityPosition.Y = y; } if ((updateMask & (int)PlayerUpdateFlags.Player_Movement_Flags) != 0) { byte flags = p.ReadByte(); player.OtherPlayerNetworkFlags = flags; bool leftPress = (flags & (int)PlayerMovementFlag.Left_Pressed) != 0; bool rightPress = (flags & (int)PlayerMovementFlag.Right_Pressed) != 0; bool idle = (flags & (int)PlayerMovementFlag.Idle) != 0; if (leftPress || rightPress) { player.FacingLeft = leftPress && !rightPress; if (!(leftPress && rightPress)) { player.TorsoAnimateable.StartLooping("player_run_start", "player_run_end"); player.LegsAnimateable.StartLooping("player_run_start", "player_run_end"); } else { player.TorsoAnimateable.StartLooping("player_idle", "player_idle"); player.LegsAnimateable.StartLooping("player_idle", "player_idle"); } } if (idle) { player.TorsoAnimateable.StartLooping("player_idle", "player_idle"); player.LegsAnimateable.StartLooping("player_idle", "player_idle"); } } if ((updateMask & (int)PlayerUpdateFlags.Player_Class_Update) != 0) { player.PClass.ReadState(p); } } }
public PlayerController() { PlayerEntity = new PlayerEntity(new Vector2(-100, -100), 0); Inventory = new PlayerInventory(this); }