public NetworkManager(Player playerCharacter) { Players = new List <Player>(); ServerAbilities = new List <AbilityOutline>(); classType = playerCharacter.Type; }
public void SendClassChange(Player.ClassType type) { var outmsg = client.CreateMessage(); outmsg.Write((byte)PacketType.ClassChange); outmsg.Write(Username); outmsg.Write((byte)type); client.SendMessage(outmsg, NetDeliveryMethod.ReliableOrdered); }
private void ReceiveClassChange(NetIncomingMessage inc) { string name = inc.ReadString(); Player.ClassType type = (Player.ClassType)inc.ReadByte(); var player = Players.FirstOrDefault(p => p.Username == name); if (player == null) { return; } player.Type = type; }
private void DrawAbility(SpriteBatch spriteBatch, AbilityOutline ability, Player.ClassType playerType) { Rectangle source = new Rectangle(ability.Animation.XRecPos, ability.Animation.YRecPos, ability.Animation.Width, ability.Animation.Height); switch (playerType) { case Player.ClassType.Wizard: if (ability.Type == AbilityOutline.AbilityType.Projectile) { spriteBatch.Draw(AssetManager.WizardWandProjectile, new Vector2(ability.XPosition, ability.YPosition), source, Color.White, (float)ability.Direction, Vector2.Zero, Game1.SCALE, SpriteEffects.None, 1.0f); spriteBatch.DrawString(AssetManager.CooldownFont, $"{ability.Username} - {ability.ID}", new Vector2(ability.XPosition, ability.YPosition + 5), Color.White); } else if (ability.Type == AbilityOutline.AbilityType.AbilityOne) { spriteBatch.Draw(AssetManager.WizardIceBlock, new Vector2(ability.XPosition, ability.YPosition), source, Color.White, 0.0f, Vector2.Zero, Game1.SCALE, SpriteEffects.None, 1.0f); } else if (ability.Type == AbilityOutline.AbilityType.AbilityTwo) { spriteBatch.Draw(AssetManager.WizardSpriteSheet, new Vector2(ability.XPosition, ability.YPosition), source, Color.White, 0.0f, Vector2.Zero, Game1.SCALE, SpriteEffects.None, 1.0f); } break; case Player.ClassType.Ogre: if (ability.Type == AbilityOutline.AbilityType.AbilityOne) { spriteBatch.Draw(AssetManager.groundSmashCrackle, new Vector2(ability.XPosition, ability.YPosition), source, Color.White, 0.0f, Vector2.Zero, Game1.SCALE, SpriteEffects.None, 1.0f); } else if (ability.Type == AbilityOutline.AbilityType.AbilityTwo) { } break; case Player.ClassType.Huntress: if (ability.Type == AbilityOutline.AbilityType.Projectile) { spriteBatch.Draw(AssetManager.HuntressArrow, new Vector2(ability.XPosition, ability.YPosition), source, Color.White, (float)ability.Direction, Vector2.Zero, Game1.SCALE, SpriteEffects.None, 1.0f); } if (ability.Type == AbilityOutline.AbilityType.AbilityOne) { spriteBatch.Draw(AssetManager.HuntressBoar, new Vector2(ability.XPosition, ability.YPosition), source, Color.White, 0.0f, Vector2.Zero, Game1.SCALE, SpriteEffects.None, 1.0f); } else if (ability.Type == AbilityOutline.AbilityType.AbilityTwo) { spriteBatch.Draw(AssetManager.HuntressBearTrap, new Vector2(ability.XPosition, ability.YPosition), source, Color.White, 0.0f, Vector2.Zero, Game1.SCALE, SpriteEffects.None, 1.0f); } break; case Player.ClassType.TimeTraveler: if (ability.Type == AbilityOutline.AbilityType.Projectile) { spriteBatch.Draw(AssetManager.WizardWandProjectile, new Vector2(ability.XPosition, ability.YPosition), source, Color.White, (float)ability.Direction, Vector2.Zero, Game1.SCALE, SpriteEffects.None, 1.0f); } if (ability.Type == AbilityOutline.AbilityType.AbilityOne) { } else if (ability.Type == AbilityOutline.AbilityType.AbilityTwo) { spriteBatch.Draw(AssetManager.TimeTravelerTimeZone, new Vector2(ability.XPosition, ability.YPosition), source, Color.White, 0.0f, Vector2.Zero, Game1.SCALE, SpriteEffects.None, 1.0f); } break; case Player.ClassType.Assassin: if (ability.Type == AbilityOutline.AbilityType.AbilityOne) { } else if (ability.Type == AbilityOutline.AbilityType.AbilityTwo) { } break; case Player.ClassType.Knight: if (ability.Type == AbilityOutline.AbilityType.AbilityOne) { } else if (ability.Type == AbilityOutline.AbilityType.AbilityTwo) { } break; } }