コード例 #1
0
        /// <summary>
        /// Constructor with initial dungeon
        /// </summary>
        /// <param name="Dungeon"></param>
        public Player(Dungeon Dungeon) : base(Dungeon)
        {
            // If there's a START - that's where we're starting
            var startLocation = Dungeon.Passages.
                                FirstOrDefault(i => i.DestinationID == "START")?.Location;

            Location = startLocation ?? Location;

            // Initialise FOV
            Dungeon.PcMoved(Location);
        }
コード例 #2
0
        /// <summary>
        /// Act, per NextMove
        /// </summary>
        public override void DoTurn()
        {
            switch (NextMove)
            {
            case Instruction.MOVE_NW:
                Move(new XY(-1, -1));
                break;

            case Instruction.MOVE_N:
                Move(new XY(0, -1));
                break;

            case Instruction.MOVE_NE:
                Move(new XY(1, -1));
                break;

            case Instruction.MOVE_W:
                Move(new XY(-1, 0));
                break;

            case Instruction.MOVE_E:
                Move(new XY(1, 0));
                break;

            case Instruction.MOVE_SW:
                Move(new XY(-1, 1));
                break;

            case Instruction.MOVE_S:
                Move(new XY(0, 1));
                break;

            case Instruction.MOVE_SE:
                Move(new XY(1, 1));
                break;

            case Instruction.WAIT:
            default:
                break;
            }
            NextMove = Instruction.NOT_SET;

            // Update FOV
            Dungeon.PcMoved(Location);
        }