コード例 #1
0
        public void Update(float deltaTime, bool trackButtonDown, bool previousTrackButtonDown)
        {
            if (disappearTimer == 1f)
            {
                Owner.Notes.Remove(this);
            }
            else if (Active)
            {
                var mostLikelyBeat = Owner.Notes.Where(n => n.Active).OrderBy(n => Math.Abs(TimeLeft)).FirstOrDefault();

                if (mostLikelyBeat == this)
                {
                    CheckHit(trackButtonDown, previousTrackButtonDown);
                }

                if (TimeLeft < -AbsoluteTimeLeniency)
                {
                    Owner.Break();
                    Destroy(false);
                }

                if (TimeLeft < 0.2f && !closeToEnd)
                {
                    closeToEnd = true;
                    vertOffset.Set(0f);
                }

                TimeLeft -= deltaTime;
            }

            vertOffset.Process(deltaTime);
            disappearTimer.Process(deltaTime);
        }
コード例 #2
0
        public RhythmMinigame(Vector2 position, Player owner, IRhythmWeapon item, int bPM, SoundEffect music)
        {
            Position = position;
            BPM      = bPM;

            maxTime = 60f / BPM;

            Notes      = new List <RhythmNote>();
            ComboScale = new InterpolatedFloat(0f, 0.1f, InterpolatedFloat.EaseInOut);
            BeatScale  = new InterpolatedFloat(0, 0.25f);

            Music = music.CreateInstance();

            Music.Volume   = 0;
            Music.IsLooped = true;
            Music.Play();

            MusicVolume = new InterpolatedFloat(0f, 0.25f);
            MusicVolume.Set(0.05f);

            Visibility = new InterpolatedFloat(0f, 0.5f, InterpolatedFloat.EaseInOut);
            Visibility.Set(1f);

            Main.OnTick += MinigameDisposal;

            Owner  = owner;
            Weapon = item;
        }
コード例 #3
0
 public virtual void Destroy(bool good)
 {
     if (!good)
     {
         Owner.Notes.Remove(this);
     }
     Active = false;
     disappearTimer.Set(1f);
 }
コード例 #4
0
        public void Beat()
        {
            Combo++;
            ComboScale.Set(Combo);

            BeatScale = new InterpolatedFloat(1f, 0.25f);
            BeatScale.Set(0f);
            Weapon.OnBeat(true, Combo);
            MusicVolume.Set(0.1f + Utils.Clamp(Combo, 0, 10) * 0.09f);
        }
コード例 #5
0
ファイル: Dashboard.cs プロジェクト: SimonGaspar/DuoRace
        void FixedUpdate()
        {
            if (vehicle == null || !vehicle.isActiveAndEnabled)
            {
                return;
            }

            m_speedMs.Set(vehicle.data.Get(Channel.Vehicle, VehicleData.Speed) / 1000.0f);
            m_engineRpm.Set(vehicle.data.Get(Channel.Vehicle, VehicleData.EngineRpm) / 1000.0f);
        }
コード例 #6
0
        public RhythmNote(RhythmMinigame owner)
        {
            Owner = owner;

            TimeLeft   = 1f;
            Active     = true;
            vertOffset = new InterpolatedFloat(0f, 0.2f, InterpolatedFloat.EaseInOutBack);
            vertOffset.Set(20f);

            disappearTimer = new InterpolatedFloat(0f, 0.3f, InterpolatedFloat.EaseInOut);
        }
コード例 #7
0
        public AnthemCircle(Vector2 position, Vector2 velocity, float startScale, float endScale, float timeLeft)
        {
            Position          = position;
            Velocity          = velocity;
            Scale             = startScale;
            interpolatedScale = new InterpolatedFloat(startScale, timeLeft);
            interpolatedScale.Set(endScale);

            progress = new InterpolatedFloat(1f, timeLeft);
            progress.Set(0);
        }
コード例 #8
0
        public void Unpause()
        {
            if (Paused)
            {
                MusicVolume = new InterpolatedFloat(0f, 0.25f);
                MusicVolume.Set(0.1f);

                Music.Play();

                Paused = false;
                Visibility.Set(1f);
            }
        }