Esempio n. 1
0
        /*
         * public void SetCustomSettings(bool _Selection = true, bool _Symmetry = true, bool _Remove = true)
         * {
         *      if (AllowSymmetry != _Selection)
         *              FinishSelectionChange();
         *      else if(AllowSymmetry != _Symmetry)
         *              FinishSelectionChange();
         *      else if (AllowRemove != _Remove)
         *              FinishSelectionChange();
         *
         *      AllowSelection = _Selection;
         *      AllowSymmetry = _Symmetry;
         *      AllowRemove = _Remove;
         * }
         */

        public void SetAffectedGameObjects(GameObject[] GameObjects, SelectionControlTypes SelectionControlType)
        {
            if (SelectionControlType != SelectionControlTypes.Last)
            {
                SetSelectionType(SelectionControlType);
            }

            ChangeControlerType.UpdateCurrent();

            if (AffectedGameObjects.Length > 0)
            {
                // Clean
                for (int i = 0; i < AffectedGameObjects.Length; i++)
                {
                    if (AffectedGameObjects[i])
                    {
                        AffectedGameObjects[i].layer = DisableLayer;
                    }
                }
            }

            AffectedGameObjects = GameObjects;

            if (AffectedGameObjects.Length > 0)
            {
                // activate settings
                for (int i = 0; i < AffectedGameObjects.Length; i++)
                {
                    if (AffectedGameObjects[i])
                    {
                        AffectedGameObjects[i].layer = UsedLayer;
                    }
                }
            }


            Active = AffectedGameObjects.Length > 0;

            CleanIfInactive();
        }
Esempio n. 2
0
        void SetSelectionType(SelectionControlTypes SelectionControlType)
        {
            if (LastControlType == SelectionControlType)
            {
                return;
            }

            FinishSelectionChange();

            switch (SelectionControlType)
            {
            case SelectionControlTypes.Marker:
                AllowMove          = true;
                AllowUp            = false;
                AllowRotation      = true;
                AllowRotationX     = false;
                AllowLocalRotation = false;
                AllowScale         = false;
                AllowCustomScale   = false;
                AllowSnapToGrid    = true;
                AllowSelection     = true;
                AllowSymmetry      = true;
                AllowRemove        = true;
                SelPrefab          = 0;
                MinAngle           = 90;
                break;

            case SelectionControlTypes.MarkerChain:
                AllowMove          = false;
                AllowUp            = false;
                AllowRotation      = true;
                AllowRotationX     = false;
                AllowLocalRotation = false;
                AllowScale         = false;
                AllowCustomScale   = false;
                AllowSnapToGrid    = true;
                AllowSelection     = true;
                AllowSymmetry      = false;
                AllowRemove        = false;
                SelPrefab          = 0;
                MinAngle           = 90;
                break;

            case SelectionControlTypes.Decal:
                AllowMove          = true;
                AllowUp            = false;
                AllowRotation      = true;
                AllowRotationX     = true;
                AllowLocalRotation = true;
                AllowScale         = true;
                AllowCustomScale   = true;
                AllowSnapToGrid    = false;
                AllowSelection     = true;
                AllowSymmetry      = true;
                AllowRemove        = true;
                SelPrefab          = 1;
                MinAngle           = 0;
                break;

            case SelectionControlTypes.Units:
                AllowMove          = true;
                AllowUp            = false;
                AllowRotation      = true;
                AllowRotationX     = false;
                AllowLocalRotation = true;
                AllowScale         = false;
                AllowCustomScale   = false;
                AllowSnapToGrid    = true;
                AllowSelection     = true;
                AllowSymmetry      = true;
                AllowRemove        = true;
                SelPrefab          = 2;
                MinAngle           = 90;
                break;

            default:
                AllowMove          = false;
                AllowUp            = false;
                AllowRotation      = false;
                AllowRotationX     = false;
                AllowLocalRotation = false;
                AllowScale         = false;
                AllowCustomScale   = false;
                AllowSnapToGrid    = true;
                AllowSelection     = false;
                AllowSymmetry      = false;
                AllowRemove        = false;
                SelPrefab          = 0;
                MinAngle           = 0;
                break;
            }
            LastControlType = SelectionControlType;
        }