public bool RemovePlaceable(Placeable placeable) { bool add = placeables.Remove(placeable); Placeables.Remove(placeable); return(add); }
public bool RemoveCutout(Placeable cutout) { bool add = cutouts.Remove(cutout); Cutouts.Remove(cutout); UpdateLength(); return(add); }
public bool AddPlaceable(Placeable placeable) { bool add = placeables.Add(placeable); if (add) { Placeables.Add(placeable); } return(add); }
public bool AddCutout(Placeable cutout) { bool add = cutouts.Add(cutout); if (add) { Cutouts.Add(cutout); } UpdateLength(); return(add); }
public override void Delete() { if (SelectedPlaceable.data.Cutout) { Blueprint.Instance.RemoveCutout(SelectedPlaceable); } else { Blueprint.Instance.RemovePlaceable(SelectedPlaceable); } GameObject.Destroy(SelectedPlaceable.gameObject); SelectedPlaceable = null; InputManger.Instance.DisableUI(); }
private void Tap(RaycastHit hit, float2 mousePosition, float3 point) { Debug.Log(hit.transform.name); if (hit.transform.name == name) { SelectedPlaceable = hit.transform.GetComponent <Placeable>(); //Options.gameObject.SetActive(true); Vector3 sPoint = Camera.main.WorldToScreenPoint(SelectedPlaceable.Position); InputManger.Instance.MoveUIDrag1(sPoint); InputManger.Instance.MoveUiOptions(sPoint); InputManger.Instance.MoveUiRotation(sPoint); } else if (SelectedPlaceable != null) { Deselect(); } else { if (SelectedPlaceable == null) { //UiDrag1.gameObject.SetActive(true); //UiDrag1.position = new float3(mousePosition.xy, 0); var go = new GameObject(name, typeof(Placeable), typeof(MeshFilter), typeof(MeshRenderer), typeof(MeshCollider)); go.layer = LayerMask.NameToLayer("Placeables"); SelectedPlaceable = go.GetComponent <Placeable>(); SelectedPlaceable.SetFeature(FeatureOptions[selectedType]); SelectedPlaceable.UpdatePosition(point); if (SelectedPlaceable.data.Cutout) { Blueprint.Instance.AddCutout(SelectedPlaceable); } else { Blueprint.Instance.AddPlaceable(SelectedPlaceable); } Vector3 sPoint = Camera.main.WorldToScreenPoint(SelectedPlaceable.Position); InputManger.Instance.MoveUIDrag1(sPoint); InputManger.Instance.MoveUiOptions(sPoint); InputManger.Instance.MoveUiRotation(sPoint); } else { SelectedPlaceable.UpdatePosition(point); } } }
public override void HandleInput(bool tap, bool hold, float2 mousePosition) { RaycastHit hit; Ray ray = Camera.main.ScreenPointToRay((Vector2)mousePosition); if (Physics.Raycast(ray, out hit)) { Vector3 point = hit.point; point.y = 0; if (tap && !hold) { Tap(hit, mousePosition, point); } else if (hold) { if (SelectedPlaceable == null) { //UiDrag1.gameObject.SetActive(true); //UiDrag1.position = new float3(mousePosition.xy, 0); var go = new GameObject(name, typeof(Placeable), typeof(MeshFilter), typeof(MeshRenderer), typeof(MeshCollider)); SelectedPlaceable = go.GetComponent <Placeable>(); SelectedPlaceable.SetFeature(FeatureOptions[selectedType]); SelectedPlaceable.UpdatePosition(point); if (SelectedPlaceable.data.Cutout) { Blueprint.Instance.AddCutout(SelectedPlaceable); } else { Blueprint.Instance.AddPlaceable(SelectedPlaceable); } } SelectedPlaceable.UpdatePosition(point); Vector3 sPoint = Camera.main.WorldToScreenPoint(SelectedPlaceable.Position); InputManger.Instance.MoveUIDrag1(sPoint); InputManger.Instance.MoveUiOptions(sPoint); InputManger.Instance.MoveUiRotation(sPoint); // Hold(hit, mousePosition, point); } } }
public void RemovePrev() { Prev.Next = null; Prev = null; }
public void SetPrev(Placeable prev) { Prev = Prev; prev.Next = this; }
public void SetNext(Placeable next) { Next = next; next.Prev = this; }