From ebbb3b216732eca49ed780cb8690819a737fb133 Mon Sep 17 00:00:00 2001 From: Mikhail Babich Date: Sun, 6 May 2018 20:32:40 +1000 Subject: [PATCH] Fix send units after start/restart --- Assets/Resources/scripts/MainController.cs | 5 ++++- Assets/main.unity | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Assets/Resources/scripts/MainController.cs b/Assets/Resources/scripts/MainController.cs index f3bc2eb..273f6a5 100644 --- a/Assets/Resources/scripts/MainController.cs +++ b/Assets/Resources/scripts/MainController.cs @@ -11,6 +11,7 @@ public class MyIntTuple { public class MainController : MonoBehaviour { private List routerControllers = new List(); + private float startedAt; public GameObject mainTower; public GameObject[] towers0; @@ -28,6 +29,8 @@ private void Awake() private void Start() { + startedAt = Time.time; + var routeContainer = Container.GetInstance().GetRouteContainer(); var collider = mainTower.GetComponentInChildren(); Debug.Assert(collider != null); @@ -75,7 +78,7 @@ private void Update() public void TryToSendUnit() { - int now = (int)(Time.time * 1000); + int now = (int)((Time.time - startedAt) * 1000); if (lastSendUnitTime + SEND_UNIT_INTERVAL < now && sendUnitsIndex < sendUnits.Count && sendUnits[sendUnitsIndex].first <= now) { SendUnit(sendUnits[sendUnitsIndex].third); --sendUnits[sendUnitsIndex].second; diff --git a/Assets/main.unity b/Assets/main.unity index b47bde9..12b3992 100644 --- a/Assets/main.unity +++ b/Assets/main.unity @@ -9849,7 +9849,7 @@ MonoBehaviour: m_EditorClassIdentifier: health: 10000 defeatMenu: {fileID: 1842057281} - gameMenu: {fileID: 0} + gameMenu: {fileID: 1963433602} --- !u!1 &1674194213 GameObject: m_ObjectHideFlags: 0