Пример #1
0
        void HideUpdate()
        {
            if (Input.GetKeyDown(KeyCode.H) && !CameraControler.IsInputFieldFocused())
            {
                HashSet <OzoneDecal> Selected = SelectedDecals;

                if (Input.GetKey(KeyCode.LeftAlt) || Input.GetKey(KeyCode.LeftShift))
                {
                    // Unhide
                    foreach (OzoneDecal Obj in Selected)
                    {
                        Obj.Dec.Shared.Hidden = false;
                    }

                    DecalSettings.Loaded.Hidden = false;
                }
                else
                {
                    // Hide
                    foreach (OzoneDecal Obj in Selected)
                    {
                        Obj.Dec.Shared.Hidden = true;
                    }

                    DecalSettings.Loaded.Hidden = true;
                }

                DecalsList.UpdateSelection();
            }
        }
Пример #2
0
        private void Update()
        {
            if (UpdateSelectedMatrixes)
            {
                UpdateSelectedMatrixes = false;

                for (int i = 0; i < SelectionManager.Current.Selection.Ids.Count; i++)
                {
                    AllObjects[SelectionManager.Current.Selection.Ids[i]].GetComponent <UnitInstance>().UpdateMatrixTranslated();
                }

                for (int s = 0; s < SelectionManager.Current.SymetrySelection.Length; s++)
                {
                    for (int i = 0; i < SelectionManager.Current.SymetrySelection[s].Ids.Count; i++)
                    {
                        AllObjects[SelectionManager.Current.SymetrySelection[s].Ids[i]].GetComponent <UnitInstance>().UpdateMatrixTranslated();
                    }
                }
            }

            if (Input.GetKeyDown(KeyCode.P) && FirstSelected != null && !CameraControler.IsInputFieldFocused())
            {
                // Parent all groups to selected
                ReparrentGroups();

                // Parent all units to selected
                ReparrentUnits();

                Generate();
            }
        }
 public static void ExecuteDuplicateAction()
 {
     if (Current.Active && !CameraControler.IsInputFieldFocused())
     {
         DuplicateAction?.Invoke();
     }
 }
        void Update()
        {
            if (!Active)
            {
                return;
            }

            if (!CameraControler.IsInputFieldFocused())
            {
                if (AllowRemove && Input.GetKeyDown(KeyCode.Delete))
                {
                    DestroySelectedObjects();
                }

                if (Input.GetKeyDown(KeyCode.C) && Input.GetKey(KeyCode.LeftControl))
                {
                    //Copy
                    CopyAction?.Invoke();
                }
                else if (Input.GetKeyDown(KeyCode.V) && Input.GetKey(KeyCode.LeftControl))
                {
                    //Paste
                    PasteAction?.Invoke();
                }
                else if (Input.GetKeyDown(KeyCode.D) && Input.GetKey(KeyCode.LeftControl))
                {
                    //Duplicate
                    DuplicateAction?.Invoke();
                }
            }
        }
Пример #5
0
    void LateUpdate()
    {
        if (MenuOpen)
        {
            if (ButtonClicked)
            {
                ButtonClicked = false;
                return;
            }
            if (Input.GetMouseButtonUp(0))
            {
                foreach (GameObject obj in Popups)
                {
                    obj.SetActive(false);
                }
                foreach (Button but in Buttons)
                {
                    but.interactable = true;
                }
                MenuOpen = false;
            }
        }



        if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.S) && !CameraControler.IsInputFieldFocused())
        {
            MapLuaParser.Current.SaveMap();
        }
    }
 private void Update()
 {
     if (Input.GetKeyDown(KeyCode.W) && !CameraControler.IsInputFieldFocused())
     {
         if (Position.interactable)
         {
             ChangeControler(0);
         }
     }
     else if (Input.GetKeyDown(KeyCode.E) && !CameraControler.IsInputFieldFocused())
     {
         if (Rotation.interactable)
         {
             ChangeControler(1);
         }
     }
     else if (Input.GetKeyDown(KeyCode.R) && !CameraControler.IsInputFieldFocused())
     {
         if (Scale.interactable)
         {
             ChangeControler(2);
         }
     }
     else if (Input.GetKeyDown(KeyCode.T) && !CameraControler.IsInputFieldFocused())
     {
         if (Snap.interactable)
         {
             ToggleSnap();
         }
     }
 }
Пример #7
0
        void Update()
        {
            if (!Active)
            {
                return;
            }

            if (AllowRemove && Input.GetKeyDown(KeyCode.Delete) && !CameraControler.IsInputFieldFocused())
            {
                DestroySelectedObjects();
            }
        }
Пример #8
0
 private void Update()
 {
     if (Connect.activeSelf && !Input.GetKey(KeyCode.LeftControl))
     {
         if (Input.GetKeyDown(KeyCode.C) && !CameraControler.IsInputFieldFocused())
         {
             ConnectSelected();
         }
         else if (Input.GetKeyDown(KeyCode.D) && !CameraControler.IsInputFieldFocused())
         {
             DisconnectSelected();
         }
     }
 }
Пример #9
0
        void Update()
        {
            Invert = Input.GetKey(KeyCode.LeftAlt);
            Smooth = Input.GetKey(KeyCode.LeftShift);

            if (CurrentPage != 0)
            {
                return;
            }

            if (PaintStarted && Input.GetMouseButtonUp(0))
            {
                ScmapEditor.SyncHeightmap(true);
            }

            if (Edit.MauseOnGameplay || ChangingStrength || ChangingSize)
            {
                if (!ChangingSize && (KeyboardManager.BrushStrengthHold() || ChangingStrength))
                {
                    // Change Strength
                    if (Input.GetMouseButtonDown(0))
                    {
                        ChangingStrength   = true;
                        BeginMousePos      = Input.mousePosition;
                        StrengthBeginValue = BrushStrength.value;
                    }
                    else if (Input.GetMouseButtonUp(0))
                    {
                        ChangingStrength = false;
                    }
                    if (ChangingStrength)
                    {
                        BrushStrength.SetValue((int)Mathf.Clamp(StrengthBeginValue - (BeginMousePos.x - Input.mousePosition.x), 0, 100));
                        //BrushStrengthSlider.value = Mathf.Clamp(StrengthBeginValue - (BeginMousePos.x - Input.mousePosition.x), 0, 100);
                        UpdateMenu(true);
                        //UpdateBrushPosition(true);
                    }
                }
                else if (KeyboardManager.BrushSizeHold() || ChangingSize)
                {
                    // Change Size
                    if (Input.GetMouseButtonDown(0))
                    {
                        ChangingSize   = true;
                        BeginMousePos  = Input.mousePosition;
                        SizeBeginValue = BrushSize.value;
                    }
                    else if (Input.GetMouseButtonUp(0))
                    {
                        ChangingSize = false;
                    }
                    if (ChangingSize)
                    {
                        BrushSize.SetValue(Mathf.Clamp(SizeBeginValue - (BeginMousePos.x - Input.mousePosition.x), 1, 256));
                        //BrushSizeSlider.value = Mathf.Clamp(SizeBeginValue - (BeginMousePos.x - Input.mousePosition.x), 1, 256);
                        UpdateMenu(true);
                        UpdateBrushPosition(true);
                    }
                }
                else
                {
                    if (!PaintStarted && Input.GetKey(KeyCode.LeftControl))
                    {
                        if (CameraControler.Current.DragStartedGameplay)
                        {
                            if (UpdateBrushPosition(false))
                            {
                            }
                        }

                        if (Input.GetMouseButton(0))
                        {
                            BrushTarget.SetValue(CameraControler.GetLastScmHeight());
                        }
                        else if (Input.GetMouseButton(1))
                        {
                            BrushMini.SetValue(CameraControler.GetLastScmHeight());
                        }
                        else if (Input.GetMouseButton(2))
                        {
                            BrushMax.SetValue(CameraControler.GetLastScmHeight());
                        }
                    }
                    else if (Edit.MauseOnGameplay && Input.GetMouseButtonDown(0))
                    {
                        if (UpdateBrushPosition(true))
                        {
                            ScmapEditor.Current.Teren.heightmapPixelError = 20;
                            GenerateControlTex.StopGenerateNormal();
                            ScmapEditor.Current.TerrainMaterial.SetFloat("_GeneratingNormal", 1);
                            PaintStarted = true;
                            RecalcTerrainClamp();
                            SymmetryPaint();
                        }
                    }
                    else if (Input.GetMouseButton(0))
                    {
                        if (CameraControler.Current.DragStartedGameplay)
                        {
                            if (UpdateBrushPosition(false))
                            {
                            }
                            RecalcTerrainClamp();
                            SymmetryPaint();
                        }
                    }
                    else if (Input.GetMouseButtonUp(0))
                    {
                    }
                    else
                    {
                        UpdateBrushPosition(true);
                    }
                }
            }

            if (!CameraControler.IsInputFieldFocused())            // Ignore all unput
            {
                if (Input.GetMouseButton(0))
                {
                }
                else if (KeyboardManager.SwitchTypeNext())
                {
                    int SelectedBrush = 0;
                    for (int i = 0; i < BrushTypes.Length; i++)
                    {
                        if (BrushTypes[i].isOn)
                        {
                            SelectedBrush = i;
                            //BrushTypes[i].isOn = false;
                        }
                    }

                    SelectedBrush++;
                    if (SelectedBrush >= BrushTypes.Length)
                    {
                        SelectedBrush = 0;
                    }

                    BrushTypes[SelectedBrush].isOn = true;
                }
                else if (KeyboardManager.SwitchType1())
                {
                    BrushTypes[0].isOn = true;
                }
                else if (KeyboardManager.SwitchType2())
                {
                    BrushTypes[1].isOn = true;
                }
                else if (KeyboardManager.SwitchType3())
                {
                    BrushTypes[2].isOn = true;
                }
                else if (KeyboardManager.SwitchType4())
                {
                    BrushTypes[3].isOn = true;
                }

                if (KeyboardManager.IncreaseTarget())
                {
                    if (BrushTarget.value < 256)
                    {
                        BrushTarget.SetValue((int)BrushTarget.value + 1);
                    }
                }
                else if (KeyboardManager.DecreaseTarget())
                {
                    if (BrushTarget.value > 0)
                    {
                        BrushTarget.SetValue((int)BrushTarget.value - 1);
                    }
                }
            }


            if (Input.GetMouseButtonUp(0))
            {
                if (TerainChanged)
                {
                    Undo.RegisterUndo(new UndoHistory.HistoryTerrainHeight(), new UndoHistory.HistoryTerrainHeight.TerrainHeightHistoryParameter(beginHeights));
                    TerainChanged = false;
                }

                if (Painting)
                {
                    Painting = false;
                    RegenerateMaps();
                }

                PaintStarted = false;
                ScmapEditor.Current.Teren.heightmapPixelError = 4;
            }



            BrushGenerator.RegeneratePaintBrushIfNeeded();
        }