Example #1
0
        private async Task fadeExplosionLight(PointLightEntity light)
        {
            TimeSince   timer         = 0;
            const float fadeTime      = 0.2f;
            float       maxBrightness = light.Brightness;

            while (timer < fadeTime)
            {
                if (light.IsValid())
                {
                    light.Brightness = (fadeTime - timer) / fadeTime * maxBrightness;
                }
                await GameTask.NextPhysicsFrame();
            }
            light.Delete();
        }
Example #2
0
        private async Task nextMapPreviewLogic()
        {
            await GameTask.DelaySeconds(1f);

            var preview = screen.Add.Panel("preview-container").Add.Panel("preview");
            var pack    = await Package.Fetch(nextMap, false);

            preview.Add.Label("Next Up:", "text");
            preview.Add.Panel("thumbnail").Style.Set("background-image", $"url({pack.Thumb})");
            prepareToChangeMap();
            while (true)
            {
                preview.Style.BackgroundColor = new Color(0.25f, 0.25f, 0.5f.LerpTo(0.75f, MathF.Sin(Time.Now * 2) * 0.5f + 0.5f));
                preview.Style.Dirty();
                await GameTask.NextPhysicsFrame();
            }
        }