public Workshop() { Type = BuildingType.Workshop; Recipe = Recipes.GetRecipe("None"); Width = 2; Height = 2; Entrance = new BuildingEntrance(this, (0, 1), (0, 2), PathType.Driveway); }
public Core(Map map) { Input = new GlobalResourceInput(map); Width = 4; Height = 4; Entrance = new BuildingEntrance(this, (1, 3), (1, 4), PathType.Driveway); Type = BuildingType.Core; }
public TestProducer() { Width = 3; Height = 3; Output = new InfiniteDirectOutput(Item.Wood); Entrance = new BuildingEntrance(this, (1, 2), (1, 3), PathType.Driveway); Type = BuildingType.TestProducer; }
public TestConsumer() { Width = 2; Height = 2; Input = new InfiniteDirectInput(); Entrance = new BuildingEntrance(this, (0, 1), (0, 2), PathType.Driveway); Type = BuildingType.TestConsumer; }
public Smelter() { Type = BuildingType.Smelter; Input = new ItemDecider(SetItem); ProcessingTime = 2; Width = 2; Height = 2; Entrance = new BuildingEntrance(this, (1, 1), (1, 2), PathType.Driveway); }
public TrainStation(Map map) { _map = map; Width = 2; Height = 4; Input = new InfiniteDirectInput(); Output = new InfiniteDirectOutput(Item.Wood); Type = BuildingType.TrainStation; Entrance = new BuildingEntrance(this, (2, 0), (2, 3), PathType.Rail); }
public Lumbermill(Map map, IntVector pos) { Type = BuildingType.Lumbermill; Width = 2; Height = 2; Consumer = new ResourceInput(map, this, (-2, -2), 6, Item.Wood); var producer = new DirectProducer(5, 1, Item.Wood); Producer = producer; Output = producer; ProcessingTime = 1; Entrance = new BuildingEntrance(this, (0, 1), (0, 2), PathType.Driveway); }
public Mine(Map map, IntVector pos) { var item = map.GetNearestResource(pos + (Width / 2, Height / 2), 2, Item.Stone, Item.IronOre, Item.CopperOre); Type = BuildingType.Mine; Consumer = new ResourceInput(map, this, (-1, -1), 4, item); var output = new DirectProducer(5, 1, item); Output = output; Producer = output; ProcessingTime = 2; Width = 2; Height = 2; Entrance = new BuildingEntrance(this, (0, 1), (0, 2), PathType.Driveway); }
public void AddMultipleFloors(BuildingEntrance entrance, int floors) { for (int i = 0; i < floors; i++) { AddFloor(entrance, i.ToString()); } }
public async Task <BuildingEntranceAddViewModel> Post([FromBody] BuildingEntranceAddViewModel buildingEntrance) { var building = _unitOfWork.Buildings.Get(buildingEntrance.BuildingId); var owner = await _accountManager.GetUserByIdAsync(buildingEntrance.CreatorId); if (building == null || owner == null) { return(buildingEntrance); } var newEntrance = new BuildingEntrance { name = buildingEntrance.Name, CurrentBuilding = building, Apartaments = new List <Apartament>(), manager = owner }; _unitOfWork.BuildingEntrance.Add(newEntrance); _unitOfWork.SaveChanges(); buildingEntrance.Id = newEntrance.id; return(buildingEntrance); }
public void AddFloor(BuildingEntrance entrance, string floorName = "") { var floor = new BuildingFloor(); floor.buildingEntrance = entrance; floor.Name = $"Етаж {floorName}"; _unitOfWork.BuildingFloor.Add(floor); _unitOfWork.SaveChanges(); }
public void AddEntrance(Building building) { for (int i = 0; i < building.Entrances; i++) { var newEntrance = new BuildingEntrance(); newEntrance.name = $"Вход {i}"; _unitOfWork.BuildingEntrance.Add(newEntrance); } _unitOfWork.SaveChanges(); }
public void AddEntranceCascade(Building building) { for (int i = 0; i < building.Entrances; i++) { var newEntrance = new BuildingEntrance(); newEntrance.name = $"Вход {i}"; newEntrance.CurrentBuilding = building; _unitOfWork.BuildingEntrance.Add(newEntrance); _buildingFloorServices.AddMultipleFloors(newEntrance, building.Floors); } }
public void Close(bool machineClose) { if (!IsOpen) { return; } if (IsMachine && !machineClose) { return; } IsOpen = false; if (DoorSound != null) { if (Type == DoorType.Sliding) { DoorSound.Play(); } else if (Type == DoorType.Rotating) { if (SoundType == ContainerSoundType.Wood) { AudioClip clip = GameManager.Inst.SoundManager.GetClip("WoodDoorClose"); DoorSound.PlayOneShot(clip, 0.8f); } else { AudioClip clip = GameManager.Inst.SoundManager.GetClip("MetalDoorClose"); DoorSound.PlayOneShot(clip, 0.6f); } //also set navmesh obstacle to non-carve NavMeshObstacle obstacle = DoorPanel.GetComponent <NavMeshObstacle>(); obstacle.carving = false; } } BuildingEntrance entrance = GetComponent <BuildingEntrance>(); if (entrance != null) { entrance.IsActive = false; } }
public void Open(Transform opener, bool machineOpen) { if (IsOpen) { return; } if (IsMachine && !machineOpen) { return; } //check if it's locked if (IsLocked) { //here check if player has key int keyCount = GameManager.Inst.PlayerControl.SelectedPC.Inventory.CountItemsInBackpack(KeyItemID); if (keyCount > 0) { //play unlock key sound IsLocked = false; } else { //play locked door sound if (SoundType == ContainerSoundType.Wood) { AudioClip clip = GameManager.Inst.SoundManager.GetClip("WoodDoorLocked"); DoorSound.PlayOneShot(clip, 0.6f); } else { AudioClip clip = GameManager.Inst.SoundManager.GetClip("MetalDoorLocked"); DoorSound.PlayOneShot(clip, 0.6f); } return; } } IsOpen = true; if (DoorSound != null) { if (Type == DoorType.Sliding) { DoorSound.Play(); } else if (Type == DoorType.Rotating) { if (SoundType == ContainerSoundType.Wood) { AudioClip clip = GameManager.Inst.SoundManager.GetClip("WoodDoorOpen"); DoorSound.PlayOneShot(clip, 0.8f); } else { AudioClip clip = GameManager.Inst.SoundManager.GetClip("MetalDoorOpen"); DoorSound.PlayOneShot(clip, 0.6f); } } } if (Type == DoorType.Rotating) { //calculate the angle between opener-door and door-up Vector3 openerDoorLine = opener.position - transform.position; float angle = Vector3.Angle(openerDoorLine, transform.up); if (angle < 90) { _rotateTarget = OpenTarget1; } else { _rotateTarget = OpenTarget2; } //also set navmesh obstacle to carve NavMeshObstacle obstacle = DoorPanel.GetComponent <NavMeshObstacle>(); obstacle.carving = true; } BuildingEntrance entrance = GetComponent <BuildingEntrance>(); if (entrance != null) { entrance.IsActive = true; } }
public void Put(int id, [FromBody] BuildingEntrance buildingEntrance) { _unitOfWork.BuildingEntrance.Update(buildingEntrance); _unitOfWork.SaveChanges(); }