public override Interaction CheckForPromotion() { Ray ray = new Ray(Player.GetInstance().MainCamera.transform.position, Player.GetInstance().MainCamera.transform.forward); RaycastHit hit; Debug.DrawRay(ray.origin, ray.direction, Color.red); _hasHit = Physics.SphereCast(ray, 0.05f, out hit, 1000.0f, 1 << LayerMaskManager.Get(Layer.Verse), QueryTriggerInteraction.Collide); if (_hasHit) { if (_selectedGameObject != null && _selectedGameObject.GetInstanceID() != hit.collider.gameObject.GetInstanceID()) { HideFeedback(); } _selectedGameObject = hit.collider.gameObject; _selectedVerse = _selectedGameObject.GetComponent <VerseInfoComponent>().Info; ShowFeedback(); } else { HideFeedback(); _selectedGameObject = null; } return(this); }
public bool DisplayVerses() { string[] verses = Player.GetInstance().GetNextTombPoem(); if (verses == null) { _displayMeshText.HideSmooth(); GameState.HasEnded = true; Player.GetInstance().CurrentState = new WalkRunState(); return(false); } VerseInfo[] versesText = new VerseInfo[verses.Length]; for (int i = 0; i < versesText.Length; ++i) { versesText[i].Verse = verses[i]; } Player player = Player.GetInstance(); _displayMeshText.Display(player.MainCamera.transform.position + player.MainCamera.transform.forward * _distanceFromPlayer, player.MainCamera.transform.rotation, versesText); return(true); }