Example #1
0
 //in most cases we should pass in our scene number, current color, available colors, and index
 public LoadSceneData(string _s, ColorIDs.Colors _currC, List <ColorIDs.Colors> _avC, int _i, Vector3 pos)
 {
     sceneName             = _s;
     saved_CurrentColor    = _currC;
     saved_AvailableColors = new List <ColorIDs.Colors>();
     saved_StartPos        = new Vector3(pos.x, pos.y, pos.z);
     foreach (ColorIDs.Colors c in _avC)
     {
         saved_AvailableColors.Add(c);
     }
     saved_index = _i;
 }
Example #2
0
 //adds the color specified, switches to it, special case for first color added
 public static void AddColor(ColorIDs.Colors c)
 {
     if (!AvailableColors.Contains(c))
     {
         AvailableColors.Add(c);
         SwitchColor();
     }
     if (AvailableColors.Contains(ColorIDs.Colors.NONE))
     {
         //special case: for the first color added, remove NONE from the available colors
         //list and force the index back down to the first element (which is now our color)
         AvailableColors.Remove(ColorIDs.Colors.NONE);
         index = 0;
     }
 }
Example #3
0
    //this is just a switch statement. return the right Color for the right ColorIDs.Colors value
    public static Color MakeColor(ColorIDs.Colors c)
    {
        switch (c)
        {
        case ColorIDs.Colors.Green:
            return(Color.green);

        case ColorIDs.Colors.Blue:
            return(Color.blue);

        case ColorIDs.Colors.Red:
            return(Color.red);

        default:
            return(Color.gray);
        }
    }
Example #4
0
    //take the passed ColorIDs.Colors value, make it an actual Color, generate a godforsaken Gradient
    //from it with full opacity to full transparency, and set that Gradient to the particle system's
    //official "color over lifetime" value for the particles
    public void UpdateColor(ColorIDs.Colors c)
    {
        Color    newColor = PlayerManager.MakeColor(c);
        Gradient grad     = new Gradient();

        //what's with this indenting, you ask? yeah, it's weird, but there's a reason
        grad.SetKeys(new GradientColorKey[] { new GradientColorKey(newColor, 0.0f),   //incomplete array
                                              new GradientColorKey(newColor, 1.0f) }, //completed first-argument array
                     new GradientAlphaKey[] { new GradientAlphaKey(1.0f, 0.0f),       //incomplete array
                                              new GradientAlphaKey(0.0f, 1.0f) });    //completed second-argument array
        var col = partSys.colorOverLifetime;                                          //"We CaN't ChAnGe ThE cOlOr UnLeSs YoU mAkE tHiS a VaR" -Unity

        col.color = grad;

        newColor.a = sphereTransparency;
        _material.SetColor("_Color", newColor);
    }