//------------------------------------------------------------------------------------------------------------ public void Sing() { Debug.Log("I sing now!!!"); Blobstate = BLOBSTATES.SING; SendMessageUpwards("ValidateStep", BlobID); m_gvrAudioSource.Play(); }
//------------------------------------------------------------------------------------------------------------ private void TriggerAnimation(BLOBSTATES _state) { string[] _triggers = m_blobAnimationTriggers[_state]; string _trigger = (_triggers.Length > 0) ? _triggers[UnityEngine.Random.Range(0, _triggers.Length - 1)] : _triggers[0]; Debug.LogFormat("Trigger {0} on {1}, choosen from {2} triggers", _state, gameObject.name, _triggers.Length); Animator.SetTrigger(_trigger); // Debug.Break(); }
//------------------------------------------------------------------------------------------------------------ private void OnSingComplete(string _stateAsString) { Debug.Log(_stateAsString + " is complete for" + gameObject.name + "in state " + Blobstate); if (_stateAsString == BLOBSTATES.SING.ToString()) { Debug.Log("Sing completed"); SendMessageUpwards("SequenceStepCompleted", BlobID); Blobstate = BLOBSTATES.IDLE; return; } }
//------------------------------------------------------------------------------------------------------------ private void changeState(BLOBSTATES _state) { Debug.Log("changing animation state to" + _state); m_blobState = _state; TriggerAnimation(m_blobState); switch (m_blobState) { case (BLOBSTATES.IDLE): break; case (BLOBSTATES.SING): break; } }
public void AnimationComplete(string _finishedAnimation) { //Debug.Break(); Debug.Log(_finishedAnimation + " is complete for" + gameObject.name + "in state " + Blobstate); if (_finishedAnimation == BLOBSTATES.SING.ToString()) { Debug.Log("Sing completed"); SendMessageUpwards("SequenceStepCompleted", BlobID); Blobstate = BLOBSTATES.IDLE; return; } if (Blobstate == BLOBSTATES.SING) { return; // we're entering from another animation state here, which could interrupt the singing } if (_finishedAnimation != BLOBSTATES.IDLE.ToString()) // we do not want to be idling like crazy, don't we? { Debug.Log("I am not blobstate sing? I'm " + Blobstate); Blobstate = BLOBSTATES.IDLE; } }