public override void OnInspectorGUI() { base.OnInspectorGUI(); _wayPointPath = (WayPointPath)target; if (GUILayout.Button("Get Child")) { _wayPointPath.wayPoints.Clear(); int wayPointCount = _wayPointPath.transform.childCount; for (int element = 0; element < wayPointCount; element++) { _wayPointPath.wayPoints.Add(_wayPointPath.transform.GetChild(element)); } } if (GUILayout.Button("Auto Rename numberic")) { int numberic = 0; foreach (var wayPoint in _wayPointPath.wayPoints) { wayPoint.name = "WayPoint" + numberic; numberic++; } } }
private void Start() { wayPointPath = wayPointManager.wayPointPaths [creepSpawnerIndex]; attackSpeed = unitProperties.attackSpeed; aiState = AIState.IDLE; }
/// <summary> /// Gets a path by ID. /// </summary> public void LoadPathByID(string ID) { int numPaths = paths.Count; for (int p = 0; p < numPaths; p++) { if (paths[p].ID == ID) { activePath = paths[p]; activePoint = 0; startPos = transform.position; startRot = transform.rotation; endPos = activePath.waypoints[activePoint].transform.position; endRot = activePath.waypoints[activePoint].transform.rotation; //Debug.Log(ID + " path loaded."); Move(); break; } } }
private void DrawPath() { _wayPointPath = (WayPointPath)target; int wayPointPathCount = _wayPointPath.wayPoints.Count; Vector3[] wayPointVector = GetWayPointsToVector3(wayPointPathCount); Handles.color = Color.red; if (_wayPointPath.isLine == true) { DrawPathToLine(wayPointPathCount, wayPointVector); } if (_wayPointPath.isCurve == true) { for (int i = 0; i < wayPointPathCount - 3; i++) { Handles.DrawBezier(wayPointVector[i], wayPointVector[i + 1], wayPointVector[i + 2], wayPointVector[i + 3], Color.red, null, 2f); } } }
void OnEnable() { wp = (WayPointPath)target; }
void OnEnable() { mn = (MobNavigation)target; initPos = mn.transform.position; wp = mn.path.GetComponent<WayPointPath>(); }