protected virtual void Hit(RayCastResults ray)
 {
     if (ray.HitEntity != null && ray.HitEntity.TryGetComponent(out DamageableComponent damage))
     {
         damage.TakeDamage(DamageType.Heat, 10);
     }
 }
示例#2
0
 protected virtual void Hit(RayCastResults ray, float damageModifier)
 {
     if (ray.HitEntity != null && ray.HitEntity.TryGetComponent(out DamageableComponent damage))
     {
         damage.TakeDamage(DamageType.Heat, (int)Math.Round(_damage * damageModifier, MidpointRounding.AwayFromZero));
         //I used Math.Round over Convert.toInt32, as toInt32 always rounds to
         //even numbers if halfway between two numbers, rather than rounding to nearest
     }
 }
        protected virtual void AfterEffects(IEntity user, RayCastResults ray, Angle angle)
        {
            var time   = IoCManager.Resolve <IGameTiming>().CurTime;
            var offset = angle.ToVec() * ray.Distance / 2;

            EffectSystemMessage message = new EffectSystemMessage
            {
                EffectSprite = spritename,
                Born         = time,
                DeathTime    = time + TimeSpan.FromSeconds(1),
                Size         = new Vector2(ray.Distance, 1f),
                Coordinates  = user.GetComponent <TransformComponent>().LocalPosition.Translated(offset),
                //Rotated from east facing
                Rotation   = (float)angle.Theta,
                ColorDelta = new Vector4(0, 0, 0, -1500f),
                Color      = new Vector4(255, 255, 255, 750),
                Shaded     = false
            };

            IoCManager.Resolve <IEntitySystemManager>().GetEntitySystem <EffectSystem>().CreateParticle(message);
        }
示例#4
0
        protected virtual void AfterEffects(IEntity user, RayCastResults ray, Angle angle, float energyModifier)
        {
            var time    = IoCManager.Resolve <IGameTiming>().CurTime;
            var dist    = ray.Distance;
            var offset  = angle.ToVec() * dist / 2;
            var message = new EffectSystemMessage
            {
                EffectSprite = _spritename,
                Born         = time,
                DeathTime    = time + TimeSpan.FromSeconds(1),
                Size         = new Vector2(dist, 1f),
                Coordinates  = user.Transform.GridPosition.Translated(offset),
                //Rotated from east facing
                Rotation   = (float)angle.Theta,
                ColorDelta = new Vector4(0, 0, 0, -1500f),
                Color      = Vector4.Multiply(new Vector4(255, 255, 255, 750), energyModifier),

                Shaded = false
            };

            EntitySystem.Get <EffectSystem>().CreateParticle(message);
            Owner.GetComponent <SoundComponent>().Play(_fireSound, AudioParams.Default.WithVolume(-5));
        }
        protected virtual void AfterEffects(IEntity user, RayCastResults ray, Angle angle)
        {
            var time    = IoCManager.Resolve <IGameTiming>().CurTime;
            var dist    = ray.DidHitObject ? ray.Distance : MaxLength;
            var offset  = angle.ToVec() * dist / 2;
            var message = new EffectSystemMessage
            {
                EffectSprite = Spritename,
                Born         = time,
                DeathTime    = time + TimeSpan.FromSeconds(1),
                Size         = new Vector2(dist, 1f),
                Coordinates  = user.Transform.GridPosition.Translated(offset),
                //Rotated from east facing
                Rotation   = (float)angle.Theta,
                ColorDelta = new Vector4(0, 0, 0, -1500f),
                Color      = new Vector4(255, 255, 255, 750),
                Shaded     = false
            };
            var mgr = IoCManager.Resolve <IEntitySystemManager>();

            mgr.GetEntitySystem <EffectSystem>().CreateParticle(message);
            mgr.GetEntitySystem <AudioSystem>().Play("/Audio/laser.ogg", Owner, AudioParams.Default.WithVolume(-5));
        }
示例#6
0
 public DebugRayData(Ray ray, float maxLength, RayCastResults results)
 {
     Ray       = ray;
     MaxLength = maxLength;
     Results   = results;
 }