IEnumerator HoverInfo() { while (true) { RaycastHit hit; //ray shooting out of the camera from where the mouse is Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { if (hit.collider.gameObject.CompareTag("_VillageTile")) { mouseInfoMessage.displayMessage(hit.collider.gameObject.GetComponent <GridSpace>().VillageTile.tilename); } else if (hit.collider.gameObject.CompareTag("_PlayerBoardSpace")) { PlayerBoardSpace pbs = hit.collider.gameObject.GetComponent <PlayerBoardSpace>(); mouseInfoMessage.displayMessage(pbs.hasGhost() ? "Gh-gh-gh-ghost!" : "Open Space"); } else { mouseInfoMessage.clearMessage(); } } else { mouseInfoMessage.clearMessage(); } yield return(null); } }
IEnumerator drawGhost() { Ghost ghost = playerManager.drawGhost(); io.displayCurrentActionInfo(ghost.GhostName + "\nColor: " + ghost.color + "\nResistance: " + ghost.Resistance); while (true) { GSCoroutine <GameObject> clickedGSC = io.getClickedGameObject("_PlayerBoardSpace"); yield return(clickedGSC.coroutine); while (clickedGSC.result == null) { yield return(null); } PlayerBoardSpace pbs = clickedGSC.result.GetComponent <PlayerBoardSpace>(); if (!pbs.hasGhost()) { pbs.addGhost(ghost); break; } else { yield return(StartCoroutine(io.displayNotificationMessage("You must choose an empty space!"))); } yield return(null); } io.clearCurrentActionInfo(); }