minigame metal collector and timer
This commit is contained in:
parent
09cc2b9b89
commit
910eb77f95
File diff suppressed because it is too large
Load Diff
|
|
@ -3,12 +3,13 @@ using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Events;
|
using UnityEngine.Events;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
|
using TMPro;
|
||||||
public class SceneDataHolder : MonoBehaviour
|
public class SceneDataHolder : MonoBehaviour
|
||||||
{
|
{
|
||||||
public Transform trailCollidersParent;
|
public Transform trailCollidersParent;
|
||||||
public GameObject deadScreen;
|
public GameObject deadScreen;
|
||||||
public EventTrigger boostBtn;
|
public EventTrigger boostBtn;
|
||||||
|
public TMP_Text timerTxt;
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
SceneData.holder = this;
|
SceneData.holder = this;
|
||||||
|
|
@ -29,4 +30,9 @@ public static class SceneData{
|
||||||
public static MinigameManager GameManager;
|
public static MinigameManager GameManager;
|
||||||
public static UnityEvent OnBoostDown = new UnityEvent();
|
public static UnityEvent OnBoostDown = new UnityEvent();
|
||||||
public static UnityEvent OnBoostUp = 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){
|
void CmdSetBoosting(bool value){
|
||||||
boosting=value;
|
boosting=value;
|
||||||
}
|
}
|
||||||
|
[SyncVar]
|
||||||
|
double startedTime = 0;
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
scaleMultiplier=1;
|
scaleMultiplier=1;
|
||||||
|
|
@ -109,7 +110,7 @@ public class SpaceshipController : NetworkBehaviour
|
||||||
}
|
}
|
||||||
if (isServer)
|
if (isServer)
|
||||||
{
|
{
|
||||||
|
startedTime = NetworkTime.time;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -122,6 +123,7 @@ public class SpaceshipController : NetworkBehaviour
|
||||||
{
|
{
|
||||||
distanceFromCenter = Vector3.Distance(transform.position, Vector3.zero);
|
distanceFromCenter = Vector3.Distance(transform.position, Vector3.zero);
|
||||||
pnameTxt.rectTransform.rotation = Quaternion.Euler(Vector3.zero);
|
pnameTxt.rectTransform.rotation = Quaternion.Euler(Vector3.zero);
|
||||||
|
SceneData.SetTimerTxt(startedTime-NetworkTime.time);
|
||||||
|
|
||||||
//Update size of trail and spaceship
|
//Update size of trail and spaceship
|
||||||
transform.localScale = Vector3.Lerp(transform.localScale,new Vector3(scaleMultiplier,scaleMultiplier,scaleMultiplier),0.1f);
|
transform.localScale = Vector3.Lerp(transform.localScale,new Vector3(scaleMultiplier,scaleMultiplier,scaleMultiplier),0.1f);
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: d1d6df78c3d011648bfa60ab47cae3ac
|
guid: 898702a662cc86e40b4add2cf19abd3b
|
||||||
DefaultImporter:
|
DefaultImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
||||||
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user