Esempio n. 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);
        }
Esempio n. 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;
        }
Esempio n. 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);
        }
Esempio n. 4
0
 public void PlaceActorToGrid(IPlacableActor actor, Vector v)
 {
     Map.Grid [v._x] [v._y].Actor = actor;
 }
Esempio n. 5
0
 public void PlaceActorToGrid(IPlacableActor actor)
 {
     Map.Grid [actor.InitialX] [actor.InitialY].Actor = actor;
 }
Esempio n. 6
0
 public void Attack(IPlacableActor self, string direction)
 {
     // What should happen here?
 }