ParticleEditor.EditorData.CopyCurrentEmitter C# (CSharp) Méthode

CopyCurrentEmitter() public static méthode

public static CopyCurrentEmitter ( ) : void
Résultat void
        public static void CopyCurrentEmitter()
        {
            if (AppState.Self.CurrentEmitter == null) return;

            Emitter tempEmitter = AppState.Self.CurrentEmitter.Clone();
            tempEmitter.Name = StringFunctions.IncrementNumberAtEnd(tempEmitter.Name);
            while (Emitters.FindWithNameContaining(tempEmitter.Name) != null)
            {
                tempEmitter.Name = StringFunctions.IncrementNumberAtEnd(tempEmitter.Name);
            }

            Emitters.Add(tempEmitter);
            SpriteManager.AddEmitter(tempEmitter);
        }

Usage Example

Exemple #1
0
        private void KeyboardControl()
        {
            if (InputManager.ReceivingInput != null)
            {
                return;
            }

            #region Escape for exit
            if (InputManager.Keyboard.KeyPushed(Keys.Escape))
            {
                OkCancelWindow ocw = GuiManager.ShowOkCancelWindow("Exit ParticleEditor?  Unsaved data will be lost", "Exit?");
                ocw.OkClick += new GuiMessage(GuiData.Messages.ExitOk);
            }
            #endregion

            #region press space to emit current emitter
            if (InputManager.Keyboard.KeyPushed(Keys.Space) && AppState.Self.CurrentEmitter != null)
            {
                AppState.Self.CurrentEmitter.Emit(null);
            }
            #endregion

            #region Ctrl + C for copying emitter
            if ((InputManager.Keyboard.KeyDown(Keys.LeftControl) || InputManager.Keyboard.KeyDown(Keys.RightControl)) && InputManager.Keyboard.KeyPushed(Keys.C))
            {
                EditorData.CopyCurrentEmitter();
            }
            #endregion

            #region pressing C to clear all particles
            else if (InputManager.Keyboard.KeyPushed(Keys.C))
            {
                GuiData.ActivityWindow.ClearAllParticles();
            }
            #endregion

            #region pressing delete to delete the current emitter
            if (InputManager.Keyboard.KeyPushed(Keys.Delete))
            {
                DeleteCurrentEmitter();
            }
            #endregion

            if (InputManager.Keyboard.KeyPushed(Keys.A))
            {
                GuiData.ToolsWindow.attachObject.Press();
            }
            if (InputManager.Keyboard.KeyPushed(Keys.M))
            {
                GuiData.ToolsWindow.moveObject.Press();
            }
        }