Beispiel #1
0
        public bool IsFreeInDirection(IPlacableActor actor, string direction)
        {
            var location = Map.GetActorCoordinates(actor);

            switch (direction)
            {
            case "Up":
                location._y--;
                break;

            case "Down":
                location._y++;
                break;

            case "Left":
                location._x--;
                break;

            case "Right":
                location._x++;
                break;
            }
            if (Map.At(location).Actor != null)
            {
                return(false);
            }
            if (!Map.At(location).IsPassable())
            {
                return(false);
            }
            return(true);
        }
Beispiel #2
0
        public void Move(IPlacableActor self, string direction)
        {
            var location = Map.GetActorCoordinates(self);

            Map.At(location).Actor = null;

            switch (direction)
            {
            case "Up":
                location._y--;
                break;

            case "Down":
                location._y++;
                break;

            case "Left":
                location._x--;
                break;

            case "Right":
                location._x++;
                break;
            }
            Map.At(location).Actor = self;
        }
Beispiel #3
0
        public IActor ActorInDirection(IPlacableActor actor, string direction)
        {
            var location = Map.GetActorCoordinates(actor);

            switch (direction)
            {
            case "Up":
                location._y--;
                break;

            case "Down":
                location._y++;
                break;

            case "Left":
                location._x--;
                break;

            case "Right":
                location._x++;
                break;
            }
            return(Map.At(location).Actor);
        }
Beispiel #4
0
 public void PlaceActorToGrid(IPlacableActor actor, Vector v)
 {
     Map.Grid [v._x] [v._y].Actor = actor;
 }
Beispiel #5
0
 public void PlaceActorToGrid(IPlacableActor actor)
 {
     Map.Grid [actor.InitialX] [actor.InitialY].Actor = actor;
 }
Beispiel #6
0
 public void Attack(IPlacableActor self, string direction)
 {
     // What should happen here?
 }