Inheritance: MonoBehaviour
Example #1
0
    public static void $Set0(object instance, float value, int index)
    {
        AnimatedColor expr_06_cp_0 = (AnimatedColor)instance;

        switch (index)
        {
        case 0:
            expr_06_cp_0.color.r = value;
            return;

        case 1:
            expr_06_cp_0.color.g = value;
            return;

        case 2:
            expr_06_cp_0.color.b = value;
            return;

        case 3:
            expr_06_cp_0.color.a = value;
            return;

        default:
            throw new ArgumentOutOfRangeException("index");
        }
    }
Example #2
0
 public UIColorAnimator(UIObject uiObj)
 {
     obj              = uiObj;
     IdleColor        = new AnimatedColor();
     HighlightedColor = new AnimatedColor();
     ClickedColor     = new AnimatedColor();
     ToggledColor     = new AnimatedColor();
 }
        public override Color?GetAlpha(Color lightColor)
        {
            Color blue = new Color(0, 229, 255, projectile.alpha);
            Color red  = new Color(255, 75, 43, projectile.alpha);
            Color anim = new AnimatedColor(blue, red).GetColor();

            return(anim);
        }
Example #4
0
        /// <inheritdoc />
        protected sealed override void OnInitialize()
        {
            base.OnInitialize();
            int    m      = Random.Next(5);
            Sprite sprite = new Sprite(AssetManager.Get <SpriteTexture>(this, "floor"), Color.White)
            {
                LayerDepth = 0.1f,
            };

            AddComponent(sprite);

            Vector2         startPos = Transform.Position;
            AnimatedVector2 f        = new AnimatedVector2();
            Curve           c        = new Curve();

            c.Keys.Add(new CurveKey(0, 0));
            c.Keys.Add(new CurveKey(1, 200));
            c.Keys.Add(new CurveKey(2, 100));
            c.Keys.Add(new CurveKey(2.5f, 300));
            f.SetCurve(c, c);
            f.Attach(new Ref <Vector2>(i => Transform.Position = i + startPos));
            Animation aC = new Animation(f)
            {
                WrapMode = WrapMode.PingPong
            };

            AnimatedVector2 f2 = new AnimatedVector2();
            Curve           c2 = new Curve();

            c2.Keys.Add(new CurveKey(0, 100));
            c2.Keys.Add(new CurveKey(1, 400));
            c2.Keys.Add(new CurveKey(2, 150));
            c2.Keys.Add(new CurveKey(2.5f, 250));
            f2.SetCurve(c2, c2);
            f2.Attach(new Ref <Vector2>(i => Transform.Position = i + startPos));

            AnimatedColor col = new AnimatedColor();

            col.SetLerp(Color.White, new Color((byte)Random.Next(255), (byte)Random.Next(255), (byte)Random.Next(255), (byte)1.0f), 2.5f);
            col.Attach(new Ref <Color>(color => {
                List <Sprite> sprites = GetAllComponents <Sprite>();
                for (int i = 0; i < sprites.Count; i++)
                {
                    sprites[i].Color = color;
                }
            }));

            Animation aC2 = new Animation(f2);

            aC2.Add(col);
            aC2.WrapMode = WrapMode.PingPong;

            anim = new BasicAnimator();
            anim.AddAnimation("Anim", aC);
            anim.AddAnimation("Anim2", aC2);
            AddComponent(anim);
            anim.Play("Anim2");
        }
Example #5
0
 static public int get_color(IntPtr l)
 {
     try {
         AnimatedColor self = (AnimatedColor)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.color);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #6
0
 static public int set_color(IntPtr l)
 {
     try {
         AnimatedColor     self = (AnimatedColor)checkSelf(l);
         UnityEngine.Color v;
         checkType(l, 2, out v);
         self.color = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
	public static int get_color(IntPtr l)
	{
		int result;
		try
		{
			AnimatedColor animatedColor = (AnimatedColor)LuaObject.checkSelf(l);
			LuaObject.pushValue(l, true);
			LuaObject.pushValue(l, animatedColor.color);
			result = 2;
		}
		catch (Exception e)
		{
			result = LuaObject.error(l, e);
		}
		return result;
	}
Example #8
0
        /// <summary>
        /// Configures the UIAnimation component by adding some generic animations: idle, highlight, click.
        /// </summary>
        /// <param name="idle">Idle animation state.</param>
        /// <param name="highlighted">Highlight animation state.</param>
        /// <param name="clicked">Click animation state.</param>
        /// <param name="toggled">Toggled animation state.</param>
        /// <param name="transition">Transition time in seconds between animation states.</param>
        public void Configure(Color idle, Color highlighted, Color clicked, Color?toggled, float transition)
        {
            IdleColor = new AnimatedColor();
            IdleColor.SetLerp(idle, idle, transition);
            IdleColor.Attach(new Ref <Color>(i => obj.SpriteColor = i));

            HighlightedColor = new AnimatedColor();
            HighlightedColor.SetLerp(idle, highlighted, transition);
            HighlightedColor.Attach(new Ref <Color>(i => obj.SpriteColor = i));

            ClickedColor = new AnimatedColor();
            ClickedColor.SetLerp(highlighted, clicked, transition);
            ClickedColor.Attach(new Ref <Color>(i => obj.SpriteColor = i));

            Animation idleAnimation = new Animation(IdleColor)
            {
                WrapMode = WrapMode.Once
            };
            Animation highlightedAnimation = new Animation(HighlightedColor)
            {
                WrapMode = WrapMode.Once
            };
            Animation clickedAnimation = new Animation(ClickedColor)
            {
                WrapMode = WrapMode.Once
            };
            Animation toggledAnimation = null;

            if (toggled.HasValue)
            {
                Color col = toggled.Value;
                ToggledColor = new AnimatedColor();
                ToggledColor.SetLerp(highlighted, col, transition);
                ToggledColor.Attach(new Ref <Color>(i => obj.SpriteColor = i));
                toggledAnimation = new Animation(ToggledColor)
                {
                    WrapMode = WrapMode.Once
                };
            }

            Configure(idleAnimation, highlightedAnimation, clickedAnimation, toggledAnimation);
        }
Example #9
0
    public static float $Get0(object instance, int index)
    {
        AnimatedColor expr_06_cp_0 = (AnimatedColor)instance;

        switch (index)
        {
        case 0:
            return(expr_06_cp_0.color.r);

        case 1:
            return(expr_06_cp_0.color.g);

        case 2:
            return(expr_06_cp_0.color.b);

        case 3:
            return(expr_06_cp_0.color.a);

        default:
            throw new ArgumentOutOfRangeException("index");
        }
    }