/// <summary>
        /// Adds additional logic to an emitter trigger event.
        /// </summary>
        /// <param name="context">The trigger context.</param>
        public override void Process(ref TriggerContext context)
        {
            float lastTime;
            int   releaseQuantity = 0;

            if (_lastTime.TryGetValue(context.ProxyIndex, out lastTime))
            {
                float elaspsed     = _totalTime - lastTime;
                float fracQuantity = context.ReleaseQuantity * elaspsed;

                if ((int)fracQuantity <= context.ReleaseQuantity)
                {
                    releaseQuantity = (int)fracQuantity;
                    lastTime        = _totalTime - (fracQuantity - releaseQuantity) / context.ReleaseQuantity;
                }
                else
                {
                    lastTime = _totalTime;
                }

                _lastTime[context.ProxyIndex] = lastTime;
            }
            else
            {
                _lastTime[context.ProxyIndex] = lastTime;
            }

            context.ReleaseQuantity = releaseQuantity;
        }
Exemplo n.º 2
0
 /// <summary>
 /// Adds additional logic to an emitter trigger event.
 /// </summary>
 /// <param name="context">The trigger context.</param>
 public override void Process(ref TriggerContext context)
 {
     if (this.ViewFrustum.Contains(context.Position) != ContainmentType.Contains)
     {
         context.Cancelled = true;
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Adds additional logic to an emitter trigger event.
        /// </summary>
        /// <param name="context">The trigger context.</param>
        public override void Process(ref TriggerContext context)
        {
            Vector3 offset = RandomUtil.NextUnitVector3() * this.Size;

            context.Position.X += offset.X;
            context.Position.Y += offset.Y;
            context.Position.Z += offset.Z;
        }
 /// <summary>
 /// Adds additional logic to an emitter trigger event.
 /// </summary>
 /// <param name="context">The trigger context.</param>
 public override void Process(ref TriggerContext context)
 {
     Vector3 offset = RandomUtil.NextUnitVector3() * this.Size;
     
     context.Position.X += offset.X;
     context.Position.Y += offset.Y;
     context.Position.Z += offset.Z;
 }
Exemplo n.º 5
0
        /// <summary>
        /// Adds additional logic to an emitter trigger event.
        /// </summary>
        /// <param name="context">A reference to the trigger context.</param>
        public void Process(ref TriggerContext context)
        {
            foreach (var controller in this)
            {
                controller.Process(ref context);

                if (context.Cancelled)
                {
                    break;
                }
            }
        }
Exemplo n.º 6
0
 /// <summary>
 /// Adds additional logic to an emitter trigger event.
 /// </summary>
 /// <param name="context">The trigger context.</param>
 public override void Process(ref TriggerContext context)
 {
     float lastTrigger;
     if(LastTriggers.TryGetValue(context.ProxyIndex,out lastTrigger))
     {
         if((TotalSeconds - lastTrigger) < CooldownPeriod)
         {
             context.Cancelled = true;
         }
         else
         {
             LastTriggers[context.ProxyIndex] = TotalSeconds;
         }
     }
     else
     {
         LastTriggers[context.ProxyIndex] = TotalSeconds;
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// Adds additional logic to an emitter trigger event.
        /// </summary>
        /// <param name="context">The trigger context.</param>
        public override void Process(ref TriggerContext context)
        {
            float lastTrigger;

            if (LastTriggers.TryGetValue(context.ProxyIndex, out lastTrigger))
            {
                if ((TotalSeconds - lastTrigger) < CooldownPeriod)
                {
                    context.Cancelled = true;
                }
                else
                {
                    LastTriggers[context.ProxyIndex] = TotalSeconds;
                }
            }
            else
            {
                LastTriggers[context.ProxyIndex] = TotalSeconds;
            }
        }
        /// <summary>
        /// Adds additional logic to an emitter trigger event.
        /// </summary>
        /// <param name="context">The trigger context.</param>
        public override void Process(ref TriggerContext context)
        {
            float lastTime;
            int releaseQuantity = 0;
            if(_lastTime.TryGetValue(context.ProxyIndex,out lastTime))
            {
                float elaspsed = _totalTime - lastTime;
                float fracQuantity = context.ReleaseQuantity * elaspsed;

                if ((int)fracQuantity <= context.ReleaseQuantity)
                {
                    releaseQuantity = (int)fracQuantity;
                    lastTime = _totalTime - (fracQuantity - releaseQuantity) / context.ReleaseQuantity;
                }
                else
                    lastTime = _totalTime;

                _lastTime[context.ProxyIndex] = lastTime;
            }
            else
                _lastTime[context.ProxyIndex] = lastTime; 

            context.ReleaseQuantity = releaseQuantity;
        }
Exemplo n.º 9
0
 /// <summary>
 /// Adds additional logic to an emitter trigger event.
 /// </summary>
 /// <param name="context">The trigger context.</param>
 public override void Process(ref TriggerContext context)
 {
     context.Position.X += this.TriggerOffset.X;
     context.Position.Y += this.TriggerOffset.Y;
     context.Position.Z += this.TriggerOffset.Z;
 }
 /// <summary>
 /// Adds additional logic to an emitter trigger event.
 /// </summary>
 /// <param name="context">The trigger context.</param>
 public override void Process(ref TriggerContext context)
 {
     if (this.ViewFrustum.Contains(context.Position) != ContainmentType.Contains)
         context.Cancelled = true;
 }
Exemplo n.º 11
0
 /// <summary>
 /// Adds additional logic to an emitter trigger event.
 /// </summary>
 /// <param name="context">The trigger context.</param>
 public override void Process(ref TriggerContext context)
 {
     context.Rotation.X += this.TriggerRotation.X;
     context.Rotation.Y += this.TriggerRotation.Y;
     context.Rotation.Z += this.TriggerRotation.Z;
 }
Exemplo n.º 12
0
 /// <summary>
 /// Adds additional logic to an emitter trigger event.
 /// </summary>
 /// <param name="context">A reference to the trigger context.</param>
 public abstract void Process(ref TriggerContext context);
 /// <summary>
 /// Adds additional logic to an emitter trigger event.
 /// </summary>
 /// <param name="context">The trigger context.</param>
 public override void Process(ref TriggerContext context)
 {
     context.Rotation.X += this.TriggerRotation.X;
     context.Rotation.Y += this.TriggerRotation.Y;
     context.Rotation.Z += this.TriggerRotation.Z;
 }
Exemplo n.º 14
0
 /// <summary>
 /// Adds additional logic to an emitter trigger event.
 /// </summary>
 /// <param name="context">The trigger context.</param>
 public override void Process(ref TriggerContext context)
 {
     context.Position.X += this.TriggerOffset.X;
     context.Position.Y += this.TriggerOffset.Y;
     context.Position.Z += this.TriggerOffset.Z;
 }