void OnTriggerExit(Collider entity) { if (entity.transform == localPlayer) { uiState = WorldUiState.NoUi; localPlayer = null; DeactivateAllPrompts(); Debug.Log("Local player exited the area."); } }
IEnumerator InteractionTimer() { time = 0; while (time < timeForInteracting && CheckIfPlayerIsInteracting() && DistanceToPlayer() < minDistInteractionPrompt) { time += Time.fixedDeltaTime; Debug.Log(time); yield return(0); } if (time > timeForInteracting) { uiState = WorldUiState.DeactivateUi; } else { time = 0; } }
private void ManageUiState() { //Debug.Log(DistanceToPlayer()); switch (uiState) { case WorldUiState.NoUi: if (DistanceToPlayer() < minDistPointOfInterest) { ManagePointOfInterestImage(true); uiState = WorldUiState.Poi; } break; case WorldUiState.Poi: if (DistanceToPlayer() < minDistInformationPrompt) { ManageInformationImage(true); uiState = WorldUiState.InfoPrompt; } else if (DistanceToPlayer() > minDistPointOfInterest) { ManagePointOfInterestImage(false); DeactivateAllPrompts(); uiState = WorldUiState.NoUi; } break; case WorldUiState.InfoPrompt: if (DistanceToPlayer() < minDistInteractionPrompt) { ManageInteractionImage(true); uiState = WorldUiState.InteractionPrompt; } else if (DistanceToPlayer() > minDistInformationPrompt) { ManageInformationImage(false); uiState = WorldUiState.Poi; } break; case WorldUiState.InteractionPrompt: if (CheckIfPlayerIsInteracting()) { DisplayInteractionAnimation(true); } else { DisplayInteractionAnimation(false); } if (DistanceToPlayer() > minDistInteractionPrompt) { DisplayInteractionAnimation(false); ManageInteractionImage(false); uiState = WorldUiState.InfoPrompt; } break; case WorldUiState.DeactivateUi: DestroyThisGameObject(); break; } }