public MultiplayerControlSwitch(Vector2 position)
            : base(position)
        {
            base.Depth             = 2000;
            base.Add(ControlSwitch = new ControlSwitch(false, 0));

            base.Add(new PlayerCollider(OnPlayer, null, new Hitbox(30f, 30f, -15f, -15f)));
            base.Add(icon);
            base.Add(bloom = new BloomPoint(0f, 16f));
            bloom.Alpha    = 0f;
            icon.Add("idle", "", 0f, default(int));
            icon.Add("spin", "", 0.1f, new Chooser <string>("spin", 1f), 0, 1, 2, 3, 4, 5);
            icon.Play("spin", false, false);
            icon.Color = inactiveColor;
            icon.CenterOrigin();
            base.Collider = new Hitbox(16f, 16f, -8f, -8f);
            base.Add(new TheoCrystalCollider(OnTheoCrystal, new Hitbox(20f, 20f, -10f, -10f)));
            base.Add(new SeekerCollider(OnSeeker, new Hitbox(24f, 24f, -12f, -12f)));

            ControlSwitch.OnActivate = delegate
            {
                wiggler.Start();
                for (int i = 0; i < 32; i++)
                {
                    float num = Calc.Random.NextFloat(6.28318548f);
                    //level.Particles.Emit(P_FireWhite, base.Position + Calc.AngleToVector(num, 6f), num);
                }
                icon.Rate = 4f;
            };

            ControlSwitch.OnDeactivate = delegate
            {
                wiggler.StopAndClear();
                icon.Rate = 0.1f;
                icon.Play("spin", false, false);
            };

            ControlSwitch.OnFinish = delegate
            {
                ease = 0f;
            };
            ControlSwitch.OnStartFinished = delegate
            {
                icon.Rate = 0.1f;
                icon.Play("spin", false, false);
                ease = 1f;
            };

            base.Add(wiggler = Wiggler.Create(0.5f, 4f, delegate(float v)
            {
                pulse = Vector2.One * (1f + v * 0.25f);
            }, false, false));
            base.Add(new VertexLight(Color.White, 0.8f, 16, 32));
            base.Add(touchSfx = new SoundSource());
        }
Esempio n. 2
0
        public static bool Check(Scene scene)
        {
            ControlSwitch component = scene.Tracker.GetComponent <ControlSwitch>();

            return(component?.Finished ?? false);
        }