public void BeginCreateZone() { var zoneDisplay = ZoneDisplayManager.Instance.CreateZoneDisplay(); Vector3 start = Vector3.zero; InputController.Instance.RegisterHandler(new DragHandler("Fire1", (handler, mousePosition) => { zoneDisplay.Change(mousePosition, mousePosition, 0); start = mousePosition; }, (handler, mousePosition, delta) => { zoneDisplay.Change(start, mousePosition, 0); }, (handler, point) => { InputController.Instance.UnRegisterHandler(handler); //check for collisions between rects and merge them for (int i = 0; i < ZoneDisplayManager.Instance.Zones.Count; i++) { ZoneDisplay otherZoneDisplay = ZoneDisplayManager.Instance.Zones[i]; if (otherZoneDisplay != zoneDisplay && otherZoneDisplay.DisplayedZone.Overlaps(zoneDisplay.DisplayedZone)) { //will remove otherzonedisplay from zonedisplaymanager zoneDisplay.MergeZone(otherZoneDisplay); i--; } } GeneralDivision.AttachedDivision.AddZone(zoneDisplay.DisplayedZone); })); }
public ZoneDisplayContextMenu(ZoneDisplay Display) { _Items = new List <IContextMenuItem> { new DeleteZoneContextMenuItem(Display.DisplayedZone, Display), new DesignateZoneBehaviorContextMenuItem(Display.DisplayedZone, Display) }; }
public DesignateZoneBehaviorContextMenu(ZoneDisplay display) { _Items = new List <IContextMenuItem>(); foreach (IZoneBehavior behavior in BaseZoneBehavior.GetAllZoneBehaviors()) { _Items.Add(new ZoneBehaviorContextMenuItem(display.DisplayedZone, display, behavior)); } }
public ZoneDisplay CreateZoneDisplay() { Zone zone = new Zone(new List <Rect>() { new Rect(Vector2.zero, Vector2.zero) }, Color.white); ZoneDisplay zoneDisplay = Instantiate(ZoneDisplayPrefab).GetComponent <ZoneDisplay>(); zoneDisplay.Init(zone); RegisterZoneDisplay(zoneDisplay); return(zoneDisplay); }
public void TestFindEdgeLoop() { List <Vector3> verts = new List <Vector3>(); List <int> tri = new List <int>(); List <Vector3> normals = new List <Vector3>(); List <Vector2> uv = new List <Vector2>(); HashSet <Edge> Edges = new HashSet <Edge>(); Dictionary <Vector3, int> vertPositionMap = new Dictionary <Vector3, int>(); Dictionary <Vector3, HashSet <Edge> > edgesIntoPoint = new Dictionary <Vector3, HashSet <Edge> >(); List <List <Vector3> > OrderedEdgeVerts = new List <List <Vector3> >(); List <Rect> rects = new List <Rect>(); rects.Add(new Rect(new Vector2(61.5f, 29.5f), new Vector2(6, 1))); rects.Add(new Rect(new Vector2(58.5f, 27.5f), new Vector2(5, 5))); rects.Add(new Rect(new Vector2(64.5f, 27.5f), new Vector2(1, 5))); ZoneDisplay.CreateMeshesHelper(rects, ref verts, ref vertPositionMap, ref Edges, ref edgesIntoPoint, ref OrderedEdgeVerts, ref tri, ref normals, ref uv); }
public void SelectZoneDisplay(ZoneDisplay zoneDisplay) { ZoneSelectCallback?.Invoke(zoneDisplay); }
public BaseZoneContextMenuItem(IZone Zone, ZoneDisplay Display) { _Zone = Zone; _Display = Display; }
public void MergeZone(ZoneDisplay Other) { DisplayedZone.BoundingBoxes.AddRange(Other.DisplayedZone.BoundingBoxes); ZoneDisplayManager.Instance.DestroyZoneDisplay(Other); CreateMeshes(); }
public DesignateZoneBehaviorContextMenuItem(IZone Zone, ZoneDisplay Display) : base(Zone, Display) { }
public ZoneBehaviorContextMenuItem(IZone Zone, ZoneDisplay Display, IZoneBehavior behavior) : base(Zone, Display) { _ZoneBehavior = behavior; }
public DeleteZoneContextMenuItem(IZone Zone, ZoneDisplay Display) : base(Zone, Display) { }
public void OnZoneSelected(ZoneDisplay display) { ZoneDisplaySelectCallback?.Invoke(display); }
public void UnRegisterZoneDisplay(ZoneDisplay zone) { Zones.Remove(zone); }
public void RegisterZoneDisplay(ZoneDisplay zone) { Zones.Add(zone); }
public void DestroyZoneDisplay(ZoneDisplay zone) { UnRegisterZoneDisplay(zone); Destroy(zone.gameObject); //TODO need to remove the ZD handelers }