public void Place(Vector3[] Positions, Quaternion[] Rotations, Vector3[] Scales)
        {
            if (Positions.Length > 0)
            {
                Undo.RegisterUndo(new UndoHistory.HistoryDecalsChange());
            }

            for (int i = 0; i < Positions.Length; i++)
            {
                GameObject NewDecalObject = Instantiate(DecalPrefab, DecalPivot);
                OzoneDecal Obj            = NewDecalObject.GetComponent <OzoneDecal>();
                Decal      component      = new Decal();
                component.Obj  = Obj;
                Obj.Dec        = component;
                Obj.Dec.Shared = DecalSettings.GetLoaded;
                Obj.tr         = NewDecalObject.transform;

                Obj.tr.localPosition = Positions[i];
                Obj.tr.localRotation = Rotations[i];
                Obj.tr.localScale    = Scales[i];

                Obj.CutOffLOD     = DecalSettingsUi.CutOff.value;
                Obj.NearCutOffLOD = DecalSettingsUi.NearCutOff.value;

                Obj.Material = component.Shared.SharedMaterial;

                Obj.Bake();

                DecalsControler.AddDecal(Obj.Dec);
            }
            UpdateTotalCount();
        }
예제 #2
0
        void CreatePrefabAction(GameObject InstancedPrefab)
        {
            OzoneDecal Obj       = InstancedPrefab.GetComponent <OzoneDecal>();
            Decal      component = new Decal();

            component.Obj  = Obj;
            Obj.Dec        = component;
            Obj.Dec.Shared = Loaded;
            //Dec.Shared = Loaded;
            Obj.Material = Loaded.SharedMaterial;

            Obj.CutOffLOD     = CutOff.value;
            Obj.NearCutOffLOD = NearCutOff.value;
            Obj.Bake();
        }
        public void Place(Vector3[] Positions, Quaternion[] Rotations, Vector3[] Scales)
        {
            if (Positions.Length > 0 && !isPasteAction)
            {
                Undo.RegisterUndo(new UndoHistory.HistoryDecalsChange());
            }

            for (int i = 0; i < Positions.Length; i++)
            {
                GameObject NewDecalObject = Instantiate(DecalPrefab, DecalPivot);
                OzoneDecal Obj            = NewDecalObject.GetComponent <OzoneDecal>();
                Decal      component      = new Decal();
                component.Obj    = Obj;
                component.Shared = PlaceSharedSettings;
                Obj.Dec          = component;
                Obj.tr           = NewDecalObject.transform;

                Obj.tr.localPosition = Positions[i];
                Obj.tr.localRotation = Rotations[i];
                Obj.tr.localScale    = Scales[i];

                if (isPasteAction)
                {
                    Obj.CutOffLOD     = paste_CutOffLOD;
                    Obj.NearCutOffLOD = paste_NearCutOffLOD;
                    Obj.OwnerArmy     = paste_OwnerArmy;
                }
                else
                {
                    Obj.CutOffLOD     = DecalSettingsUi.CutOff.value;
                    Obj.NearCutOffLOD = DecalSettingsUi.NearCutOff.value;
                }

                Obj.Material       = component.Shared.SharedMaterial;
                Obj.CreationObject = false;
                Obj.UpdateMatrix();
                Obj.Bake();
                Obj.Index = Obj.tr.GetSiblingIndex();

                if (isPasteAction && i == 0)
                {
                    PastedObjects.Add(NewDecalObject);
                }

                //DecalsControler.AddDecal(Obj.Dec);
            }
            UpdateTotalCount();
        }