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();
        }
Пример #4
0
        public static void CreateGameObjectFromDecal(Decal Component)
        {
            GameObject NewDecalObject = Instantiate(Current.DecalPrefab, Current.DecalPivot);
            OzoneDecal Obj            = NewDecalObject.GetComponent <OzoneDecal>();

            Component.Obj = Obj;
            Obj.Dec       = Component;
            Obj.tr        = NewDecalObject.transform;

            Obj.tr.localRotation = Quaternion.Euler(Component.Rotation * Mathf.Rad2Deg);
            Obj.tr.localScale    = new Vector3(Component.Scale.x * 0.1f, Component.Scale.x * 0.1f, Component.Scale.z * 0.1f);

            Obj.CutOffLOD     = Component.CutOffLOD;
            Obj.NearCutOffLOD = Component.NearCutOffLOD;

            Obj.MovePivotPoint(ScmapEditor.ScmapPosToWorld(Component.Position));

            Obj.Material = Component.Shared.SharedMaterial;

            Component.Shared.OnVisibilityChanged += Component.UpdateVisibility;
        }
Пример #5
0
 public static void SnapDecal(OzoneDecal Dec)
 {
 }