示例#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;
 }