예제 #1
0
        public bool RemovePlaceable(Placeable placeable)
        {
            bool add = placeables.Remove(placeable);

            Placeables.Remove(placeable);

            return(add);
        }
예제 #2
0
        public bool RemoveCutout(Placeable cutout)
        {
            bool add = cutouts.Remove(cutout);

            Cutouts.Remove(cutout);
            UpdateLength();
            return(add);
        }
예제 #3
0
        public bool AddPlaceable(Placeable placeable)
        {
            bool add = placeables.Add(placeable);

            if (add)
            {
                Placeables.Add(placeable);
            }

            return(add);
        }
예제 #4
0
        public bool AddCutout(Placeable cutout)
        {
            bool add = cutouts.Add(cutout);

            if (add)
            {
                Cutouts.Add(cutout);
            }
            UpdateLength();
            return(add);
        }
예제 #5
0
 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();
 }
예제 #6
0
        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);
                }
            }
        }
예제 #7
0
        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);
                }
            }
        }
예제 #8
0
 public void RemovePrev()
 {
     Prev.Next = null;
     Prev      = null;
 }
예제 #9
0
 public void SetPrev(Placeable prev)
 {
     Prev      = Prev;
     prev.Next = this;
 }
예제 #10
0
 public void SetNext(Placeable next)
 {
     Next      = next;
     next.Prev = this;
 }