コード例 #1
0
ファイル: Hero.cs プロジェクト: manicolosi/questar
        private Action CreateMoveAction(Direction direction)
        {
            GridInformation info = GridInformation.Invalid;
            Action action = null;
            Location loc = null;

            loc = direction.ApplyTo (base.Location);
            if (loc != null) {
                info = loc.GridInformation;
            }

            switch (info)
            {
                case GridInformation.Invalid:
                    Messages.Instance.Add ("You can't go that way!");
                    break;

                case GridInformation.BlockingTerrain:
                    Messages.Instance.Add ("There is something in the way.");
                    break;

                case GridInformation.Occupied:
                    AddAction (new AttackAction (this, loc.Actor));
                    break;

                default:
                    action = new MoveAction (this, direction);
                    break;
            }

            return action;
        }
コード例 #2
0
ファイル: MoveAction.cs プロジェクト: manicolosi/questar
 public MoveAction(Actor actor, Direction direction)
     : base(actor)
 {
     this.direction = direction;
 }
コード例 #3
0
ファイル: MoveAction.cs プロジェクト: manicolosi/questar
 public MoveAction(Actor actor)
     : base(actor)
 {
     this.direction = Direction.None;
 }
コード例 #4
0
ファイル: AbstractActor.cs プロジェクト: manicolosi/questar
 public bool CanMoveIn(Direction direction)
 {
     return CanMoveTo (direction.ApplyTo (base.Location));
 }