private void Hit(bool destroy = true)
 {
     this.OnHit();
     if (this.onHit.IsNotNull())
     {
         this.onHit();
     }
     if (this.TargetCurrent)
     {
         if (this.UseEffects)
         {
             if (this.AttachEndEffectToTarget)
             {
                 LSEffect lSEffect = EffectManager.CreateEffect(this.HitFX);
                 lSEffect.CachedTransform.parent        = this.Target.VisualCenter;
                 lSEffect.CachedTransform.localPosition = Vector3.up;
                 lSEffect.CachedTransform.rotation      = this.cachedTransform.rotation;
                 lSEffect.Initialize();
             }
             else
             {
                 //Certain targeting types collide with a target
                 if (this.TargetingBehavior == TargetingType.Homing)
                 {
                     EffectManager.CreateCollisionEffect(this.HitFX, this, Target.Body);
                 }
                 else
                 {
                     EffectManager.CreateEffect(this.HitFX, this.cachedTransform.position, this.cachedTransform.rotation);
                 }
             }
         }
     }
     if (destroy)
     {
         ProjectileManager.EndProjectile(this);
     }
 }
        public void Simulate()
        {
            this.AliveTime++;

            if (this.AliveTime > this.MaxDuration)
            {
                ProjectileManager.EndProjectile(this);
                return;
            }
            switch (this.TargetingBehavior)
            {
            case TargetingType.Timed:
                this.CountDown--;

                if (!IsLasting)
                {
                    if (this.CountDown <= 0)
                    {
                        IsLasting = true;
                        tickTimer = 0;
                    }
                }
                if (IsLasting)
                {
                    tickTimer--;
                    if (tickTimer <= 0)
                    {
                        tickTimer = TickRate;
                        this.Hit((this.AliveTime + TickRate - this.Delay) >= this.LastingDuration);
                    }
                }
                break;

            case TargetingType.Homing:
                if (this.TargetingBehavior == TargetingType.Homing && this.HitBehavior == HitType.Single && this.Target.SpawnVersion != this.TargetVersion)
                {
                    //Switch to positional to move to target's last position and not seek deceased target
                    this.TargetingBehavior = TargetingType.Positional;
                    Target        = null;
                    TargetCurrent = false;
                    goto case TargetingType.Positional;
                }
                if (this.CheckCollision())
                {
                    this.TargetPosition = this.Target.Body._position;
                    this.Hit();
                }
                else
                {
                    TargetPosition    = Target.Body.Position;
                    this.TargetHeight = this.Target.Body.HeightPos + Target.Body.Height / 2;

                    MoveToTargetPosition();
                }
                break;

            case TargetingType.Directional:
                RaycastMove(this.Velocity);
                break;

            case TargetingType.Positional:
                MoveToTargetPosition();

                break;
            }
        }