public SetTileCharacterCommand(Tile tile, Character character)
        {
            tile.ThrowIfNull("sprite");
            character.ThrowIfNull("character");

            _tile = tile;
            _character = character;
        }
        protected Tile(
            Coordinate coordinate,
            Character character)
        {
            character.ThrowIfNull("character");

            Coordinate = coordinate;
            Character = character;
        }
        public byte[] Serialize(Character character)
        {
            var serializer = new CompactSerializer();

            serializer[0] = new[] { character.Symbol };
            serializer[1] = ColorSerializer.Instance.Serialize(character.ForegroundColor);
            serializer[2] = ColorSerializer.Instance.Serialize(character.BackgroundColor);

            return serializer.Serialize();
        }
        public XElement Serialize(Character character, string elementName = "character")
        {
            character.ThrowIfNull("character");
            elementName.ThrowIfNull("elementName");

            return new XElement(
                elementName,
                new XAttribute("symbol", character.Symbol),
                new XAttribute("foregroundColor", ColorSerializer.Instance.Serialize(character.ForegroundColor)),
                new XAttribute("backgroundColor", ColorSerializer.Instance.Serialize(character.BackgroundColor)));
        }
        public IEnumerable<Sprite> CreateArea(Coordinate originCoordinate, Size size, Character character)
        {
            character.ThrowIfNull("character");

            for (int x = 0; x < size.Width; x++)
            {
                for (int y = 0; y < size.Height; y++)
                {
                    yield return new Sprite(new Coordinate(originCoordinate.X + x, originCoordinate.Y + y), character);
                }
            }
        }
        private static IEnumerable<Sprite> GetBackgroundLayerSprites()
        {
            for (int x = 0; x < _boardSize.Width; x++)
            {
                for (int y = 0; y < _boardSize.Height; y++)
                {
                    var coordinate = new Coordinate(x, y);
                    var character = new Character(Symbol.LightShade, new Color(0, 96, 0), new Color(0, 64, 0));

                    yield return new Sprite(coordinate, character);
                }
            }
        }
Exemple #7
0
        public Player(
			Guid id,
			Guid boardId,
			Coordinate coordinate,
			Character character,
			EventHandlerCollection eventHandlerCollection = null)
        {
            character.ThrowIfNull("character");

            _id = id;
            BoardId = boardId;
            _character = character;
            _eventHandlerCollection = eventHandlerCollection;
            Coordinate = coordinate;
        }
        public Actor(
            Guid id,
            string name,
            string description,
            Character character)
        {
            name.ThrowIfNull("name");
            description.ThrowIfNull("description");
            character.ThrowIfNull("character");

            _id = id;
            Name = name;
            Description = description;
            Character = character;
        }
        public ActorInstance(
			Guid id,
			string name,
			string description,
			Guid actorId,
			Guid boardId,
			Coordinate coordinate,
			Character character,
			EventHandlerCollection eventHandlerCollection = null)
            : base(coordinate, character)
        {
            name.ThrowIfNull("name");
            description.ThrowIfNull("description");

            _id = id;
            Name = name;
            Description = description;
            _actorId = actorId;
            _boardId = boardId;
            _eventHandlerCollection = eventHandlerCollection;
        }
 public ActorInstance CreateActorInstance(Guid id, Guid boardId, Coordinate coordinate, Character character, EventHandlerCollection eventHandlerCollection = null)
 {
     return new ActorInstance(id, _name, _description, _id, boardId, coordinate, character, eventHandlerCollection);
 }
 public ActorInstance CreateActorInstance(string name, string description, Guid boardId, Coordinate coordinate, Character character, EventHandlerCollection eventHandlerCollection = null)
 {
     return new ActorInstance(Guid.NewGuid(), name, description, _id, boardId, coordinate, character, eventHandlerCollection);
 }
Exemple #12
0
 public static SetTileCharacterCommand SetTileCharacter(Tile tile, Character character)
 {
     return new SetTileCharacterCommand(tile, character);
 }
Exemple #13
0
        public Sprite(
			Coordinate coordinate,
			Character character)
            : base(coordinate, character)
        {
        }
 public PencilRendererState()
 {
     _character = new Character(0, Color.White, Color.TransparentBlack);
 }