public Projectile() { Damage = 0; Element = Entity.DamageElement.Normal; Target = null; Speed = 0; toDraw = new AnimatedSprite(10); toDraw.Sprites = new List<Sprite>(ExternalResources.GetSprites("Resources/Sprites/Projectiles")); toDraw.Reset(); }
protected override void ParseUpdate(MemoryStream memoryStream) { var reader = new BinaryReader(memoryStream); Damage = reader.ReadSingle(); Element = (Entity.DamageElement) reader.ReadByte(); Speed = reader.ReadSingle(); Position = new Vector2f(reader.ReadSingle(), reader.ReadSingle()); var targetId = reader.ReadUInt16(); if(MyGameMode.EntityBases.ContainsKey(targetId)) { Target = MyGameMode.EntityBases[targetId]; } }
public ProjectileBase(GameServer _server, Player player, Vector2f startPosition, EntityBase target, float dmg, Entity.DamageElement element, float speed = 1) : base(_server, player) { EntityType = Entity.EntityType.Projectile; Start = startPosition; Target = target; Position = Start; BoundsSize = new Vector2f(5, 5); Damage = dmg; Element = element; Speed = speed; RemoveOnNoHealth = false; }