public virtual void OnTriggerEnter(Collider col) { switch (col.tag) { case "element": // print("saw element"); elementaction eleref = col.GetComponent <elementaction>(); if (eleref.purestate && !eleref.captured) { print("found one!!!"); enemycontrolref.newfind = true; enemycontrolref.importantobjs.Add(eleref.gameObject); // airef.importanttargets.Add(col.transform); } break; case "corecenter": // print("saw corecenter"); centralaction cenref = col.GetComponent <centralaction>(); if (col.GetComponent <centralaction>().fullpower) { print("found a center"); enemycontrolref.newfind = true; enemycontrolref.importantobjs.Add(cenref.gameObject); // airef.importanttargets.Add(col.transform); } break; } }
public void elementcenter(Transform hit) { centralaction centeractref = hit.GetComponent <centralaction>(); if (centeractref.centralstate == 2) { centercollected = hit.gameObject; hit.GetComponent <centralaction>().grabbed(centercollectpoint); } else if (centeractref.centralstate == 1 && !centeractref.fullpower) { if (elementintcount > 0) { elementcolection[elementintcount - 1].GetComponent <elementaction>().letloose(rhit.point); elementcolection.Remove(elementcolection[elementintcount - 1]); elementintcount--; } } }
/// <summary> /// changes the central objects states /// </summary> public void centerchange() { centralaction cenref = importanttargets[0].GetComponent <centralaction>(); if (cenref.centralstate == 2) { cenref.breakapart(); TimePerImportantLocation = 0; enemystate = 4; } else { enemystate = 0; if (areacontrolref.importantobjs.Find(obj => obj.gameObject == importanttargets[0]) != null) { areacontrolref.importantobjs.Remove(importanttargets[0].gameObject); } importanttargets.Remove(importanttargets[0]); } }