@ -40,7 +40,7 @@ public class ParticleTrailController : MonoBehaviour
case ParticleTrail . Blood :
case ParticleTrail . Blood :
{
{
main . gravityModifierMultiplier = 0.05f ;
main . gravityModifierMultiplier = 0.05f ;
main . startColor = SetupGradient ( BloodColorKeys ) ;
main . startColor = new ParticleSystem . MinMaxGradient ( BloodColorMin , BloodColorMax ) ;
shape . scale = new Vector3 ( 6f , 6f , 6f ) ;
shape . scale = new Vector3 ( 6f , 6f , 6f ) ;
break ;
break ;
@ -48,13 +48,20 @@ public class ParticleTrailController : MonoBehaviour
case ParticleTrail . Tracer :
case ParticleTrail . Tracer :
case ParticleTrail . Tracer2 :
case ParticleTrail . Tracer2 :
{
{
// Split trails, e.g. Scrag projectile
main . startLifetime = 0.5f ;
main . startColor = type = = ParticleTrail . Tracer
? new ParticleSystem . MinMaxGradient ( TracerColorMin , TracerColorMax )
: new ParticleSystem . MinMaxGradient ( Tracer2ColorMin , Tracer2ColorMax ) ;
var velocityOverLifetime = effect . velocityOverLifetime ;
velocityOverLifetime . enabled = true ;
velocityOverLifetime . radial = new ParticleSystem . MinMaxCurve ( - 3 0 , 3 0 ) ;
break ;
break ;
}
}
case ParticleTrail . SlightBlood :
case ParticleTrail . SlightBlood :
{
{
main . gravityModifierMultiplier = 0.05f ;
main . gravityModifierMultiplier = 0.05f ;
main . startColor = SetupGradient ( BloodColorKeys ) ;
main . startColor = new ParticleSystem . MinMaxGradient ( BloodColorMin , BloodColorMax ) ;
shape . scale = new Vector3 ( 6f , 6f , 6f ) ;
shape . scale = new Vector3 ( 6f , 6f , 6f ) ;
emission . rateOverDistance = 1.0f / ( interval + 3 ) ;
emission . rateOverDistance = 1.0f / ( interval + 3 ) ;
@ -63,7 +70,7 @@ public class ParticleTrailController : MonoBehaviour
case ParticleTrail . VoreBall :
case ParticleTrail . VoreBall :
{
{
main . startLifetime = 0.3f ;
main . startLifetime = 0.3f ;
main . startColor = SetupGradient ( VoreColorKeys ) ;
main . startColor = new ParticleSystem . MinMaxGradient ( VoreColorMin , VoreColorMax ) ;
shape . scale = new Vector3 ( 1 6f , 1 6f , 1 6f ) ;
shape . scale = new Vector3 ( 1 6f , 1 6f , 1 6f ) ;
break ;
break ;
@ -78,15 +85,6 @@ public class ParticleTrailController : MonoBehaviour
transform . position = endPosition ;
transform . position = endPosition ;
}
}
private static ParticleSystem . MinMaxGradient SetupGradient ( GradientColorKey [ ] colorKeys )
{
return new ParticleSystem . MinMaxGradient ( new Gradient
{
mode = GradientMode . Blend ,
colorKeys = colorKeys ,
} ) ;
}
private static ParticleSystem . MinMaxGradient SetupGradients ( GradientColorKey [ ] minKeys , GradientColorKey [ ] maxKeys )
private static ParticleSystem . MinMaxGradient SetupGradients ( GradientColorKey [ ] minKeys , GradientColorKey [ ] maxKeys )
{
{
return new ParticleSystem . MinMaxGradient
return new ParticleSystem . MinMaxGradient
@ -97,6 +95,8 @@ public class ParticleTrailController : MonoBehaviour
} ;
} ;
}
}
// TODO: these colors ought to be initialized from the Quake palette instead of being hard-coded.
// That will allow them to work with custom palettes from total conversions.
private static readonly GradientColorKey [ ] RocketColorKeys =
private static readonly GradientColorKey [ ] RocketColorKeys =
{
{
new GradientColorKey ( new Color32 ( 2 2 3 , 1 7 1 , 3 9 , 2 5 5 ) , 0.167f ) ,
new GradientColorKey ( new Color32 ( 2 2 3 , 1 7 1 , 3 9 , 2 5 5 ) , 0.167f ) ,
@ -121,15 +121,15 @@ public class ParticleTrailController : MonoBehaviour
new GradientColorKey ( new Color32 ( 4 7 , 4 7 , 4 7 , 2 5 5 ) , 1.0f ) ,
new GradientColorKey ( new Color32 ( 4 7 , 4 7 , 4 7 , 2 5 5 ) , 1.0f ) ,
} ;
} ;
private static readonly GradientColorKey [ ] BloodColorKeys =
{
new GradientColorKey ( new Color32 ( 3 1 , 0 , 0 , 2 5 5 ) , 0.5f ) ,
new GradientColorKey ( new Color32 ( 5 5 , 0 , 0 , 2 5 5 ) , 1.0f ) ,
} ;
private static readonly Color BloodColorMin = new Color32 ( 3 1 , 0 , 0 , 2 5 5 ) ;
private static readonly Color BloodColorMax = new Color32 ( 5 5 , 0 , 0 , 2 5 5 ) ;
private static readonly GradientColorKey [ ] VoreColorKeys =
{
new GradientColorKey ( new Color32 ( 9 5 , 5 1 , 6 3 , 2 5 5 ) , 0.5f ) ,
new GradientColorKey ( new Color32 ( 5 9 , 3 1 , 3 5 , 2 5 5 ) , 1.0f ) ,
} ;
private static readonly Color TracerColorMin = new Color32 ( 2 7 , 2 7 , 0 , 2 5 5 ) ;
private static readonly Color TracerColorMax = new Color32 ( 8 3 , 8 3 , 1 1 , 2 5 5 ) ;
private static readonly Color Tracer2ColorMin = new Color32 ( 1 4 7 , 3 1 , 7 , 2 5 5 ) ;
private static readonly Color Tracer2ColorMax = new Color32 ( 2 3 9 , 1 9 1 , 1 1 9 , 2 5 5 ) ;
private static readonly Color VoreColorMin = new Color32 ( 9 5 , 5 1 , 6 3 , 2 5 5 ) ;
private static readonly Color VoreColorMax = new Color32 ( 5 9 , 3 1 , 3 5 , 2 5 5 ) ;
}
}