コード例 #1
0
        /// <summary>
        /// Removes a Controller from the Emitter.
        /// </summary>
        /// <param name="controller">Controller to be removed.</param>
        /// <returns>True if the Controller was successfully removed, else false.</returns>
        public bool RemoveController(Controller controller)
        {
            if (!_controllers.Contains(controller)) { return false; }

            _controllers.Remove(controller);
            controller.UnSubscribe(this);
            return true;
        }
コード例 #2
0
        /// <summary>
        /// Applies a Controller to the Emitter.
        /// </summary>
        /// <param name="controller">Controller to apply.</param>
        /// <returns>True if the Controller was successfully applied, else false.</returns>
        /// <remarks>The engine is smart enough to prevent the same Controller being applied
        /// multiple times.</remarks>
        public bool ApplyController(Controller controller)
        {
            if (_controllers.Contains(controller)) { return false; }

            _controllers.Add(controller);
            controller.Subscribe(this);
            return true;
        }