private int handelPerTime = 10; //moi lan update xu ly 10 doi tuong void Update() { if (!startReset) { return; } for (int i = 0; i < handelPerTime; i++) { if (typeReset == 0)//load insteads { if (runReset < listInsteads.Count) { listInsteads[runReset].SetActive(false); listInsteads[runReset].transform.localPosition = listOriginPointInsteads[runReset]; runReset++; } else { typeReset = 1; runReset = 0; } } else if (typeReset == 1)//load displays { if (runReset < listDisplays.Count) { listDisplays[runReset].SetActive(true); listDisplays[runReset].transform.localPosition = listOriginPointDisplays[runReset]; BarrierController barrierControl = listDisplays[runReset].GetComponent <BarrierController>(); if (barrierControl) { barrierControl.CallStart(); } else { ItemInformation itemInfo = listDisplays[runReset].GetComponent <ItemInformation>(); itemInfo.CallStart(); } runReset++; } else { typeReset = 0; runReset = 0; startReset = false; break; } } } }
public void Restart(bool handleSafe = true) { //GetComponent<LODSwitcher>().SetCustomCamera(Camera.main); if (objectTwoSide != null) { if (Modules.reducedEffect == 2) { objectTwoSide.SetActive(false); } else { objectTwoSide.SetActive(true); } } if (handleSafe) { runReset = 0; typeReset = 0; startReset = true; } else { for (int i = 0; i < listInsteads.Count; i++) { listInsteads[i].transform.localPosition = listOriginPointInsteads[i]; listInsteads[i].SetActive(false); } for (int i = 0; i < listDisplays.Count; i++) { listDisplays[i].transform.localPosition = listOriginPointDisplays[i]; listDisplays[i].SetActive(true); BarrierController barrierControl = listDisplays[i].GetComponent <BarrierController>(); if (barrierControl) { barrierControl.CallStart(); } else { ItemInformation itemInfo = listDisplays[i].GetComponent <ItemInformation>(); itemInfo.CallStart(); } } } }