private void Update() { if (this.currentEmotion != null) { if (this.currentEmotion.HasEnded) { this.currentEmotion.emotionData.SetActive(false, this.audioSource, this.spriteRenderer); this.currentEmotion = null; } } }
public void SetEmotion(EmotionType emotion) { if (this.currentEmotion != null) { if (this.currentEmotion.emotionData.emotionType == emotion) { // don't play again return; } // disable current this.currentEmotion.emotionData.SetActive(false, this.audioSource, this.spriteRenderer); } // enable new EmotionData data = this.emotionData.First(e => e.emotionType == emotion); this.currentEmotion = new PlayedEmotion(data); this.currentEmotion.emotionData.SetActive(true, this.audioSource, this.spriteRenderer); }