Esempio n. 1
0
        public void Update2(SAMTime gameTime)
        {
            if (FloatMath.FloatInequals(_value.ActualValue, _value.TargetValue))
            {
                _value.Update(gameTime);
                _text.Text = ((int)_value.ActualValue).ToString();
            }

            _value.Set(MainGame.Inst.Profile.ScoreSCCM);

            UpdateRelativePosition();
        }
Esempio n. 2
0
        protected override void DoUpdate(SAMTime gameTime, InputState istate)
        {
            _icon.RenderScaleOverride = 1 + FloatMath.Sin(gameTime.TotalElapsedSeconds * 2) * 0.05f;
            _icon.Rotation            = 0.05f * gameTime.TotalElapsedSeconds * FloatMath.TAU;

            if (FloatMath.FloatInequals(_value.ActualValue, _value.TargetValue))
            {
                _value.Update(gameTime);
                _text.Text = ((int)_value.ActualValue).ToString();
            }

            UpdateRelativePosition();
        }
Esempio n. 3
0
        public void Update2(SAMTime gameTime)
        {
            _icon.RenderScaleOverride = 1 + FloatMath.Sin(gameTime.TotalElapsedSeconds * 2.5f) * 0.10f;

            if (FloatMath.FloatInequals(_value.ActualValue, _value.TargetValue))
            {
                _value.Update(gameTime);
                _text.Text = ((int)_value.ActualValue).ToString();
            }

            _value.Set(MainGame.Inst.Profile.ScoreStars);

            UpdateRelativePosition();
        }
Esempio n. 4
0
        internal ParticleEmitterConfig(ParticleEmitterConfigBuilder b, TextureRegion2D[] texArray, float size, float length)
        {
            Texture       = texArray[b.TextureIndex];
            TextureBounds = Texture.Bounds;
            TextureCenter = Texture.Center();
            TextureSize   = TextureBounds.Width;

            SpawnRate = b.SpawnRate * length;

            SpawnDelay = 1f / b.SpawnRate;

            ParticleLifetimeMin      = b.ParticleLifetimeMin;
            ParticleLifetimeMax      = b.ParticleLifetimeMax;
            ParticleRespawnTime      = b.ParticleLifetimeMax;
            ParticleLifetimeIsRandom = FloatMath.FloatInequals(ParticleLifetimeMin, ParticleLifetimeMax);

            ParticleSpawnAngleMin      = b.ParticleSpawnAngleMin;
            ParticleSpawnAngleMax      = b.ParticleSpawnAngleMax;
            ParticleSpawnAngleIsRandom = FloatMath.FloatInequals(ParticleSpawnAngleMin, ParticleSpawnAngleMax);
            ParticleSpawnAngleIsTotal  = FloatMath.FloatInequals(ParticleSpawnAngleMin, ParticleSpawnAngleMax) && FloatMath.EpsilonEquals(FloatMath.NormalizeAngle(ParticleSpawnAngleMin), FloatMath.NormalizeAngle(ParticleSpawnAngleMax));
            if (!ParticleSpawnAngleIsRandom)
            {
                FixedParticleSpawnAngle = vectorOne.Rotate(ParticleSpawnAngleMin);
            }

            ParticleVelocityMin      = b.ParticleVelocityMin;
            ParticleVelocityMax      = b.ParticleVelocityMax;
            ParticleVelocityIsRandom = FloatMath.FloatInequals(ParticleVelocityMin, ParticleVelocityMax);

            ParticleAlphaInitial = b.ParticleAlphaInitial;
            ParticleAlphaFinal   = b.ParticleAlphaFinal;

            ParticleSizeInitialMin      = b.ParticleSizeInitialMin * size;
            ParticleSizeInitialMax      = b.ParticleSizeInitialMax * size;
            ParticleSizeInitialIsRandom = FloatMath.FloatInequals(ParticleSizeInitialMin, ParticleSizeInitialMax);

            ParticleSizeFinalMin      = b.ParticleSizeFinalMin * size;
            ParticleSizeFinalMax      = b.ParticleSizeFinalMax * size;
            ParticleSizeFinalIsRandom = FloatMath.FloatInequals(ParticleSizeFinalMin, ParticleSizeFinalMax);

            ColorInitial    = b.ColorInitial;
            ColorFinal      = b.ColorFinal;
            ColorIsChanging = (ColorInitial != ColorFinal);
        }
Esempio n. 5
0
        private void UpdateCog(SAMTime gameTime)
        {
            if (CannonHealth.ActualValue >= 1 || (CannonHealth.ActualValue <= 0 && Fraction.IsNeutral))
            {
                var rotInc = BASE_COG_ROTATION_SPEED * Fraction.BulletMultiplicator * RealBoost * gameTime.ElapsedSeconds;

                cannonCogRotation = (cannonCogRotation + rotInc) % (FloatMath.PI / 2);
            }
            else
            {
                if (FloatMath.FloatInequals(cannonCogRotation, FloatMath.PI / 2))
                {
                    var rotInc = BASE_COG_ROTATION_SPEED * Fraction.GetNeutral().BulletMultiplicator *RealBoost *gameTime.ElapsedSeconds;

                    bool isLimited;
                    cannonCogRotation = FloatMath.LimitedInc(cannonCogRotation, rotInc, FloatMath.PI / 2, out isLimited);
                    if (isLimited)
                    {
                        cannonCogRotation = FloatMath.PI / 2;
                    }
                }
            }
        }
Esempio n. 6
0
        public void Update2(SAMTime gameTime)
        {
            var whud = HUD as GDWorldHUD;

            _text.Text = MainGame.Inst.Profile.TotalPoints.ToString();

            _icon.RenderScaleOverride = 1 + FloatMath.Sin(gameTime.TotalElapsedSeconds * 2) * 0.05f;

            if (whud != null && whud.TopLevelDisplay != null)
            {
                _offset.Set(whud.TopLevelDisplay.RelativeBottom + HUD.SafetyMargins.MarginTop);
            }
            else
            {
                _offset.Set(0);
            }

            _offset.Update(gameTime);
            if (_offset.ActualValue < _offset.TargetValue)
            {
                _offset.SetForce(_offset.TargetValue);
            }

            if (FloatMath.FloatInequals(_value.ActualValue, _value.TargetValue))
            {
                _value.Update(gameTime);
                _text.Text = ((int)_value.ActualValue).ToString();
            }

            var rp = new FPoint(10, _offset.ActualValue + 10);

            if (rp != RelativePosition)
            {
                RelativePosition = rp;
                Revalidate();
            }
        }