minigame metal collector and timer

This commit is contained in:
Sewmina Dilshan 2022-08-28 15:45:30 +05:30
parent 09cc2b9b89
commit 910eb77f95
6 changed files with 5588 additions and 15 deletions

File diff suppressed because it is too large Load Diff

View File

@ -3,12 +3,13 @@ using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using TMPro;
public class SceneDataHolder : MonoBehaviour
{
public Transform trailCollidersParent;
public GameObject deadScreen;
public EventTrigger boostBtn;
public TMP_Text timerTxt;
void Awake()
{
SceneData.holder = this;
@ -29,4 +30,9 @@ public static class SceneData{
public static MinigameManager GameManager;
public static UnityEvent OnBoostDown = new UnityEvent();
public static UnityEvent OnBoostUp = new UnityEvent();
public static void SetTimerTxt(double seconds){
int secs = ((int)(seconds % 60));
int mins = Mathf.FloorToInt((float)(seconds/60));
}
}

View File

@ -87,7 +87,8 @@ public class SpaceshipController : NetworkBehaviour
void CmdSetBoosting(bool value){
boosting=value;
}
[SyncVar]
double startedTime = 0;
void Start()
{
scaleMultiplier=1;
@ -109,7 +110,7 @@ public class SpaceshipController : NetworkBehaviour
}
if (isServer)
{
startedTime = NetworkTime.time;
}
}
@ -122,6 +123,7 @@ public class SpaceshipController : NetworkBehaviour
{
distanceFromCenter = Vector3.Distance(transform.position, Vector3.zero);
pnameTxt.rectTransform.rotation = Quaternion.Euler(Vector3.zero);
SceneData.SetTimerTxt(startedTime-NetworkTime.time);
//Update size of trail and spaceship
transform.localScale = Vector3.Lerp(transform.localScale,new Vector3(scaleMultiplier,scaleMultiplier,scaleMultiplier),0.1f);

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: d1d6df78c3d011648bfa60ab47cae3ac
guid: 898702a662cc86e40b4add2cf19abd3b
DefaultImporter:
externalObjects: {}
userData: