public void ChangeOwnership(int ID) { IInteractable interactable = InteractableFactory.Instance.GetInteractable(ID); InteractableVisible visible = interactable.GetComponent <InteractableVisible>(); if (visible.visiblePlayer == VisiblePlayer.PLAYER_1) { visible.visiblePlayer = VisiblePlayer.PLAYER_2; } else if (visible.visiblePlayer == VisiblePlayer.PLAYER_2) { visible.visiblePlayer = VisiblePlayer.PLAYER_1; } visible.recheckVisible(); GetComponent <PickingThings>().toPickUp = null; GameObject endChecker = GameObject.Find("EndChecker"); if (endChecker != null) { EndChecker endCheckerScript = endChecker.GetComponent <EndChecker>(); if (endCheckerScript.isEnd()) { endCheckerScript.endPopup.SetActive(true); } } }
private void checkVisibility() { GameObject[] gos = GameObject.FindGameObjectsWithTag("interactable"); foreach (GameObject go in gos) { InteractableVisible iv = go.GetComponent <InteractableVisible>(); if (iv == null) { continue; } iv.recheckVisible(); } }