protected override void OnUpdate() { //TODO Diego: Refazer logica do RunListener //TODO Diego: remover do update e criar vinculo de id com o servidor #if HAS_SERVER int index; var pos = _rankingController.GetSessionConnectionsOrdered(NetworkInstanceType.ActiveClient); if (_rankingController.TryGetPosition(Id, out index))//.PlayersPositions.Exists(x => x.id == Id)) { //deve ser refeito _offsetFromTrackAnimated = Mathf.Lerp(_offsetFromTrackAnimated, (pos.Count - index - 1) * Offset, Time.deltaTime * Speed); //throw new NotImplementedException(); _offsetFromTrack = Vector3.forward * _offsetFromTrackAnimated; } _counter++; if (_counter % 60 == 0 && networkType == NetworkInstanceType.ListeningClient) { //throw new NotImplementedException(); //_rankingController.RequestScoreFromServer(); } #endif base.OnUpdate(); }
protected void OnUpdateImage(List <ScoreValue> listvalues) { #if HAS_SERVER int index; if (_rankingController.TryGetPosition(out index)) { if (!playAudioOnce && PlaySoundForWinner && index == 0 && _sfxController != null) { playAudioOnce = true; _sfxController.PlaySound("Win"); } _image.color = Color.white; _image.sprite = Positions[index]; } else { _image.color = new Color(0, 0, 0, 0); } #endif }