void OnTriggerEnter(Collider other) { InteractionPrompt.Invoke(this.Interactables.Count > 0); switch (other.tag) { case "Enemy Weapon": if (isVulnerable) { this.SetState(new TakeDamageState(this)); PlayerDamaged.Invoke(); } break; case "Health": if (health < maxHealth) { health += 2; if (health > 10) { health = 10; } HealthPickup.Invoke(); Audio.PlayOneShot(healthPick); other.gameObject.SetActive(false); } break; } }
private void EndDialog() { Animator.SetBool("IsOpen", false); _isStarted = false; // if event exists, invoke if (Type == "START") { StartBattle?.Invoke(); } else if (Type == "END") { EndBattle?.Invoke(); } else if (Type == "STARTCUTSCENE") { EndStartingCutscene?.Invoke(); } else if (Type == "PLAYERSTARTCUTSCENE") { PlayerEndStartingCutscene?.Invoke(); } else if (Type == "HEALTHPICKUP") { HealthPickup?.Invoke(); } else if (Type == "ENDING") { FinalScene?.Invoke(); } AudioSource source = FindObjectOfType <GameStateManager>().gameObject.GetComponent <AudioSource>(); if (source) { source.mute = false; } }
public static void CallHealthPickup(float value) { HealthPickup?.Invoke(value); }