void OnNodeHover(Node node, bool exited) { if (_nodeHoverClip != null && _playHoverSound) { _oneShotSource.PlayOneShot(_nodeHoverClip); _playHoverSound = false; } if (exited) { _playHoverSound = true; } _nodeOverviewUI.gameObject.SetActive(!exited); _nodeOverviewUI.SetNode(node); if (_activeRoute == null) { TravelCost cost = _player.CalculateTravelCost(node); _nodeOverviewUI.SetTravelCost(cost); } else { _nodeOverviewUI.SetTravelCost(null); } }
void OnNodeSelected(Node node) { if (GameData.State == GameState.ConfiguringAction && GameData.Action == GameAction.Travel) { if (_nodeSelectClip != null) { _oneShotSource.PlayOneShot(_nodeSelectClip); } // Dont travel to a node we are already on just open the action screen if (node.Id == _player.CurrentNodeId) { GameData.State = GameState.ChoosingAction; ShowActionSelectionScreen(); } else { TravelCost cost = _player.CalculateTravelCost(node); if (cost != null) { _activeRoute = _player.TravelToNode(node, cost.Time); _activeTravelCost = cost; GameData.State = GameState.RunningAction; _map.TickNodes(cost.Time); Debug.Log($"Traveling to {node.Name} with cost {cost.ToString()}"); } } } }
public void InitData() { var cost = new Cost(); var paymentCurrency = new Currency(); var project = new Project(); var agency = new Agency(); var country = new Country(); var owner = new CostOwner(); var notificationSubscribers = new NotificationSubscriber(); var userBusinessRoles = new List <UserBusinessRole>(); var costStages = new List <CostStage>(); var costStageRevisions = new List <CostStageRevision>(); var selectRevisionTravelCost = new TravelCost(); var oeRevisionTravelCost = new TravelCost(); var region = new Region(); var payments = new List <CostStageRevisionPaymentTotal>(); var cli = new List <CostLineItem>(); var stageDetails = new CustomObjectData(); var productionDetails = new CustomObjectData(); var supportingDocuments = new List <SupportingDocument>(); var lstObjectData = new List <CustomObjectData>(); var costFormDetails = new List <CostFormDetails>(); var customFormData = new CustomFormData(); var approvals = new List <Approval>(); var approvalMembers = new List <ApprovalMember>(); }
public void Entity_To_Model_IsValid() { var expectedId = Guid.NewGuid(); var expectedCity = "Bradford"; var expectedUniqueItemId = Guid.NewGuid(); var expectedTravelTypeCost = 25M; var expectedTravelType = "air travel"; var expectedTotalCost = 35M; var expectedShootDays = 20; var expectedRole = "traveller"; var expectedPerDiem = 32.5M; var expectedComment = "no comment"; var expectedCostStageRevisionId = Guid.NewGuid(); var expectedLinkContentType = new [] { "ABC", "123" }; var expectedName = "a name"; var expectedOtherContentType = false; var entity = new TravelCost { Id = expectedId, ShootCity = expectedCity, Comments = expectedComment, CostStageRevisionId = expectedCostStageRevisionId, LinkContentType = expectedLinkContentType, Name = expectedName, OtherContentType = expectedOtherContentType, PerDiem = expectedPerDiem, Role = expectedRole, ShootDays = expectedShootDays, TotalCost = expectedTotalCost, TravelType = expectedTravelType, TravelTypeCost = expectedTravelTypeCost, UniqueItemId = expectedUniqueItemId }; var result = _mapper.Map <TravelCost, TravelCostModel>(entity); result.Should().NotBeNull(); result.Id.Should().Be(entity.Id); result.Region.Should().BeNull(); result.ShootCity.Should().NotBeNull(); result.ShootCity.Should().Be(entity.ShootCity); result.Id.Should().Be(expectedId); result.Comments.Should().Be(expectedComment); result.LinkContentType.Should().BeEquivalentTo(expectedLinkContentType); result.Name.Should().Be(expectedName); result.OtherContentType.Should().Be(expectedOtherContentType); result.PerDiem.Should().Be(expectedPerDiem); result.Region.Should().BeNull(); result.Role.Should().Be(expectedRole); result.ShootDays.Should().Be(expectedShootDays); result.TotalCost.Should().Be(expectedTotalCost); result.TravelType.Should().Be(expectedTravelType); result.TravelTypeCost.Should().Be(expectedTravelTypeCost); result.UniqueItemId.Should().Be(expectedUniqueItemId); }
public void CountryId_Is_Not_EmptyGuid_IsValid() { var expectedId = Guid.NewGuid(); var expectedCity = ""; var expectedCountry = "England"; var expectedCost = 100; var expectedUniqueItemId = Guid.NewGuid(); var expectedTravelTypeCost = 25M; var expectedTravelType = "air travel"; var expectedTotalCost = 35M; var expectedShootDays = 20; var expectedRole = "traveller"; var expectedPerDiem = 32.5M; var expectedComment = "no comment"; var expectedCostStageRevisionId = Guid.NewGuid(); var expectedLinkContentType = new[] { "ABC", "123" }; var expectedName = "a name"; var expectedOtherContentType = false; var entity = new TravelCost { Id = expectedId, ShootCity = expectedCity, CountryId = Guid.NewGuid(), Country = new Country { Name = expectedCountry }, Comments = expectedComment, CostStageRevisionId = expectedCostStageRevisionId, LinkContentType = expectedLinkContentType, Name = expectedName, OtherContentType = expectedOtherContentType, PerDiem = expectedPerDiem, Role = expectedRole, ShootDays = expectedShootDays, TotalCost = expectedTotalCost, TravelType = expectedTravelType, TravelTypeCost = expectedTravelTypeCost, UniqueItemId = expectedUniqueItemId }; var result = _mapper.Map <TravelCost, TravelCostModel>(entity); result.Should().NotBeNull(); result.Region.Should().BeNull(); result.ShootCity.Should().NotBeNull(); result.ShootCity.Should().Be(entity.ShootCity); result.Country.Should().NotBeNull(); result.Country.Should().Be(expectedCountry); }
void OnPlayerTravelComplete() { Debug.Log($"Travel completed. {GameData.OperationTime}s of travel time left"); if (_map.GetNodeType(_player.CurrentNodeId) == _goalNodeType) { // Make sure we could afford the travel before winning if (!GameData.CanAffordTravel(_activeTravelCost)) { if (false == GameData.HasEnoughHealth(_activeTravelCost.Health)) { GameOver(GameOverReasons.NoHealth); } else if (false == GameData.HasEnoughFuel(_activeTravelCost.Fuel)) { GameOver(GameOverReasons.NoFuel); } if (false == GameData.HasEnoughTime(_activeTravelCost.Time)) { Debug.Log("So close but the anomaly got you. Anomaly starting..."); ShowRouteSelectionScreen(); StartAnomaly(); } } } if (GameData.HasEnoughTime(_activeTravelCost.Time)) { GameData.ApplyTravelCost(_activeTravelCost); _activeTravelCost = null; _map.MarkNodeRoutesAsDiscovered(_player.CurrentNodeId); _activeRoute.State = RouteState.Traveled; _player.OnDiscoverNode(_player.CurrentNode); } else { GameData.OperationTime = 0; } _activeRoute = null; OnActionCompleted(GameAction.Travel); }
public void SetTravelCost(TravelCost cost) { if (cost != null) { _routeStats.gameObject.SetActive(true); _routeStats.SetStat(TimeCostStatName, cost.Time); _routeStats.SetStatState(TimeCostStatName, GameData.HasEnoughTime(cost.Time) ? StatState.Ok : StatState.Error); _routeStats.SetStat(HealthCostStatName, cost.Health); _routeStats.SetStatState(HealthCostStatName, GameData.HasEnoughHealth(cost.Health) ? StatState.Ok : StatState.Error); _routeStats.SetStat(FuelCostStatName, cost.Fuel); _routeStats.SetStatState(FuelCostStatName, GameData.HasEnoughFuel(cost.Fuel) ? StatState.Ok : StatState.Error); } else { _routeStats.gameObject.SetActive(false); } }