minigame metal collector and timer
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user