Exemplo n.º 1
0
        protected override void OnCollision(DestroyableBase hitEnt)
        {
            // Always remove projectile on collision.
            GamePool.FlagForPurge(ID);

            // Kill particle trail (bullet)
            if (WeaponBulletParticleEffect != null)
            {
                GetParticleEmitter(1).Kill();
            }
        }
Exemplo n.º 2
0
        public override void OnCollision(CollisionEvent collisionEvent)
        {
            // Always remove projectile on collision.
            GamePool.FlagForPurge(Entity.Id);

            // Kill particle trail (bullet)
            if (WeaponBulletParticleEffect != null)
            {
                Entity.GetParticleEmitter(1).Kill();
            }
        }
Exemplo n.º 3
0
 public override Vec3 Move()
 {
     if (LifeTime > 0)
     {
         LifeTime -= FrameTime.Current;
     }
     else
     {
         GamePool.FlagForPurge(ID);                 // Let destroy current projectile.
     }
     return(base.Move());
 }
Exemplo n.º 4
0
 public override Vector3 Move()
 {
     if (LifeTime > 0)
     {
         LifeTime -= FrameTime.Delta;
     }
     else
     {
         GamePool.FlagForPurge(Entity.Id);                 // Let destroy current projectile.
     }
     return(base.Move());
 }
Exemplo n.º 5
0
        public void ProcessHit(bool lethal = false)
        {
            if (_impactCoolDownFrameCount > 0)
            {
                return;
            }

            DrainLife(HitDamage);
            DestroyParticleEffect.Spawn(Position);
            if (lethal)
            {
                DrainLife(MaxLife);
            }
            Hud.CurrentHud.SetEnergy(Life);

            if (Life == 0)
            {
                GamePool.FlagForPurge(ID);
                for (int i = 0; i < _weapons.Count; i++)
                {
                    GamePool.FlagForPurge(_weapons [i].ID);
                }
                Destroy();
            }
            else
            {
                // Based on the previous frametime, calculate how many frames might be needed before 2 more seconds are over
                _impactCoolDownFrameCount = (int)(2f / FrameTime.Delta);

                int framesForEachBlink = _impactCoolDownFrameCount / 10;

                // Set individual frames used to start- & stop blinking effects
                for (int i = 0; i < _impactCoolDownFrames.Length; i++)
                {
                    _impactCoolDownFrames[i] = _impactCoolDownFrameCount - (framesForEachBlink * (i - 1));
                }
            }
        }