示例#1
0
        /** Returns the wall object at given location and direction, or null if not found. */
        private GameObject getDoor(int x, int y, Direction facing)
        {
            string direction = "";

            if (facing.isNorth)
            {
                direction = "North";
            }

            if (facing.isEast)
            {
                direction = "East";
            }

            if (facing.isSouth)
            {
                direction = "North";
                y--;
            }
            if (facing.isWest)
            {
                direction = "East";
                x--;
            }
            var doorSearchName   = DungeonBuilder.NameFromProperites(x, y, direction, "Door");
            var secretSearchName = DungeonBuilder.NameFromProperites(x, y, direction, "Secret");
            var gateSearchName   = DungeonBuilder.NameFromProperites(x, y, direction, "Gate");

            return(GameObject.Find(doorSearchName) ?? GameObject.Find(secretSearchName) ?? GameObject.Find(gateSearchName));
        }