void select(GameObject go) { if (mCurrentPatrolPoint != null) { mCurrentPatrolPoint.renderer.material.color = (Color.white); } // UnityEditor.Selection.activeGameObject = GameObject.Find("SGEditor"); mCurrentPatrolPoint = go; if (mCurrentPatrolPoint != null) { mCurrentPatrolPoint.renderer.material.color = (Color.green); } foreach (patrol p in mAllPatrols) { patrolPoint pp = p.findPatrolPoint(go); if (pp != null) { mCurrentSettleTime = pp.mSettletime; mCurrentPatrol = p; return; } } }
public void removePatrolPoint(GameObject go) { patrolPoint pp = findPatrolPoint(go); if (pp == null) { return; } mPatrolPoints.Remove(pp); UnityEngine.Object.DestroyImmediate(go); updatePatrolLine(); }
public GameObject addPatrolPoint(Vector3 pos, int settleTime) { patrolPoint pp = new patrolPoint(); pp.mGo = GameObject.CreatePrimitive(PrimitiveType.Sphere); pp.mGo.name = PatrolEditorScript.patrolPointName; pp.mGo.transform.position = pos; pp.mGo.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f); pp.mSettletime = settleTime; mPatrolPoints.Add(pp); updatePatrolLine(); return(pp.mGo); }
void deleteCurrent() { if (mCurrentPatrolPoint == null) { return; } foreach (patrol p in mAllPatrols) { patrolPoint pp = p.findPatrolPoint(mCurrentPatrolPoint); if (pp != null) { p.removePatrolPoint(mCurrentPatrolPoint); if (p.mPatrolPoints.Count == 0) { mAllPatrols.Remove(p); mCurrentPatrol = null; } break; } } select(null); }