public void OnPointAdded(SimPath path, SimPoint point) { GameObject goPoint = new GameObject(); goPoint.transform.parent = transform; SimPointUnity pointUnity = goPoint.AddComponent <SimPointUnity>(); pointUnity.Init(point); pointsUnity.Add(pointUnity); }
public void OnPathAdded(SimPath path) { GameObject goPath = new GameObject(); goPath.transform.parent = pathsContainer; SimPathUnity pathUnity = goPath.AddComponent <SimPathUnity>(); pathUnity.Init(path); pathsUnity.Add(pathUnity); }
public void OnSegmentModified(SimPath path, SimSegment segment) { for (int i = 0; i < segmentsUnity.Count; i++) { if (segmentsUnity[i].segment == segment) { segmentsUnity[i].Modified(); break; } } }
public void OnSegmentAdded(SimPath path, SimSegment segment) { GameObject goSegment = new GameObject(); goSegment.transform.parent = transform; SimSegmentUnity segmentUnity = goSegment.AddComponent <SimSegmentUnity>(); segmentUnity.Init(segment); segmentsUnity.Add(segmentUnity); }
public void OnSegmentRemoved(SimPath path, SimSegment segment) { for (int i = 0; i < segmentsUnity.Count; i++) { if (segmentsUnity[i].segment == segment) { GameObject.Destroy(segmentsUnity[i].gameObject); segmentsUnity.RemoveAt(i); break; } } }
public void OnPathRemoved(SimPath path) { for (int i = 0; i < pathsUnity.Count; i++) { if (pathsUnity[i].path == path) { GameObject.Destroy(pathsUnity[i].gameObject); pathsUnity.RemoveAt(i); break; } } }
public void OnPointRemoved(SimPath path, SimPoint point) { for (int i = 0; i < pointsUnity.Count; i++) { if (pointsUnity[i].point == point) { GameObject.Destroy(pointsUnity[i].gameObject); pointsUnity.RemoveAt(i); break; } } }
public void Init(SimPath path) { this.path = path; path.pathListener = this; gameObject.name = path.id; transform.localPosition = Vector3.zero; foreach (SimSegment segment in path.segments) { OnSegmentAdded(path, segment); } }
public void Init(SimPath path, SimSegmentType segmentType, int id, SimPoint point1, SimPoint point2) { this.path = path; this.segmentType = segmentType; this.id = id; this.point1 = point1; this.point2 = point2; point1.segments.Add(this); point2.segments.Add(this); UpdateLength(); }
// Use this for initialization void Start() { Simulation sim = new Simulation(); sim.simulationDefinition = new SimulationDefinitionLoader().LoadDefinitionFromString(cityToTest.text); Init(sim); SimBox city = sim.AddBox("city", Vector3.zero, 32, 32); SimPath road = city.GetPath("Road"); SimPoint p1 = road.AddPoint(new Vector3(20, 0, 20)); SimPoint p2 = road.AddPoint(new Vector3(50, 0, 50)); SimPoint p3 = road.AddPoint(new Vector3(20, 0, 50)); SimSegment s1 = road.AddSegment(sim.simulationDefinition.GetSegmentType("Dirt"), p1, p2); SimSegment s2 = road.AddSegment(sim.simulationDefinition.GetSegmentType("Dirt"), p2, p3); SimSegment s3 = road.AddSegment(sim.simulationDefinition.GetSegmentType("Dirt"), p3, p1); SimSegmentPosition unitPos; unitPos.segment = s1; unitPos.offset = 0.66f; city.AddUnit(sim.simulationDefinition.GetUnitType("Home"), unitPos); unitPos.segment = s1; unitPos.offset = 0.5f; city.AddUnit(sim.simulationDefinition.GetUnitType("Home"), unitPos); unitPos.segment = s2; unitPos.offset = 0.5f; city.AddUnit(sim.simulationDefinition.GetUnitType("Work"), unitPos); unitPos.segment = s3; unitPos.offset = 0.5f; city.AddUnit(sim.simulationDefinition.GetUnitType("Work"), unitPos); }
public SimPath AddPath(SimPathType pathType) { if (pathType == null) { throw new ArgumentNullException("pathType"); } if (GetPath(pathType.id) != null) { throw new ArgumentException("Duplicated pathType", "pathType"); } SimPath path = new SimPath(); path.Init(pathType, this); paths.Add(path.id, path); boxListener.OnPathAdded(path); return(path); }
public void OnSegmentRemoved(SimPath path, SimSegment segment) { }
public void OnPathRemoved(SimPath path) { }
public void RemovePath(SimPath path) { paths.Remove(path.id); boxListener.OnPathRemoved(path); }
public void OnPointRemoved(SimPath path, SimPoint point) { }
public void OnPathAdded(SimPath path) { }
public void Init(SimPath path, int id, SimVector3 worldPosition) { this.path = path; this.id = id; this.worldPosition = worldPosition; }
public void OnSegmentAdded(SimPath path, SimSegment segment) { }
public void OnSegmentModified(SimPath path, SimSegment segment) { }
public void OnPointAdded(SimPath path, SimPoint point) { }
public void OnPointModified(SimPath path, SimPoint point) { }