private Dictionary <ResourceType, int> GetStationConstructionResources(StationConstruction construction) { Dictionary <ResourceType, int> resources = new Dictionary <ResourceType, int>(); for (int i = 0; i < construction.resourceCosts.Count; i++) { if (!resources.ContainsKey(construction.resourceCosts[i].resourceType)) { resources[construction.resourceCosts[i].resourceType] = 0; } resources[construction.resourceCosts[i].resourceType] += construction.resourceCosts[i].quantity; } return(resources); }
public PossibleStationConstruction(GameObject gameObject, StationConstruction stationConstruction, StationConstructor stationConstructor) { this.gameObject = gameObject; this.stationConstruction = stationConstruction; this.stationConstructor = stationConstructor; }
private void SetStationConstructionButtonClickCallback(StationConstructor stationConstructor, GameObject button, StationConstruction stationConstruction) { button.GetComponent <Button>().onClick.AddListener(() => { Vector3 spawnPosition = stationConstructor.gameObject.transform.position; GameObject stationPrefab = Spawner.Instance.dummyStationDictionary[stationConstruction.stationType]; GameObject station = Instantiate(stationPrefab, spawnPosition, Quaternion.identity); if (possibleStation != null) { Destroy(possibleStation.gameObject); } station.SetActive(true); FogOfWarUtility.SetRendering(true, station); possibleStation = new PossibleStationConstruction(station, stationConstruction, stationConstructor); ObjectSelector.Instance.lockSelection = true; }); }