public Army(BuildCity city) { _city = city; _voids = city.voidsOther.ToArray(); armyVacancyRate = new float(); hqBestVacant = new Vector3Int(); _bounds = city.cityBounds; _voxelSize = city.voxelSize; hq = new MeshCollider[1]; hq[0] = city.globalHQ; hqBounds = new Bounds[1]; hqBounds[0] = city.globalHQ.bounds; _A = Resources.Load("_A", typeof(GameObject)) as GameObject; _B = Resources.Load("_B", typeof(GameObject)) as GameObject; grid = SparseGrid.Grid3d.MakeWithCity(_bounds, _voids, _voxelSize); gridHQ = SparseGrid.Grid3d.MakeGridWithBounds(hqBounds, _voxelSize); InitGraph(); AttachGameObjects(); PopulateWithHQ(); }
// Start is called before the first frame update public void Start() { city = new BuildCity(7, 7); city.Start(); StartCoroutine(city.WakeCity()); jobCount = -1; }
public Vector3 getFaceMotion(BuildCity.Pixel targetPix, GameObject target, BuildCity _city) { Vector3 delta = new Vector3(); Vector3 output = new Vector3(0, 0, 0); var closest = _city.FindClosestStreetPixel(targetPix); delta = closest.DisplayBuilding.transform.position - target.transform.position; var x = delta.x; var z = delta.z; var normalizedX = x / Mathf.Abs(x); var normalizedZ = z / Mathf.Abs(z); if (Mathf.Abs(x) > Mathf.Abs(z)) { var trans = target.transform.localScale.x * normalizedX; output = new Vector3(trans, 0, 0); } else { var trans = target.transform.localScale.z * normalizedZ; output = new Vector3(0, 0, trans); } return(output); }
public ProceduralBuilding(int boundingXZ, float multiplierSpacing, BuildCity city) { this.boundingXZ = boundingXZ; this.multiplierSpacing = multiplierSpacing; this.city = city; _voxelSize = city.voxelSize; }
public IEnumerator startNightLights() //takes care of turning lights on/off with the sun cycle { yield return(new WaitForSeconds(1.0f)); _city = mainController.GetComponent <UIControl>().city; cityPix.AddRange(_city.GetIntersectionPixels()); InstantiateLights(cityPix); }
public void Start() { city = mainController.GetComponent <UIControl>().getCity(); fleetSize = 0; unitCostActive = 20.0f; unitCostIdle = 5.0f; initFleetCost = 0.0f; fleetCost = 500.0f; revenue = 0.0f; profit = 0.0f; }
public override void OnInspectorGUI() { DrawDefaultInspector(); BuildCity cityBuilder = (BuildCity)target; if (GUILayout.Button("Generate Cities")) { Undo.RecordObject(target, "Generation"); cityBuilder.ClearCities(); //clear all prefabs before generating again cityBuilder.GenerateCity(); } if (GUILayout.Button("Clear")) { cityBuilder.ClearCities(); } }
//Generates structures to which fleet needs to attend to. //Various instances of this class area consumed in BuildCity. public Job(BuildCity city) { this.city = city; _graph = city.army.graph; indices = new List <Vector3Int>(); initIndicesCount = 0; plot = new BuildCity.Pixel(city); size = new float(); payout = new float(); timeReq = new float(); completed = false; timeUp = false; pursue = false; abort = false; timeExpire = new float(); Init(out streets, out targetBuilding); InstObj(); name = plot.Name + string.Format("{0}", bldgIndex); timeCreate = Time.realtimeSinceStartup; timeExpire = timeCreate + 150.0f; timePassed = timeCreate; }
public Pixel(BuildCity mapGrid) { this.mapGrid = mapGrid; }