Пример #1
0
        protected override void initWithPrefabObj(GameObject obj)
        {
            base.initWithPrefabObj(obj);
            _isAutoDestory = true;
            _callback      = null;
            NSUtils.Assert(this.particleSystems != null && this.particleSystems.Length != 0, "CC3Particle({0}): ParticleSystem not found at path {1}.", this.gameObject.activeSelf, _path);

            _controllers = new CC3ParticleController[this.particleSystems.Length];
            for (int i = 0; i < _controllers.Length; i++)
            {
                _controllers[i]          = new CC3ParticleController(this.particleSystems[i]);
                _controllers[i].callback = onControllerCallback;
            }
        }
Пример #2
0
        void onControllerCallback(CC3ParticleController ctr)
        {
            bool hasRunning = false;

            for (int i = 0; i < _controllers.Length; i++)
            {
                if (_controllers[i].running)
                {
                    hasRunning = true;
                    break;
                }
            }
            if (!hasRunning)
            {
                if (_callback != null)
                {
                    _callback(this);
                }
                if (_isAutoDestory)
                {
                    removeFromParentAndCleanup(true);
                }
            }
        }