// Update is called once per frame void Update() { if (lastShiningTime > 0f) { foreach (var Out in Outs) { var gun = Out.GetComponent <Gun>(); if (!Out.activeSelf && gun != null && gun.GetDiliver() == null) { gun.SetDiliver(gameObject); Out.SetActive(true); } } } else { Debug.Log("Diliver [" + gameObject.name + "] Update else lastShiningTime=" + lastShiningTime); foreach (var Out in Outs) { if (Out.activeSelf) { var gun = Out.GetComponent <Gun>(); if (gun != null && gun.GetDiliver() == gameObject) { gun.SetDiliver(null); gun.SetDirty(); gun.ResetLight(); Out.SetActive(false); gun.ClearDirty(0, 0); } } } lastShiningTime = 0; } lastShiningTime -= Time.deltaTime; }