public void AddWaypointMarker(WaypointMarker wp) { if (!waypointMarkersList.Contains(wp)) { SubscribeOnDestruction(wp.GetInstanceID().ToString(), () => RemoveWaypointMarker(wp)); this.waypointMarkersList.Add(wp); } }
private void RemoveWaypointMarker(WaypointMarker wp) { if (waypointMarkersList.Contains(wp)) { waypointMarkersList.Remove(wp); UnsubscribeOnDestruction(wp.GetInstanceID().ToString()); wp.DestroyThis(); } }
public static WaypointMarker CreateWaypointMarker(Vector3 worldPosition) { WaypointMarker res = Instantiate <WaypointMarker>( GameObject.Find("ResourcesList").GetComponent <ResourcesListComponent>().waypointMarkerPrefab, GameObject.Find("UI World Canvas").transform); res.Init(worldPosition); return(res); }
private void OnPointerClickDelegate(PointerEventData data) { if (!paused) { if (isEditing) { if (UIHandler.EventSystemPointedGameObjects().Count > 1) { ExitPlacementUIMode(); ConfirmPositioning(false); DestroyThis(); } else { AddWaypointMarker(WaypointMarker.CreateWaypointMarker(GetWorldPosition())); ExitPlacementUIMode(); ConfirmPositioning(true); } } else { if (expanded) { SelectionHandler.GetUsedSelector().DeselectEntity(this); expanded = false; //Contract(); } else { SelectionHandler.GetUsedSelector().SelectEntity(this); expanded = true; //Expand(); } } } }