// QuestRewards.cs // Celebrates finished quests: tells everybody in chat and makes the player glow for a moment. // Leave Quest empty for every quest of the scene. using System.Collections; using IHXR.Simulation; public class QuestRewards : ScriptBase { [Tooltip("The quest's title (or id). Empty: every quest.")] public string Quest = ""; public bool Announce = true; public Color GlowColor = new Color(1f, 0.85f, 0.2f); public float GlowSeconds = 3f; public override void Start() { ListenForQuests(quest => { if (quest.EventType != QuestEventType.Completed || (Quest.Length > 0 && !quest.IsQuest(Quest))) return; if (Announce) SendScriptChat(quest.Username + " completed the quest " + quest.QuestTitle + "!"); StartCoroutine(Glow(quest.Username)); }); } private IEnumerator Glow(string user) { TintPlayer(user, GlowColor, 0.35f, 2f); yield return new WaitForSeconds(GlowSeconds); ResetPlayerTint(user); } }