void Update() { if (currentNPC && currentNPC.activeSelf) { const float EPS = 0.000001f; var t = Mathf.Clamp01(currentNPC.transform.position.magnitude / (npcSO.lengthLimit + EPS)); var tt = Mathf.Max(0f, t - 0.6f) / 0.4f; headPhotoImage.color = currentNPCToEdgeGradient.Evaluate(tt); headPhotoImage.enabled = true; } else { bool gone = true; for (int i = 0; i < totalSO.units.Count; i++) { if (totalSO.units[i].unitStatus == UnitStatus.People || totalSO.units[i].unitStatus == UnitStatus.Union) { gone = false; break; } } if (gone) { controller.canControl = false; timerManager.canTime = false; endingController.EndWithParameter(End.Gone); //SceneManager.LoadScene(goneIndex); } headPhotoImage.enabled = false; GetComponent <HeadIconUI>().enabled = false; } }
// Start is called before the first frame update void Start() { canRun = false; for (int i = 0; i < totalSO.units.Count; i++) { if (totalSO.units[i].dead != true && (totalSO.units[i].unitStatus == UnitStatus.Empty || totalSO.units[i].unitStatus == UnitStatus.People)) { canRun = true; } } if (canRun) { canControl = true; pack.GetComponent <PackManager>().packSO = packSO; } else { endingController.EndWithParameter(End.Normal); } }