private void RemoveCoffee(ObserveAngle observeAngle) { ben.GetComponent <Inspectable>().OnPlayerReachObserveAngle -= RemoveCoffee; var inventory = GameObject.Find("Inventory"); Destroy(inventory.transform.GetChild(inventory.transform.childCount - 1).gameObject); }
void HandlePlayerStartMovingObserveAngle(ObserveAngle observable) { StopAllCoroutines(); cameraRig.transform.position = observable.playerMovingCameraTransform.position; cameraRig.transform.rotation = observable.playerMovingCameraTransform.rotation; currentView = observable.playerMovingCameraTransform.gameObject; }
void HandlePlayerReachObserveAngle(ObserveAngle observable) { StopAllCoroutines(); if (observable.playerReachCameraTransform.GetComponent <CamTriggerBackButtonTag>() != null) { OnCameraChangeTriggerBackButton(); } cameraRig.transform.position = observable.playerReachCameraTransform.position; cameraRig.transform.rotation = observable.playerReachCameraTransform.rotation; currentView = observable.playerReachCameraTransform.gameObject; FloatObject floatObject = observable.GetComponent <FloatObject>(); if (floatObject != null) { StartCoroutine(FollowCamCo(observable.playerReachCameraTransform)); } }
protected override IEnumerator InspectableOnClickCo(NavMeshAgent agent) { //change cameraAngleBeforeReach //////return sth here //clickToMove.coroutineRunning = true; print("ground coroutine"); ObserveAngle observable = GetComponent <ObserveAngle>(); int currentFrame = 0; if (observable != null) { while (currentFrame < 10) { currentFrame++; yield return(null); } OnPlayerClickOnGroundObserveAngle(observable); } print("ground coroutine own stop"); //clickToMove.coroutineRunning = false; yield break; }
void HandlePlayerClickOnGround(ObserveAngle observable) { print("re-enable parent collider and disable its childrens colliders"); SetColliderState(); SetHandlers(false); }
void HandlePlayerReachObserveAngle(ObserveAngle observable) { print("disable a parent object and enable its children objects collider"); SetColliderState(false); SetHandlers(true); }
protected override IEnumerator InspectableOnClickCo(NavMeshAgent agent) { //clickToMove.coroutineRunning = true; //change cameraAngleBeforeReach //////return sth here print("inspectable coroutine"); ObserveAngle observable = GetComponent <ObserveAngle>(); int currentFrame = 0; if (observable != null && clickToMove != null) { //Unity AI doesn the path calculation for the first few frames, during these frames, agent.hasPath return false, and agent.remainingDistance return 0, so we bypass these frames with a coroutine while (currentFrame < 10) { //if (clickToMove.reset) //{ // clickToMove.reset = false; // Debug.Log(clickToMove.reset); // yield break; //} currentFrame++; yield return(null); } //when the calculation is done, we can check for has path while (agent.remainingDistance > agent.stoppingDistance && agent.remainingDistance > 0.5f) { //anytime there is a click on the ClickToMove object, stop this coroutine //if (clickToMove.reset) //{ // clickToMove.reset = false; // Debug.Log(clickToMove.reset); // yield break; //} //print("I'm still far away"); OnPlayerStartMovingObserveAngle(observable); yield return(null); } //if (clickToMove.reset) //{ // clickToMove.reset = false; // Debug.Log(clickToMove.reset); // yield break; //} //print("I'm here"); //ObserveAngle observable = GetComponent<ObserveAngle>(); OnPlayerReachObserveAngle(observable); yield return(null); } //clickToMove.coroutineRunning = false; print("inspectable coroutine own stop"); yield break; }
public void ClickCamBackButton(ObserveAngle observable) { OnCamBackButtonClick(); camBackButton.SetActive(false); }