Esempio n. 1
0
    public bool TryBuildPlot(ObjectRotation roomRotation, RoomBlueprint selectedRoomBlueprint, GridLocation doorPositionOnExistingRoom)
    {
        for (int k = 0; k < selectedRoomBlueprint.DoorLocations.Length; k++)
        {
            GridLocation doorPositionOnBlueprint = getDoorPositionOnBlueprint(roomRotation, selectedRoomBlueprint, selectedRoomBlueprint.DoorLocations[k]);

            //Logger.Log("doorPositionOnExistingRoom {0}, {1} - doorPositionOnBlueprint {2} with rotation {3} is {4}, {5}",
            //    doorPositionOnExistingRoom.UpRight, doorPositionOnExistingRoom.UpLeft, selectedRoomBlueprint.RoomName, roomRotation, doorPositionOnBlueprint.UpRight, doorPositionOnBlueprint.UpLeft);
            if ((doorPositionOnExistingRoom.UpRight == doorPositionOnBlueprint.UpRight) && (doorPositionOnExistingRoom.UpLeft == doorPositionOnBlueprint.UpLeft))
            {
                continue;
            }

            GridLocation blueprintRoomStartPosition = new GridLocation(doorPositionOnExistingRoom.UpRight - doorPositionOnBlueprint.UpRight, (doorPositionOnExistingRoom.UpLeft - doorPositionOnBlueprint.UpLeft));

            if (blueprintRoomStartPosition.UpLeft % 3 != 0 || blueprintRoomStartPosition.UpRight % 3 != 0)
            {
                Logger.Log(Logger.Building, "This room cannot be built because it would not start on a (large) tile location. Its start position would be {0}, {1}. Skip. ", blueprintRoomStartPosition.UpRight, blueprintRoomStartPosition.UpLeft);
                continue;
            }

            Vector2 blueprintRoomStartPositionVector = GridHelper.GridToVectorLocation((int)blueprintRoomStartPosition.UpRight, (int)blueprintRoomStartPosition.UpLeft);
            //Logger.Log("the blueprintRoomStartPosition would be {0}, {1}", blueprintRoomStartPosition.UpRight, (int)blueprintRoomStartPosition.UpLeft);
            //Logger.Log("the blueprintRoomStartPositionVector would be {0}, {1}", blueprintRoomStartPositionVector.x, blueprintRoomStartPositionVector.y);

            if (GetPlotIsAvailable(selectedRoomBlueprint, blueprintRoomStartPositionVector, roomRotation))
            {
                BuildMenuWorldSpaceContainer.Instance.CreateBuildingPlot(_builderManager.BuildPlotPrefab, selectedRoomBlueprint, blueprintRoomStartPositionVector, roomRotation);
                Logger.Log(Logger.Building, "Created plot for building at {0}, {1}", blueprintRoomStartPositionVector.x, blueprintRoomStartPositionVector.y);
                return(true);
            }
        }
        return(false);
    }
    public void SetupInitialRoom()
    {
        RoomBlueprint room1 = RoomBlueprint.CreateBlueprint(RoomName.Room1);

        BuildRoom(room1, new Vector2(0, 0), ObjectRotation.Rotation0);
        return;
    }
Esempio n. 3
0
    public GridLocation getDoorPositionOnBlueprint(ObjectRotation roomRotation, RoomBlueprint selectedRoomBlueprint, GridLocation door)
    {
        GridLocation rawDoorPositionOnBlueprint = door;

        switch (roomRotation)
        {
        case ObjectRotation.Rotation0:
            return(door);

        case ObjectRotation.Rotation90:
            return(new GridLocation(
                       rawDoorPositionOnBlueprint.UpLeft, //swapped axis on purpose
                       selectedRoomBlueprint.RightUpAxisLength - rawDoorPositionOnBlueprint.UpRight));

        case ObjectRotation.Rotation180:
            return(new GridLocation(
                       selectedRoomBlueprint.RightUpAxisLength - rawDoorPositionOnBlueprint.UpRight - 1,
                       selectedRoomBlueprint.LeftUpAxisLength - rawDoorPositionOnBlueprint.UpLeft));

        case ObjectRotation.Rotation270:
            return(new GridLocation(
                       selectedRoomBlueprint.LeftUpAxisLength - rawDoorPositionOnBlueprint.UpLeft, //swapped axis on purpose
                       selectedRoomBlueprint.RightUpAxisLength - rawDoorPositionOnBlueprint.UpRight));

        default:
            Logger.Error("Unknown RoomRotation given {0}", roomRotation);
            return(new GridLocation());
        }
    }
Esempio n. 4
0
        public virtual void Create(IWorld world, IRoom room, IFaction faction, RoomBlueprint roomBlueprintIfAny)
        {
            var max = roomBlueprintIfAny?.OptionalActorsMax ?? 5;

            if (max <= 0)
            {
                return;
            }

            var min = roomBlueprintIfAny?.OptionalActorsMin ?? 1;

            if (min > max)
            {
                throw new ArgumentOutOfRangeException($"OptionalActorsMin should be lower than OptionalActorsMax for room blueprint '{roomBlueprintIfAny}'");
            }

            int numberOfNpc = world.R.Next(min, max + 1);

            var pickFrom = Blueprints.Where(b => b.SuitsFaction(faction)).ToList();

            if (roomBlueprintIfAny != null)
            {
                pickFrom = pickFrom.Union(roomBlueprintIfAny.OptionalActors).ToList();
            }

            if (pickFrom.Any())
            {
                for (int i = 0; i < numberOfNpc; i++)
                {
                    Create(world, room, faction, pickFrom.GetRandom(world.R), roomBlueprintIfAny);
                }
            }
        }
Esempio n. 5
0
        public Room(Guid guid, RoomBlueprint blueprint, IArea area)
            : base(guid, blueprint.Name, blueprint.Description)
        {
            Blueprint = blueprint;
            _people   = new List <ICharacter>();
            _content  = new List <IItem>();
            Exits     = new IExit[ExitHelpers.ExitCount];

            Area = area;
            Area.AddRoom(this);
        }
Esempio n. 6
0
 public void AddRoomBlueprint(RoomBlueprint blueprint)
 {
     if (_roomBlueprints.ContainsKey(blueprint.Id))
     {
         Log.Default.WriteLine(LogLevels.Error, $"Room blueprint duplicate {blueprint.Id}!!!");
     }
     else
     {
         _roomBlueprints.Add(blueprint.Id, blueprint);
     }
 }
Esempio n. 7
0
    public void DrawAvailablePlots()
    {
        if (BuilderManager.InDeleteObjectMode)
        {
            _builderManager.DeactivateDeleteRoomMode();
        }

        RoomBlueprint selectedRoomBlueprint = _builderManager.SelectedRoom;

        BuildMenuWorldSpaceContainer.Instance.DestroyBuildingPlots();

        for (int i = 0; i < RoomManager.Rooms.Count; i++)
        {
            Room existingRoom = RoomManager.Rooms[i];
            //Logger.Log("*********************");
            //Logger.Log("");
            //Logger.Log("Start looking at next room at {0}, {1}", existingRoom.RoomCorners[Direction.Down].x, existingRoom.RoomCorners[Direction.Down].y);
            //Logger.Log("");
            //Logger.Log("*********************");
            // for each door, check if it aligns with the doors of the selected room
            for (int j = 0; j < existingRoom.Doors.Count; j++)
            {
                Door existingDoor = existingRoom.Doors[j];
                if (existingDoor.DoorConnection != null)
                {
                    continue;                                      // if the door is already activated, no need to check for new connections
                }
                bool createdPlotForDoor = false;

                // the doors that are already on the map
                GridLocation doorPositionOnExistingRoom = GridHelper.VectorToGridLocation(existingDoor.transform.position);

                createdPlotForDoor = TryBuildPlot(ObjectRotation.Rotation0, selectedRoomBlueprint, doorPositionOnExistingRoom);
                if (!createdPlotForDoor)
                {
                    createdPlotForDoor = TryBuildPlot(ObjectRotation.Rotation90, selectedRoomBlueprint, doorPositionOnExistingRoom);
                }
                if (!createdPlotForDoor)
                {
                    createdPlotForDoor = TryBuildPlot(ObjectRotation.Rotation180, selectedRoomBlueprint, doorPositionOnExistingRoom);
                }
                if (!createdPlotForDoor)
                {
                    TryBuildPlot(ObjectRotation.Rotation270, selectedRoomBlueprint, doorPositionOnExistingRoom);
                }
            }
        }

        //Initial room space to avoid an empty map.
        if (RoomManager.Rooms.Count == 0)
        {
            BuildMenuWorldSpaceContainer.Instance.CreateBuildingPlot(_builderManager.BuildPlotPrefab, selectedRoomBlueprint, new Vector2(0, 0), ObjectRotation.Rotation0);
        }
    }
Esempio n. 8
0
        public IRoom AddRoom(Guid guid, RoomBlueprint blueprint, IArea area)
        {
            if (blueprint == null)
            {
                throw new ArgumentNullException(nameof(blueprint));
            }
            IRoom room = new Room.Room(Guid.NewGuid(), blueprint, area);

            _rooms.Add(room);
            return(room);
        }
    // NOTE: Make sure icon is rectengular and has the room starting at the bottom
    public Vector2 GetPointerImageSize(RoomBlueprint blueprint, Image pointerImage)
    {
        float tileLength = 5f;                                                                      // distance to go horizontal or vertical to get to next tile row or column
        float roomWidth  = tileLength * (blueprint.LeftUpAxisLength + blueprint.RightUpAxisLength); // the width in tiles on the map of a room

        float defaultScreenFactor       = 1280;
        float pixelMultiplicationFactor = defaultScreenFactor / Screen.width;
        float roomScreenWidth           = (Camera.main.WorldToScreenPoint(new Vector2(roomWidth * pixelMultiplicationFactor, 0)) - Camera.main.WorldToScreenPoint(new Vector2(0, 0))).x; // the width on the screen of the blueprint. The hover image should have this width as well.

        return(new Vector2(roomScreenWidth, roomScreenWidth));
    }
Esempio n. 10
0
    // check all tiles where the plot would be drawn if the building tile is available. Only draw a plot when all tiles are available
    public bool GetPlotIsAvailable(RoomBlueprint roomBlueprint, Vector2 roomStartingPoint, ObjectRotation roomRotation)
    {
        int rightUpAxisLength = roomRotation == ObjectRotation.Rotation0 || roomRotation == ObjectRotation.Rotation180 ?
                                roomBlueprint.RightUpAxisLength : roomBlueprint.LeftUpAxisLength;
        int leftUpAxisLength = roomRotation == ObjectRotation.Rotation0 || roomRotation == ObjectRotation.Rotation180 ?
                               roomBlueprint.LeftUpAxisLength : roomBlueprint.RightUpAxisLength;
        Vector2 plotLocationStartingPoint = GridHelper.GridToVectorLocation(roomStartingPoint, 0, 0);
        Vector2 point1 = GridHelper.GridToVectorLocation(plotLocationStartingPoint, rightUpAxisLength, 0);
        Vector2 point2 = GridHelper.GridToVectorLocation(point1, 0, -leftUpAxisLength);
        Vector2 point3 = GridHelper.GridToVectorLocation(point2, -rightUpAxisLength, 0);

        List <BuildingTile> roomSquareTiles = _builderManager.BuildingTiles.FindAll(tile =>
                                                                                    tile.StartingPoint.x >= point3.x &&
                                                                                    tile.StartingPoint.x <= point1.x &&
                                                                                    tile.StartingPoint.y <= point2.y &&
                                                                                    tile.StartingPoint.y >= plotLocationStartingPoint.y
                                                                                    );

        BuildingTile startingTile = roomSquareTiles.FirstOrDefault(t => t.StartingPoint == plotLocationStartingPoint);

        if (startingTile.IsAvailable == Availability.Unavailable)
        {
            return(false);
        }

        bool isAvailable = true;

        for (int i = 0; i <= rightUpAxisLength - 3; i += 3)
        {
            for (int j = 0; j <= leftUpAxisLength - 3; j += 3)
            {
                BuildingTile tile = GetBuildingTileForAvailability(i, j, plotLocationStartingPoint, roomSquareTiles);

                //if (i == 0 || i == rightUpAxisLength || j == 0 || j == leftUpAxisLength)
                //{
                //    // skip tiles that are at the edge because they may overlap with the walls of adjacent rooms
                //    continue;
                //}

                if (tile == null)
                {
                    Logger.Error(Logger.Building, "Could not find tile at {0}", GridHelper.GridToVectorLocation(plotLocationStartingPoint, i, -j));
                }

                if (tile.IsAvailable == Availability.Unavailable)
                {
                    isAvailable = false;
                    break;
                }
            }
        }

        return(isAvailable);
    }
Esempio n. 11
0
    public void CreateBuildingPlot(GameObject buildingPlot, RoomBlueprint roomBlueprint, Vector2 startingPoint, ObjectRotation roomRotation)
    {
        if (BuilderManager.Instance.BuildingPlots.ContainsKey(startingPoint))
        {
            return;
        }

        BuildingPlot plot = Instantiate(buildingPlot, transform).GetComponent <BuildingPlot>();

        BuilderManager.Instance.BuildingPlots.Add(startingPoint, plot);
        //Logger.Log("The starting points for this plot should be {0}", startingPoint);

        plot.Setup(roomBlueprint, startingPoint, roomRotation);
    }
    public void LoadBuildMenuContent(BuildMenuTabType buildMenuTabType)
    {
        // TODO: add GOs for all items for the current build menu tab
        // TODO: Should also present an updated version of which items the player can actually build (based on level/money/tech)

        if (buildMenuTabType == BuildMenuTabType.Rooms)
        {
            for (int i = 0; i < BuilderManager.Instance.RegisteredRooms.Count; i++)
            {
                RoomName      roomName = BuilderManager.Instance.RegisteredRooms[i];
                RoomBlueprint room     = RoomBlueprint.CreateBlueprint(roomName);
                LoadBuildMenuItem(room);
            }
        }
    }
Esempio n. 13
0
        public void TestOptionalItemsMax_BadRange()
        {
            var blue = new RoomBlueprint()
            {
                OptionalItemsMax = 10,
                OptionalItemsMin = 16,
                OptionalItems    = new [] { new ItemBlueprint()
                                            {
                                                Name = "Spade"
                                            } }
            };
            var w = new World();

            Assert.Throws <ArgumentOutOfRangeException>(() => w.RoomFactory.Create(w, blue));
        }
    public void OnPointerClick(PointerEventData eventData)
    {
        if (GameManager.Instance.CurrentPlatform == Platform.PC)
        {
            BuilderManager.Instance.DeleteAllTriggers();

            RoomBlueprint blueprint = BuildItemTile.BuildItemBlueprint as RoomBlueprint;
            BuilderManager.Instance.SetSelectedRoom(blueprint);
            Sprite roomIcon = MainCanvas.GetRoomIcon(blueprint.Name, ObjectRotation.Rotation0);

            RectTransform rectTransform = (RectTransform)transform;
            MainCanvas.Instance.SetNewPointerImage(roomIcon, new Vector2(rectTransform.rect.width, rectTransform.rect.height));

            BuilderManager.Instance.DrawAvailablePlots();
        }
    }
    public void Setup(RoomBlueprint room, Vector2 startingPoint, ObjectRotation roomRotation)
    {
        if (BuilderManager.Instance.BuildingPlotLocations.ContainsValue(startingPoint))
        {
            return;
        }

        PlotRotation  = roomRotation;
        RoomBlueprint = room;
        StartingPoint = new Vector3(startingPoint.x, startingPoint.y, 1);

        double rightUpAxisLength = PlotRotation == ObjectRotation.Rotation0 || PlotRotation == ObjectRotation.Rotation180 ? room.RightUpAxisLength : room.LeftUpAxisLength;
        double leftUpAxisLength  = PlotRotation == ObjectRotation.Rotation0 || PlotRotation == ObjectRotation.Rotation180 ? room.LeftUpAxisLength : room.RightUpAxisLength;

        // == counter clockwise, starting at bottom
        Vector2 point1 = GridHelper.GridToVectorLocation(StartingPoint, (int)rightUpAxisLength, 0);
        Vector2 point2 = GridHelper.GridToVectorLocation(point1, 0, (int)-leftUpAxisLength);
        Vector2 point3 = GridHelper.GridToVectorLocation(point2, (int)-rightUpAxisLength, 0);

        SetColliderPath(new Vector2[] { StartingPoint, point1, point2, point3, StartingPoint });

        double midpointRightUpAxisLength = rightUpAxisLength / 2;
        double midpointLeftUpAxisLength  = leftUpAxisLength / 2;

        if (rightUpAxisLength / 2 - Math.Truncate(rightUpAxisLength / 2) != 0)
        {
            midpointRightUpAxisLength += 1.5f;
        }
        if (leftUpAxisLength / 2 - Math.Truncate(leftUpAxisLength / 2) != 0)
        {
            midpointLeftUpAxisLength -= 1.5f;
        }

        Vector2 midGridPoint = GridHelper.GridToVectorLocation(
            StartingPoint,
            (int)midpointRightUpAxisLength,
            -(int)midpointLeftUpAxisLength
            );

        if (!BuilderManager.Instance.BuildingPlotLocations.ContainsKey(midGridPoint))
        {
            BuilderManager.Instance.BuildingPlotLocations.Add(midGridPoint, StartingPoint);
        }

        CreateMesh(new Vector2[] { StartingPoint, point1, point2, point3 });
    }
Esempio n. 16
0
        public void TestOptionalItemsMax_Zero()
        {
            var blue = new RoomBlueprint()
            {
                OptionalItemsMax = 0,
                OptionalItems    = new [] { new ItemBlueprint()
                                            {
                                                Name = "Spade"
                                            } }
            };
            var w = new World();

            var room = w.RoomFactory.Create(w, blue);

            w.Map.Add(new Point3(0, 0, 0), room);

            Assert.IsEmpty(room.Items.ToArray());
        }
Esempio n. 17
0
        public void FixedLocationRooms()
        {
            var start = new RoomBlueprint()
            {
                Name          = "Start",
                FixedLocation = new Point3(0, 0, 0)
            };
            var west = new RoomBlueprint()
            {
                Name          = "West",
                FixedLocation = new Point3(-1, 0, 0)
            };

            var f = new RoomFactory()
            {
                Blueprints = new List <RoomBlueprint> {
                    start, west
                }
            };

            var world = new World();

            world.RoomFactory = f;
            var room = world.RoomFactory.Create(world, new Point3(0, 0, 0));

            world.Map.Add(new Point3(0, 0, 0), room);
            new You("Test Wanderer", room);

            Assert.AreEqual("Start", world.Player.CurrentLocation.Name);

            //go north
            var stack = new ActionStack();

            stack.RunStack(world, GetUI(Direction.North), new LeaveAction(world.Player), world.Player, new IBehaviour[0]);
            Assert.AreEqual("Empty Room", world.Player.CurrentLocation.Name);

            //go west
            stack.RunStack(world, GetUI(Direction.West), new LeaveAction(world.Player), world.Player, new IBehaviour[0]);
            Assert.AreEqual("Empty Room", world.Player.CurrentLocation.Name);

            //go south
            stack.RunStack(world, GetUI(Direction.South), new LeaveAction(world.Player), world.Player, new IBehaviour[0]);
            Assert.AreEqual("West", world.Player.CurrentLocation.Name);
        }
Esempio n. 18
0
        public void TestOptionalItemsMax_High()
        {
            var blue = new RoomBlueprint()
            {
                OptionalItemsMin = 10,
                OptionalItemsMax = 10,
                OptionalItems    = new [] { new ItemBlueprint()
                                            {
                                                Name = "Spade"
                                            } }
            };
            var w = new World();

            var room = w.RoomFactory.Create(w, blue);

            w.Map.Add(new Point3(0, 0, 0), room);

            Assert.AreEqual(room.Items.Count(), 10);
        }
    private Vector2 getPointerImageOffset(RoomBlueprint blueprint)
    {
        Vector2 offset = new Vector2(0, 0);

        switch (blueprint.RoomName)
        {
        case RoomName.Hallway:
            offset.x = TileSizeInUnits.x / 2f;
            offset.y = TileSizeInUnits.y / 2f;
            break;

        case RoomName.Room1:
            offset.x = TileSizeInUnits.x / 4f;
            if (_rotationRoomOnLastHover == ObjectRotation.Rotation0 || _rotationRoomOnLastHover == ObjectRotation.Rotation180)
            {
                offset.y = TileSizeInUnits.y;
            }
            else
            {
                offset.y = TileSizeInUnits.y * 1.5f;
            }
            break;

        case RoomName.RecordingStudio1:
            offset.x = TileSizeInUnits.x / 4f;
            if (_rotationRoomOnLastHover == ObjectRotation.Rotation0 || _rotationRoomOnLastHover == ObjectRotation.Rotation180)
            {
                offset.y = TileSizeInUnits.y * 0.5f;
            }
            else
            {
                offset.y = TileSizeInUnits.y * 1f;
            }
            break;

        default:
            Logger.Warning("Image offset not implemented for {0}", blueprint.RoomName);
            break;
        }
        return(offset);
    }
Esempio n. 20
0
    public void BuildRoom(RoomBlueprint roomBlueprint, BuildingTileBuilder buildingTileBuilder, BuildingPlotBuilder buildingPlotBuilder, Vector2 startingPoint, ObjectRotation roomRotation)
    {
        GameObject roomGO = GameManager.Instance.InstantiatePrefab(BuilderManager.Instance.RegisteredRoomPrefabs[roomBlueprint.RoomName][roomRotation], BuilderManager.Instance.RoomsContainer.transform, startingPoint);

        Room room = roomGO.GetComponent <Room>();

        room.RoomRotation  = roomRotation;
        room.RoomBlueprint = roomBlueprint;
        room.Initialise();
        room.RoomObjectsContainer.InitialiseRoomObjects();
        RoomManager.Instance.AddRoom(room);

        int rightUpAxisLength = roomRotation == ObjectRotation.Rotation0 || roomRotation == ObjectRotation.Rotation180 ?
                                roomBlueprint.RightUpAxisLength : roomBlueprint.LeftUpAxisLength;
        int leftUpAxisLength = roomRotation == ObjectRotation.Rotation0 || roomRotation == ObjectRotation.Rotation180 ?
                               roomBlueprint.LeftUpAxisLength : roomBlueprint.RightUpAxisLength;

        Vector2 point1 = GridHelper.GridToVectorLocation(startingPoint, rightUpAxisLength, 0);
        Vector2 point2 = GridHelper.GridToVectorLocation(point1, 0, -leftUpAxisLength);
        Vector2 point3 = GridHelper.GridToVectorLocation(point2, -rightUpAxisLength, 0);

        Dictionary <Direction, Vector2> roomCorners = new Dictionary <Direction, Vector2>()
        {
            { Direction.Down, startingPoint },
            { Direction.Right, point1 },
            { Direction.Up, point2 },
            { Direction.Left, point3 },
        };

        room.SetupCorners(roomCorners);
        room.SetupCollider();
        room.SetGraphUpdateScenePoints();

        // the sprites should already be part of the room prefab. The scripts should be on the sprites. But on start() of the room, all scripts should be initalised and added to the room's []
        //room.SetupRoomObjects();

        buildingTileBuilder.UpdateBuildingTiles(room);

        FollowUpRoomBuilding(roomBlueprint, roomCorners, buildingPlotBuilder);
        room.UpdateRoomNavhMesh();
    }
Esempio n. 21
0
        public void TestReveal(bool alreadyExisted)
        {
            var start = new RoomBlueprint()
            {
                Name          = "Start",
                FixedLocation = new Point3(0, 0, 0)
            };
            var west = new RoomBlueprint()
            {
                Name          = "West",
                FixedLocation = new Point3(-1, 0, 0)
            };

            var f = new RoomFactory()
            {
                Blueprints = new List <RoomBlueprint> {
                    start, west
                }
            };

            var world = new World();

            world.RoomFactory = f;
            var room = world.RoomFactory.Create(world, new Point3(0, 0, 0));

            world.Map.Add(new Point3(0, 0, 0), room);

            if (alreadyExisted)
            {
                world.Map.Add(new Point3(-1, 0, 0), world.GetNewRoom(new Point3(-1, 0, 0)));
                Assert.IsFalse(world.Map[new Point3(-1, 0, 0)].IsExplored);
            }
            else
            {
                Assert.IsFalse(world.Map.ContainsKey(new Point3(-1, 0, 0)));
            }

            world.Reveal(new Point3(-1, 0, 0));
            Assert.IsTrue(world.Map[new Point3(-1, 0, 0)].IsExplored);
        }
    void Awake()
    {
        Instance                 = this;
        InBuildMode              = false;
        InDeleteObjectMode       = false;
        PointerIsOnAvailablePlot = false;

        SelectedRoom = null;

        //Guard.CheckIsNull(Room1Prefab, "Room1Prefab");
        Guard.CheckIsNull(BuildPlotPrefab, "BuildPlotPrefab");
        Guard.CheckIsNull(RoomsContainer, "RoomsContainer");
        Guard.CheckIsNull(BuildHallwayTriggerPrefab, "BuildHallwayTriggerPrefab");
        Guard.CheckIsNull(DeleteRoomTriggerPrefab, "DeleteRoomTriggerPrefab");

        BuildingPlots.Clear();
        BuildingPlotLocations.Clear();

        //////////////////
        // Room prefabs
        //////////////////

        RegisterRooms();
        LoadRoomPrefabs();

        //////////////////
        // Room object prefabs
        //////////////////

        RegisterPlaceableRoomObjects();
        LoadPlaceableRoomObjects();



        _buildingPlotBuilder = new BuildingPlotBuilder();
        _buildingTileBuilder = new BuildingTileBuilder();
        _roomBuilder         = new RoomBuilder();
        _roomObjectBuilder   = new RoomObjectBuilder();
    }
Esempio n. 23
0
        public void Create(IWorld world, Room room, IFaction faction, RoomBlueprint roomBlueprintIfAny)
        {
            var max = roomBlueprintIfAny?.OptionalItemsMax ?? 5;

            if (max <= 0)
            {
                return;
            }

            var min = roomBlueprintIfAny?.OptionalItemsMin ?? 1;

            if (min > max)
            {
                throw new ArgumentOutOfRangeException($"OptionalItemsMin should be lower than OptionalItemsMax for room blueprint '{roomBlueprintIfAny}'");
            }

            int numberOfItems = world.R.Next(min, max + 1);

            var pickFrom = world.ItemFactory.Blueprints.Where(b => b.SuitsFaction(faction)).ToList();

            if (roomBlueprintIfAny?.OptionalItems != null)
            {
                pickFrom = pickFrom.Union(roomBlueprintIfAny.OptionalItems).ToList();
            }


            //create some random items
            for (int i = 0; i < numberOfItems; i++)
            {
                var item = pickFrom.GetRandom(world.R);

                //could be no blueprints
                if (item != null)
                {
                    room.SpawnItem(item);
                }
            }
        }
    public override bool Test(ConditionData data)
    {
        RoomBlueprint     blueprint     = data.blueprint;
        HashSet <Vector3> wallsVoxelMap = blueprint.WallsVoxelMap;

        Vector3 randomFloorVoxelPos = data.randomFloorVoxelPos;

        Quaternion edgeRotation = EndPoint.GetRoation(data.endPointDirection);

        float   itemLength           = owner.Volume.generatorSize.x;
        Vector3 horizontalEdgeOffset = EndPoint.GetRoation(data.endPointDirection) * new Vector3(itemLength, 0f, 0f);

        float itemHeight = owner.Volume.generatorSize.z;

        for (float i = 0; i < itemHeight; i++)
        {
            Vector3 verticalEdgeOffset = EndPoint.GetRoation(data.endPointDirection) * new Vector3(0f, 0f, i);

            Vector3 wallVoxelPosition = randomFloorVoxelPos + horizontalEdgeOffset + verticalEdgeOffset;
            wallVoxelPosition = wallVoxelPosition.RoundVec3ToInt();

            if (wallsVoxelMap.Contains(wallVoxelPosition))
            {
                GameObject wallVoxelGO = data.blueprint.GetWallVoxelGO(wallVoxelPosition);

                Vector3 directionsDifference = horizontalEdgeOffset + wallVoxelGO.transform.right;

                if (directionsDifference == Vector3.zero)
                {
                    return(false);
                }
            }
        }

        return(true);
    }
Esempio n. 25
0
    public void FollowUpRoomBuilding(RoomBlueprint roomBlueprint, Dictionary <Direction, Vector2> roomCorners, BuildingPlotBuilder buildingPlotBuilder)
    {
        switch (roomBlueprint.RoomName)
        {
        case RoomName.Hallway:
            // create follow up icons for longer hallways
            Vector2 pointLeftUp    = roomCorners[Direction.Left];
            Vector2 pointLeftDown  = GridHelper.GridToVectorLocation(roomCorners[Direction.Down], -3, 0);
            Vector2 pointRightDown = GridHelper.GridToVectorLocation(roomCorners[Direction.Down], 0, 3);
            Vector2 pointRightUp   = roomCorners[Direction.Right];

            if (buildingPlotBuilder.GetPlotIsAvailable(roomBlueprint, pointLeftUp, ObjectRotation.Rotation0))
            {
                CreateBuildHallwayTrigger(pointLeftUp, ObjectDirection.LeftUp);
            }

            if (buildingPlotBuilder.GetPlotIsAvailable(roomBlueprint, pointLeftDown, ObjectRotation.Rotation0))
            {
                CreateBuildHallwayTrigger(pointLeftDown, ObjectDirection.LeftDown);
            }

            if (buildingPlotBuilder.GetPlotIsAvailable(roomBlueprint, pointRightDown, ObjectRotation.Rotation0))
            {
                CreateBuildHallwayTrigger(pointRightDown, ObjectDirection.RightDown);
            }

            if (buildingPlotBuilder.GetPlotIsAvailable(roomBlueprint, pointRightUp, ObjectRotation.Rotation0))
            {
                CreateBuildHallwayTrigger(pointRightUp, ObjectDirection.RightUp);
            }
            break;

        default:
            break;
        }
    }
Esempio n. 26
0
        //private static void TestSecondWindow()
        //{
        //    ProcessStartInfo psi = new ProcessStartInfo("cmd.exe")
        //    {
        //        RedirectStandardError = true,
        //        RedirectStandardInput = true,
        //        RedirectStandardOutput = true,
        //        UseShellExecute = false,
        //        CreateNoWindow = true,
        //        WindowStyle = ProcessWindowStyle.Normal
        //    };

        //    Process p = Process.Start(psi);

        //    StreamWriter sw = p.StandardInput;
        //    StreamReader sr = p.StandardOutput;

        //    sw.WriteLine("Hello world!");
        //    sr.Close();
        //}

        private static void CreateDummyWorld()
        {
            // Blueprints
            // Rooms
            RoomBlueprint room1Blueprint = new RoomBlueprint
            {
                Id          = 1,
                Name        = "room1",
                Description = "My first room"
            };
            RoomBlueprint room2Blueprint = new RoomBlueprint
            {
                Id          = 2,
                Name        = "room2",
                Description = "My second room"
            };
            // Characters
            CharacterBlueprint mob2Blueprint = new CharacterBlueprint
            {
                Id               = 2,
                Name             = "mob2",
                ShortDescription = "Second mob (female)",
                Description      = "Second mob (female) is here",
                Sex              = Sex.Female,
                Level            = 10
            };
            CharacterBlueprint mob3Blueprint = new CharacterBlueprint
            {
                Id               = 3,
                Name             = "mob3",
                ShortDescription = "Third mob (male)",
                Description      = "Third mob (male) is here",
                Sex              = Sex.Male,
                Level            = 10
            };
            CharacterBlueprint mob4Blueprint = new CharacterBlueprint
            {
                Id               = 4,
                Name             = "mob4",
                ShortDescription = "Fourth mob (neutral)",
                Description      = "Fourth mob (neutral) is here",
                Sex              = Sex.Neutral,
                Level            = 10
            };
            CharacterBlueprint mob5Blueprint = new CharacterBlueprint
            {
                Id               = 5,
                Name             = "mob5",
                ShortDescription = "Fifth mob (female)",
                Description      = "Fifth mob (female) is here",
                Sex              = Sex.Female,
                Level            = 10
            };
            ItemContainerBlueprint item1Blueprint = new ItemContainerBlueprint
            {
                Id               = 1,
                Name             = "item1",
                ShortDescription = "First item (container)",
                Description      = "The first item (container) has been left here.",
                ItemCount        = 10,
                WeightMultiplier = 100
            };
            ItemWeaponBlueprint item2Blueprint = new ItemWeaponBlueprint
            {
                Id               = 2,
                Name             = "item2",
                ShortDescription = "Second item (weapon)",
                Description      = "The second item (weapon) has been left here.",
                Type             = WeaponTypes.Axe1H,
                DiceCount        = 10,
                DiceValue        = 20,
                DamageType       = SchoolTypes.Fire,
                WearLocation     = WearLocations.Wield
            };
            ItemArmorBlueprint item3Blueprint = new ItemArmorBlueprint
            {
                Id               = 3,
                Name             = "item3",
                ShortDescription = "Third item (armor|feet)",
                Description      = "The third item (armor|feet) has been left here.",
                Armor            = 100,
                ArmorKind        = ArmorKinds.Mail,
                WearLocation     = WearLocations.Feet
            };
            ItemLightBlueprint item4Blueprint = new ItemLightBlueprint
            {
                Id               = 4,
                Name             = "item4",
                ShortDescription = "Fourth item (light)",
                Description      = "The fourth item (light) has been left here.",
                DurationHours    = -1,
                WearLocation     = WearLocations.Light
            };
            ItemWeaponBlueprint item5Blueprint = new ItemWeaponBlueprint
            {
                Id               = 5,
                Name             = "item5",
                ShortDescription = "Fifth item (weapon)",
                Description      = "The fifth item (weapon) has been left here.",
                Type             = WeaponTypes.Sword1H,
                DiceCount        = 5,
                DiceValue        = 40,
                DamageType       = SchoolTypes.Physical,
                WearLocation     = WearLocations.Wield
            };

            //
            ServerOptions.CorpseBlueprint = new ItemCorpseBlueprint();

            // World
            IArea midgaard = DependencyContainer.Instance.GetInstance <IWorld>().Areas.FirstOrDefault(x => x.DisplayName == "Midgaard");
            IRoom room1    = DependencyContainer.Instance.GetInstance <IWorld>().AddRoom(Guid.NewGuid(), room1Blueprint, midgaard);
            IRoom room2    = DependencyContainer.Instance.GetInstance <IWorld>().AddRoom(Guid.NewGuid(), room2Blueprint, midgaard);

            DependencyContainer.Instance.GetInstance <IWorld>().AddExit(room1, room2, null, ExitDirections.North);
            DependencyContainer.Instance.GetInstance <IWorld>().AddExit(room2, room1, null, ExitDirections.North);

            //ICharacter mob1 = DependencyContainer.Instance.GetInstance<IWorld>().AddCharacter(Guid.NewGuid(), "Mob1", Repository.ClassManager["Mage"], Repository.RaceManager["Troll"], Sex.Male, room1); // playable
            ICharacter mob2 = DependencyContainer.Instance.GetInstance <IWorld>().AddCharacter(Guid.NewGuid(), mob2Blueprint, room1);
            ICharacter mob3 = DependencyContainer.Instance.GetInstance <IWorld>().AddCharacter(Guid.NewGuid(), mob3Blueprint, room2);
            ICharacter mob4 = DependencyContainer.Instance.GetInstance <IWorld>().AddCharacter(Guid.NewGuid(), mob4Blueprint, room2);
            ICharacter mob5 = DependencyContainer.Instance.GetInstance <IWorld>().AddCharacter(Guid.NewGuid(), mob5Blueprint, room2);

            IItemContainer item1     = DependencyContainer.Instance.GetInstance <IWorld>().AddItemContainer(Guid.NewGuid(), item1Blueprint, room1);
            IItemContainer item1Dup1 = DependencyContainer.Instance.GetInstance <IWorld>().AddItemContainer(Guid.NewGuid(), item1Blueprint, room2);
            IItemWeapon    item2     = DependencyContainer.Instance.GetInstance <IWorld>().AddItemWeapon(Guid.NewGuid(), item2Blueprint, mob2);
            IItemArmor     item3     = DependencyContainer.Instance.GetInstance <IWorld>().AddItemArmor(Guid.NewGuid(), item3Blueprint, item1Dup1);
            //IItemLight item4 = DependencyContainer.Instance.GetInstance<IWorld>().AddItemLight(Guid.NewGuid(), item4Blueprint, mob1);
            //IItemWeapon item5 = DependencyContainer.Instance.GetInstance<IWorld>().AddItemWeapon(Guid.NewGuid(), item5Blueprint, mob1);
            //IItemContainer item1Dup2 = DependencyContainer.Instance.GetInstance<IWorld>().AddItemContainer(Guid.NewGuid(), item1Blueprint, mob1);
            IItemArmor item3Dup1 = DependencyContainer.Instance.GetInstance <IWorld>().AddItemArmor(Guid.NewGuid(), item3Blueprint, mob3);
            IItemLight item4Dup1 = DependencyContainer.Instance.GetInstance <IWorld>().AddItemLight(Guid.NewGuid(), item4Blueprint, mob4);

            // Equip weapon on mob2
            mob2.Equipments.FirstOrDefault(x => x.Slot == EquipmentSlots.Wield).Item = item2;
            item2.ChangeContainer(null);
            item2.ChangeEquipedBy(mob2);
        }
Esempio n. 27
0
        private static void TestCommandParsing()
        {
            // server doesn't need to be started, we are not testing real runtime but basic commands
            IArea area = DependencyContainer.Instance.GetInstance <IWorld>().AddArea(Guid.NewGuid(), "testarea", 1, 99, "SinaC", "Credits");
            // Blueprints
            RoomBlueprint room1Blueprint = new RoomBlueprint
            {
                Id          = 1,
                Name        = "room1",
                Description = "My first room"
            };
            // World
            IRoom room = DependencyContainer.Instance.GetInstance <IWorld>().AddRoom(Guid.NewGuid(), room1Blueprint, area);

            IPlayer player = DependencyContainer.Instance.GetInstance <IServer>().AddPlayer(new ConsoleClient("Player"), "Player");

            player.ProcessCommand("test");
            player.ProcessCommand("test arg1");
            player.ProcessCommand("test 'arg1' 'arg2' 'arg3' 'arg4'");
            player.ProcessCommand("test 'arg1 arg2' 'arg3 arg4'");
            player.ProcessCommand("test 'arg1 arg2\" arg3 arg4");
            player.ProcessCommand("test 3.arg1");
            player.ProcessCommand("test 2.'arg1'");
            player.ProcessCommand("test 2'.arg1'");
            player.ProcessCommand("test 2.'arg1 arg2' 3.arg3 5.arg4");
            player.ProcessCommand("test 2."); // INVALID
            player.ProcessCommand("test .");  // INVALID
            player.ProcessCommand("test '2.arg1'");
            player.ProcessCommand("unknown"); // INVALID
            player.ProcessCommand("/test");

            ICharacter character = DependencyContainer.Instance.GetInstance <IWorld>().AddCharacter(Guid.NewGuid(), new CharacterData
            {
                Name       = "toto",
                Class      = DependencyContainer.Instance.GetInstance <IClassManager>()["Mage"].Name,
                Race       = DependencyContainer.Instance.GetInstance <IRaceManager>()["Troll"].Name,
                Sex        = Sex.Male,
                Level      = 1,
                Experience = 0,
                RoomId     = room.Blueprint.Id
            }, room);

            character.ProcessCommand("look");
            character.ProcessCommand("tell");     // INVALID because Player commands are not accessible by Character
            character.ProcessCommand("unknown");  // INVALID

            player.ProcessCommand("impersonate"); // impossible but doesn't cause an error log to un-impersonate, player must already be impersonated
            player.ProcessCommand("impersonate character");
            player.ProcessCommand("/tell");
            player.ProcessCommand("tell"); // INVALID because OOG is not accessible while impersonating unless if command starts with /
            player.ProcessCommand("look");

            player.ProcessCommand("impersonate"); // INVALID because OOG is not accessible while impersonating unless if command starts with /
            player.ProcessCommand("/impersonate");
            player.ProcessCommand("/tell");
            player.ProcessCommand("tell");
            player.ProcessCommand("look"); // INVALID because Character commands are not accessible by Player unless if impersonating

            IAdmin admin = DependencyContainer.Instance.GetInstance <IServer>().AddAdmin(new ConsoleClient("Admin"), "Admin");

            admin.ProcessCommand("incarnate");
            admin.ProcessCommand("unknown"); // INVALID
        }
Esempio n. 28
0
        private static void CreateMidgaard()
        {
            MysteryImporter importer = new MysteryImporter();

            importer.Load(@"D:\GitHub\OldMud\area\midgaard.are");
            importer.Parse();
            //MysteryImporter importer = new MysteryImporter();
            //string path = @"D:\GitHub\OldMud\area";
            //string fileList = Path.Combine(path, "area.lst");
            //string[] areaFilenames = File.ReadAllLines(fileList);
            //foreach (string areaFilename in areaFilenames)
            //{
            //    if (areaFilename.Contains("$"))
            //        break;
            //    string areaFullName = Path.Combine(path, areaFilename);
            //    importer.Load(areaFullName);
            //    importer.Parse();
            //}

            Dictionary <int, IArea> areasByVnums = new Dictionary <int, IArea>();
            Dictionary <int, IRoom> roomsByVNums = new Dictionary <int, IRoom>();

            // Create Areas
            foreach (AreaData importedArea in importer.Areas)
            {
                // TODO: levels
                IArea area = DependencyContainer.Instance.GetInstance <IWorld>().AddArea(Guid.NewGuid(), importedArea.Name, 1, 99, importedArea.Builders, importedArea.Credits);
                areasByVnums.Add(importedArea.VNum, area);
            }

            // Create Rooms
            foreach (RoomData importedRoom in importer.Rooms)
            {
                IArea         area          = areasByVnums[importedRoom.AreaVnum];
                RoomBlueprint roomBlueprint = new RoomBlueprint
                {
                    Id          = importedRoom.VNum,
                    Name        = importedRoom.Name,
                    Description = importedRoom.Description,
                };
                IRoom room = DependencyContainer.Instance.GetInstance <IWorld>().AddRoom(Guid.NewGuid(), roomBlueprint, area);
                roomsByVNums.Add(importedRoom.VNum, room);
            }
            // Create Exits
            foreach (RoomData room in importer.Rooms)
            {
                for (int i = 0; i < RoomData.MaxExits - 1; i++)
                {
                    ExitData exit = room.Exits[i];
                    if (exit != null)
                    {
                        IRoom from;
                        roomsByVNums.TryGetValue(room.VNum, out from);
                        IRoom to;
                        roomsByVNums.TryGetValue(exit.DestinationVNum, out to);
                        if (from == null)
                        {
                            Log.Default.WriteLine(LogLevels.Error, "Origin room not found for vnum {0}", room.VNum);
                        }
                        else if (to == null)
                        {
                            Log.Default.WriteLine(LogLevels.Error, "Destination room not found for vnum {0}", room.VNum);
                        }
                        else
                        {
                            DependencyContainer.Instance.GetInstance <IWorld>().AddExit(from, to, null, (ExitDirections)i);
                        }
                    }
                }
            }
            //// Handle resets
            //foreach (RoomData importedRoom in importer.Rooms.Where(x => x.Resets.Any()))
            //{
            //    IRoom room;
            //    roomsByVNums.TryGetValue(importedRoom.VNum, out room);
            //    foreach (ResetData reset in importedRoom.Resets)
            //    {
            //        switch (reset.Command)
            //        {
            //            case 'M':
            //                MobileData mob = importer.Mobiles.FirstOrDefault(x => x.VNum == reset.Arg1);
            //                if (mob != null)
            //                    DependencyContainer.Instance.GetInstance<IWorld>().AddCharacter(Guid.NewGuid(), mob.Name, room);
            //                break;
            //            case 'O':
            //                ObjectData obj = importer.Objects.FirstOrDefault(x => x.VNum == reset.Arg1);
            //                if (obj != null) // TODO: itemType
            //                    DependencyContainer.Instance.GetInstance<IWorld>().AddItemContainer(Guid.NewGuid(), obj.Name, room);
            //                break;
            //            // TODO: other command  P, E, G, D, R, Z
            //        }
            //    }
            //}

            CharacterBlueprint mob2Blueprint = new CharacterBlueprint
            {
                Id               = 2,
                Name             = "mob2",
                ShortDescription = "Second mob (female)",
                Description      = "Second mob (female) is here",
                Sex              = Sex.Female,
                Level            = 10
            };
            CharacterBlueprint mob3Blueprint = new CharacterBlueprint
            {
                Id               = 3,
                Name             = "mob3",
                ShortDescription = "Third mob (male)",
                Description      = "Third mob (male) is here",
                Sex              = Sex.Male,
                Level            = 10
            };
            CharacterBlueprint mob4Blueprint = new CharacterBlueprint
            {
                Id               = 4,
                Name             = "mob4",
                ShortDescription = "Fourth mob (neutral)",
                Description      = "Fourth mob (neutral) is here",
                Sex              = Sex.Neutral,
                Level            = 10
            };
            CharacterBlueprint mob5Blueprint = new CharacterBlueprint
            {
                Id               = 5,
                Name             = "mob5",
                ShortDescription = "Fifth mob (female)",
                Description      = "Fifth mob (female) is here",
                Sex              = Sex.Female,
                Level            = 10
            };
            ItemContainerBlueprint item1Blueprint = new ItemContainerBlueprint
            {
                Id               = 1,
                Name             = "item1",
                ShortDescription = "First item (container)",
                Description      = "The first item (container) has been left here.",
                ItemCount        = 10,
                WeightMultiplier = 100
            };
            ItemWeaponBlueprint item2Blueprint = new ItemWeaponBlueprint
            {
                Id               = 2,
                Name             = "item2",
                ShortDescription = "Second item (weapon)",
                Description      = "The second item (weapon) has been left here.",
                Type             = WeaponTypes.Axe1H,
                DiceCount        = 10,
                DiceValue        = 20,
                DamageType       = SchoolTypes.Fire,
                WearLocation     = WearLocations.Wield
            };
            ItemArmorBlueprint item3Blueprint = new ItemArmorBlueprint
            {
                Id               = 3,
                Name             = "item3",
                ShortDescription = "Third item (armor|feet)",
                Description      = "The third item (armor|feet) has been left here.",
                Armor            = 100,
                ArmorKind        = ArmorKinds.Mail,
                WearLocation     = WearLocations.Feet
            };
            ItemLightBlueprint item4Blueprint = new ItemLightBlueprint
            {
                Id               = 4,
                Name             = "item4",
                ShortDescription = "Fourth item (light)",
                Description      = "The fourth item (light) has been left here.",
                DurationHours    = -1,
                WearLocation     = WearLocations.Light
            };
            ItemWeaponBlueprint item5Blueprint = new ItemWeaponBlueprint
            {
                Id               = 5,
                Name             = "item5",
                ShortDescription = "Fifth item (weapon)",
                Description      = "The fifth item (weapon) has been left here.",
                Type             = WeaponTypes.Sword1H,
                DiceCount        = 5,
                DiceValue        = 40,
                DamageType       = SchoolTypes.Physical,
                WearLocation     = WearLocations.Wield
            };

            //
            ServerOptions.CorpseBlueprint = new ItemCorpseBlueprint();

            // Add dummy mobs and items to allow impersonate :)
            IRoom templeOfMota = DependencyContainer.Instance.GetInstance <IWorld>().Rooms.FirstOrDefault(x => x.Name.ToLower() == "the temple of mota");
            IRoom templeSquare = DependencyContainer.Instance.GetInstance <IWorld>().Rooms.FirstOrDefault(x => x.Name.ToLower() == "the temple square");

            //ICharacter mob1 = DependencyContainer.Instance.GetInstance<IWorld>().AddCharacter(Guid.NewGuid(), "mob1", Repository.ClassManager["Mage"], Repository.RaceManager["Troll"], Sex.Male, templeOfMota); // playable
            ICharacter mob2 = DependencyContainer.Instance.GetInstance <IWorld>().AddCharacter(Guid.NewGuid(), mob2Blueprint, templeOfMota);
            ICharacter mob3 = DependencyContainer.Instance.GetInstance <IWorld>().AddCharacter(Guid.NewGuid(), mob3Blueprint, templeSquare);
            ICharacter mob4 = DependencyContainer.Instance.GetInstance <IWorld>().AddCharacter(Guid.NewGuid(), mob4Blueprint, templeSquare);
            ICharacter mob5 = DependencyContainer.Instance.GetInstance <IWorld>().AddCharacter(Guid.NewGuid(), mob5Blueprint, templeSquare);

            IItemContainer item1     = DependencyContainer.Instance.GetInstance <IWorld>().AddItemContainer(Guid.NewGuid(), item1Blueprint, templeOfMota);
            IItemContainer item1Dup1 = DependencyContainer.Instance.GetInstance <IWorld>().AddItemContainer(Guid.NewGuid(), item1Blueprint, templeOfMota);
            IItemWeapon    item2     = DependencyContainer.Instance.GetInstance <IWorld>().AddItemWeapon(Guid.NewGuid(), item2Blueprint, mob2);
            IItemArmor     item3     = DependencyContainer.Instance.GetInstance <IWorld>().AddItemArmor(Guid.NewGuid(), item3Blueprint, item1Dup1);
            //IItemLight item4 = DependencyContainer.Instance.GetInstance<IWorld>().AddItemLight(Guid.NewGuid(), item4Blueprint, mob1);
            //IItemWeapon item5 = DependencyContainer.Instance.GetInstance<IWorld>().AddItemWeapon(Guid.NewGuid(), item5Blueprint, mob1);
            //IItemContainer item1Dup2 = DependencyContainer.Instance.GetInstance<IWorld>().AddItemContainer(Guid.NewGuid(), item1Blueprint, mob1);
            IItemArmor item3Dup1 = DependencyContainer.Instance.GetInstance <IWorld>().AddItemArmor(Guid.NewGuid(), item3Blueprint, mob3);
            IItemLight item4Dup1 = DependencyContainer.Instance.GetInstance <IWorld>().AddItemLight(Guid.NewGuid(), item4Blueprint, mob4);

            // Equip weapon on mob2
            mob2.Equipments.FirstOrDefault(x => x.Slot == EquipmentSlots.Wield).Item = item2;
            item2.ChangeContainer(null);
            item2.ChangeEquipedBy(mob2);
        }
Esempio n. 29
0
 public void AddRoomBlueprint(RoomBlueprint blueprint)
 {
     throw new NotImplementedException();
 }
Esempio n. 30
0
 public IRoom AddRoom(Guid guid, RoomBlueprint blueprint, IArea area)
 {
     throw new NotImplementedException();
 }