Esempio n. 1
0
        internal static void OverrideColor(this SetSaberFakeGlowColor ssfgc, Color color)
        {
            Parametric3SliceSpriteController sliceSpriteController = Accessors.FakeGlowSliceSprite(ref ssfgc);

            sliceSpriteController.color = color * Accessors.FakeGlowTint(ref ssfgc);
            sliceSpriteController.Refresh();
        }
Esempio n. 2
0
        internal static void OverrideColor(this SetSaberGlowColor ssgc, Color color)
        {
            MeshRenderer          mesh  = Accessors.GlowMeshRenderer(ref ssgc);
            MaterialPropertyBlock block = Accessors.GlowMaterialPropertyBlock(ref ssgc);

            SetSaberGlowColor.PropertyTintColorPair[] tintPairs = Accessors.GlowPropertyTintPair(ref ssgc);
            if (block == null)
            {
                block = new MaterialPropertyBlock();
            }
            foreach (SetSaberGlowColor.PropertyTintColorPair ptcp in tintPairs)
            {
                block.SetColor(ptcp.property, color * ptcp.tintColor);
            }
            mesh.SetPropertyBlock(block);
        }
Esempio n. 3
0
        /// <summary>
        /// Change the color of a saber.
        /// </summary>
        /// <param name="_">The saber.</param>
        /// <param name="color">The color to change the saber to.</param>
        /// <param name="smc">The model controller of the saber.</param>
        /// <param name="tintColor">The tint color of the new color.</param>
        /// <param name="setSaberGlowColors">The glow color groups of the saber.</param>
        /// <param name="setSaberFakeGlowColors">The fake glow color groups of the saber.</param>
        /// <param name="light">The light of the saber.</param>
        public static void ChangeColor(this Saber _, Color color, SaberModelController smc, Color tintColor, SetSaberGlowColor[] setSaberGlowColors, SetSaberFakeGlowColor[] setSaberFakeGlowColors, TubeBloomPrePassLight light)
        {
            Accessors.TrailColor(ref Accessors.SaberTrail(ref smc)) = (color * tintColor).linear;

            for (int i = 0; i < setSaberGlowColors.Length; i++)
            {
                setSaberGlowColors[i].OverrideColor(color);
            }
            for (int i = 0; i < setSaberFakeGlowColors.Length; i++)
            {
                setSaberFakeGlowColors[i].OverrideColor(color);
            }
            if (light != null)
            {
                light.color = color;
            }
        }
Esempio n. 4
0
        /// <summary>
        /// Gets the color of a saber.
        /// </summary>
        /// <param name="saber">The saber to get the color of.</param>
        /// <returns></returns>
        public static Color GetColor(this Saber saber)
        {
            if (saber is IColorable saberColorable)
            {
                return(saberColorable.Color);
            }
            SaberModelController modelController = saber.gameObject.GetComponentInChildren <SaberModelController>(true);

            if (modelController is IColorable)
            {
                var colorable = modelController as IColorable;
                return(colorable.Color);
            }
            else if (modelController is SaberModelController smc)
            {
                return(Accessors.TrailColor(ref Accessors.SaberTrail(ref smc)).gamma);
            }
            return(Color.white);
        }
Esempio n. 5
0
        internal static IEnumerator ChangeColorCoroutine(Saber saber, Color color, float time = 0.05f)
        {
            if (time != 0)
            {
                yield return(new WaitForSeconds(time));
            }
            SaberModelController modelController = saber.gameObject.GetComponentInChildren <SaberModelController>(true);

            if (modelController is IColorable colorable)
            {
                colorable.SetColor(color);
            }
            if (modelController is SaberModelController smc)
            {
                Color tintColor = Accessors.ModelInitData(ref smc).trailTintColor;
                SetSaberGlowColor[]     setSaberGlowColors     = Accessors.SaberGlowColor(ref smc);
                SetSaberFakeGlowColor[] setSaberFakeGlowColors = Accessors.FakeSaberGlowColor(ref smc);
                TubeBloomPrePassLight   light = Accessors.SaberLight(ref smc);
                saber.ChangeColor(color, smc, tintColor, setSaberGlowColors, setSaberFakeGlowColors, light);
            }
        }
Esempio n. 6
0
 /// <summary>
 /// Changes the type of a saber type object.
 /// </summary>
 /// <param name="sto">The SaberTypeObject.</param>
 /// <param name="type">The Saber Type</param>
 public static void ChangeType(this SaberTypeObject sto, SaberType type)
 {
     Accessors.ObjectSaberType(ref sto) = type;
 }