-
Notifications
You must be signed in to change notification settings - Fork 11
command
mtanksl edited this page Dec 21, 2024
·
4 revisions
Commands
abstract away how and which clients needs to receive this information.
A magic effect displayed to all nearby players.
public class ShowMagicEffectCommand : Command
{
public ShowMagicEffectCommand(Position position, MagicEffectType magicEffectType)
{
Position = position;
MagicEffectType = magicEffectType;
}
public Position Position { get; set; }
public MagicEffectType MagicEffectType { get; set; }
public override Promise Execute()
{
foreach (var observer in Context.Server.Map.GetObserversOfTypePlayer(Position) )
{
if (observer.Tile.Position.CanSee(Position) )
{
Context.AddPacket(observer, new ShowMagicEffectOutgoingPacket(Position, MagicEffectType );
}
}
return Promise.Completed;
}
}