void OnTriggerEnter(Collider other) { if (other.gameObject.name.ToUpper().Contains("PLAYER")) { PlayerGameMechanics playerGameMechanics = other.gameObject.GetComponent(typeof(PlayerGameMechanics)) as PlayerGameMechanics; playerGameMechanics.StartMonsterSpawn(); } }
protected virtual void AttackPlayer() { PlayerGameMechanics playerGameMechanics = player.GetComponent <PlayerGameMechanics>(); playerGameMechanics.AttackedByMonster(gameObject); // Remove this game object Destroy(gameObject); }
public void EndDialogue() { PlayerGameMechanics playerGameMechanics = player.GetComponent(typeof(PlayerGameMechanics)) as PlayerGameMechanics; playerGameMechanics.UnpauseGame(); theButton.GetComponent <CanvasGroup>().alpha = 0.00f; box.GetComponent <CanvasGroup>().alpha = 0.00f; nameText.text = ""; dialogueText.text = ""; }
/// <summary> /// This method removes the game object. It's a separate method in case we want to add animation later /// </summary> protected virtual void KillMonster() { // Let the player object know that there is one fewer monsters PlayerGameMechanics playerGameMechanics = player.GetComponent(typeof(PlayerGameMechanics)) as PlayerGameMechanics; playerGameMechanics.KillMonster(gameObject); //stops particle system StopEctoplasm(); // Remove this game object Destroy(gameObject); }
void PausedInput() { if (Input.GetKeyDown(KeyCode.Escape)) { PlayerGameMechanics playerGameMechanics = player.GetComponent(typeof(PlayerGameMechanics)) as PlayerGameMechanics; playerGameMechanics.TogglePause(); } if (Input.GetKeyDown(KeyCode.Return)) { GetComponent <DialogueManager>().theButton.onClick.Invoke(); //GetComponent<SceneManager>().GetComponent<DialogueManager>().DisplayNextSentence(); } }
public void StartDialogue(Dialogue dialogue) { theButton.GetComponent <CanvasGroup>().alpha = 1.00f; box.GetComponent <CanvasGroup>().alpha = 1.00f; nameText.text = dialogue.nameT; PlayerGameMechanics playerGameMechanics = player.GetComponent(typeof(PlayerGameMechanics)) as PlayerGameMechanics; playerGameMechanics.PauseGame(); sentences.Clear(); foreach (string s in dialogue.sentences) { sentences.Enqueue(s); } DisplayNextSentence(); }