void inSubmit() { int i = 0; foreach (baseLocale locale in locales) { List <buildSlot> tempSlots = new List <buildSlot> (); foreach (Vector3 slot in locale.slots) { buildSlot temp = new buildSlot(slot); tempSlots.Add(temp); } foreach (Vector3 slot in locale.silo) { buildSlot temp = new buildSlot(slot); tempSlots.Add(temp); } foreach (Vector3 slot in locale.towers) { buildSlot temp = new buildSlot(slot); tempSlots.Add(temp); } baseAI outPost = new baseAI(locale.focal, tempSlots, i); outposts.Add(outPost); i++; } int d = 0; while (d < locales.Count) { //Debug.Log (Vector3.Distance (outposts [d].focal, AIseed.transform.position) + "outpost " + outposts[d].ID); d++; } eventManager.MapAI(playerID); _state = State.Idle; }
GameObject checkBuild(int type, int ID) { /* * [*** Cheat Sheet ***] * * HQ - 1 * Power Station - 2 * Refinery - 3 * Silo - 5 * Recycling Depot - 6 * Repair Depot - 7 * GigaFactory - 8 * Research Facility - 9 * Aircraft Factory - 10 * Wall - 11 * Sentry Gun - 12 * Gate - 15 */ if (mManager.structs [type].cost <= (rManager.resource [playerID] / 2)) { eventManager.Spend(mManager.structs [type].cost, playerID); baseAI outpost = Outposts [ID]; buildSlot slot = new buildSlot(transform.position); int rand = 1; int R = 20; slot: if (type != 12 && type != 5) { rand = Random.Range(0, 8); slot = outpost.buildSlots [rand]; } if (type == 5) { rand = Random.Range(8, 11); slot = outpost.buildSlots [rand]; } if (type == 12) { rand = Random.Range(11, 15); slot = outpost.buildSlots [rand]; } if (slot.state == false) { Debug.Log("Tried Build"); Vector3 pos = slot.point; Vector3 relativePos = outpost.focal - pos; Quaternion rot = Quaternion.LookRotation(relativePos); GameObject temp = Instantiate(mManager.structs [type].prefab, pos, rot); outpost.buildSlots [rand].state = true; temp.GetComponent <buildLogic> ().playerID = playerID; temp.GetComponent <buildLogic> ().outpostID = outpost.ID; Order buildOrder = new Order(Order.Type.Build, playerID, outpostIndex); buildOrder.unitTarget = temp; buildOrder.navTarget = pos; eventManager.InitOrder(buildOrder, null, 0, playerID); return(temp); } else { Debug.Log("loopback slot"); R--; if (type == 5) { Debug.Log("Attempts Left: " + R); } if (R > 0) { goto slot; } else { return(null); } } } else { if (debugActive) { Debug.Log("Too Expensive" + " Cost:" + mManager.structs [type].cost + " Money:" + (rManager.resource [playerID] / 2)); } return(null); } }