// Start is called before the first frame update void Start() { //Base Speed Before Dashing BaseSpeed = speed; Debug.Log("Script running!"); rb = GetComponent <Rigidbody>(); sr = GetComponentInChildren <SpriteRenderer>(); anim = GetComponentInChildren <Animator>(); sliderVal = GameObject.FindGameObjectWithTag("HealthSlider").GetComponent <SliderValueChange>(); dashSlider = GameObject.FindGameObjectWithTag("DashSlider").GetComponent <SliderValueChange>(); anim.Play("face_forward", 0, 0); // Default animation the player has }
void StartTimeObserver() { _timeObserver = _player .AddPeriodicTimeObserver(CoreMedia.CMTime.FromSeconds(1.0 / 60.0, Constants.NSEC_PER_SEC), null, (obj) => { if (_player != null) { SliderValueChange?.Invoke(new object(), obj.Seconds); if (obj.Seconds >= _totalLength) { _hasEnded = true; HasEndedEvent?.Invoke(this, new EventArgs()); EndTimeObserver(); } } else { EndTimeObserver(); } }); }