void Update() { if (OnSimulation) { layout.GetPositionOnPath(Distance); int i = 0; foreach (var item in camList) { if (i == currentCam) { Camera.main.transform.position = item.Value.transform.position; Camera.main.transform.LookAt(layout.PosOnPath); } if (i == currentCam + 1) { if (Distance > item.Value.GetComponent <ReplayCamera>().StartDistance) { currentCam++; } ; break; } i++; } //Distance += 0.25f; } }
public bool UpdatePoints() { if (SomethingIsChanged()) { try { if (layout == null) { layout = transform.GetComponent <LayoutPath>(); } Points.Clear(); layout.GetPositionOnPath(StartDistance + StartCarRelative); Points.Add(layout.PosOnPath); layout.GetPositionOnPath(StartDistance + StartCo1Relative + StartCo0Relative); Points.Add(layout.PosOnPath); layout.GetPositionOnPath(StartDistance + StartCo1Relative); Points.Add(layout.PosOnPath); layout.GetPositionOnPath(StartDistance); Points.Add(layout.PosOnPath); layout.GetPositionOnPath(StartDistance + StartEndRelative); Points.Add(layout.PosOnPath); layout.GetPositionOnPath(Split1Distance); Points.Add(layout.PosOnPath); layout.GetPositionOnPath(Split2Distance); Points.Add(layout.PosOnPath); layout.GetPositionOnPath(Split3Distance); Points.Add(layout.PosOnPath); layout.GetPositionOnPath(FinishDistance + FinishCo0Relative); Points.Add(layout.PosOnPath); layout.GetPositionOnPath(FinishDistance); Points.Add(layout.PosOnPath); layout.GetPositionOnPath(FinishDistance + FinishStopRelative); Points.Add(layout.PosOnPath); layout.GetPositionOnPath(FinishDistance + FinishStopRelative + FinishEndRelative); Points.Add(layout.PosOnPath); } catch (System.Exception ex) { Debug.LogError(ex.ToString()); return(false); } } return(true); }