Exemplo n.º 1
0
            public void RunActions(BeatKeeper parent)
            {
                // Run actions
                OnRepeat?.Invoke(parent, this);

                // Run action before resetting event
                OnOnce?.Invoke(parent, this);
                OnOnce = null;

                // Setup for the next beat
                double cacheToSetLastTrigger = NextTrigger;

                while (IsOnBeat(parent))
                {
                    NextTrigger += Interval.ConvertBeat(parent.regularBeat);

                    // Check if next trigger exceeds music length
                    if (NextTrigger > parent.music.clip.length)
                    {
                        // Reset the next trigger to the start of the music
                        NextTrigger = parent.firstBeat;
                    }
                }
                LastTrigger = cacheToSetLastTrigger;

                //Debug.Log($"Last: {LastTrigger}, Next: {NextTrigger}");
            }
Exemplo n.º 2
0
        public void Execute(TimeSpan time)
        {
            int repeatCount = RepeatCount(time);

            if (repeatCount != previousRepeatCount)
            {
                previousRepeatCount = repeatCount;
                OnRepeat?.Invoke(null, EventArgs.Empty);
            }

            time = TimeModDuration(time);

            foreach (var span in Spans)
            {
                bool shouldBeActive = time > span.Start && time < span.End;

                foreach (var state in span.States)
                {
                    if (state.IsActive && !shouldBeActive)
                    {
                        state.Leave();
                    }
                    else if (!state.IsActive && shouldBeActive)
                    {
                        state.Enter();
                    }
                }
            }
        }
Exemplo n.º 3
0
        public void RepeatAlarm()
        {
            //alarm tekrar

            var ser = DependencyService.Get <AndroidAlarmService>();

            ser.Repeat(CurrentAlarm);
            OnRepeat?.Invoke(this, new EventArgs());
        }
Exemplo n.º 4
0
        // ReSharper disable once UnusedMember.Local
        private void Update()
        {
            if (State == AnimationState.Stopped)
            {
                return;
            }

            DeltaTime = (Direction == AnimationDirection.Forward ? 1f : -1f) *
                        (UnityEngine.Time.deltaTime / Settings.Duration);

            Time = Mathf.Clamp(Time + DeltaTime, 0f, 1f);

            var easingTime = Easings.Interpolate(Time, Settings.EasingType);

            DeltaEasingTime = easingTime - EasingTime;
            EasingTime      = easingTime;

            Animate();

            if (Time >= 1f && Direction == AnimationDirection.Forward ||
                Time <= 0f && Direction == AnimationDirection.Backward)
            {
                if (Settings.PlayType == AnimationPlayType.EndReset)
                {
                    Repeats++;
                    OnRepeat.Invoke();
                    Time       = 0f;
                    EasingTime = 0f;
                }
                else if (Settings.PlayType == AnimationPlayType.EndFlip)
                {
                    Repeats++;
                    OnRepeat.Invoke();
                    Direction = Direction == AnimationDirection.Forward
                        ? AnimationDirection.Backward
                        : AnimationDirection.Forward;
                }

                if (Settings.PlayType == AnimationPlayType.PlayOnce ||
                    Settings.MaxRepeats > 0 && Repeats >= Settings.MaxRepeats)
                {
                    State = AnimationState.Stopped;
                    OnEnded.Invoke();
                }
            }
        }
Exemplo n.º 5
0
        internal static void Init()
        {
            App.platform.OnKeyDown += (key, scan) =>
            {
                down.Add((KeyCode)key);
                pressed.Add((KeyCode)key);
                OnPress?.Invoke((KeyCode)key);
            };

            App.platform.OnKeyUp += (key, scan) =>
            {
                down.Remove((KeyCode)key);
                released.Add((KeyCode)key);
                OnRelease?.Invoke((KeyCode)key);
            };

            App.platform.OnKeyRepeat += (key, scan) =>
            {
                repeated.Add((KeyCode)key);
                OnRepeat?.Invoke((KeyCode)key);
            };
        }
Exemplo n.º 6
0
 public void OnAnimationRepeat(Animation animation)
 {
     OnRepeat?.Invoke(animation);
 }