private IEnumerator AnimationCoroutine(Action callback) { var particles = Instantiate(poof, AnturaPosition.position, AnturaPosition.rotation) as GameObject; var particles2 = Instantiate(poof, AnturaPosition.position, AnturaPosition.rotation) as GameObject; particles2.transform.localScale = new Vector3(2, 2, 2); particles2.SetLayerRecursive(AnturaLayers.ModelsOverUI); particles.transform.localScale = new Vector3(2, 2, 2); particles.SetLayerRecursive(AnturaLayers.ModelsOverUI); AssessmentConfiguration.Instance.Context.GetAudioManager().PlaySound(Sfx.Poof); yield return(TimeEngine.Wait(0.15f)); AnturaAnimationController antura = Instantiate(anturaPrefab, AnturaPosition.position, AnturaPosition.rotation) as AnturaAnimationController; antura.gameObject.AddComponent <BringAnturaInFlagSpace>(); antura.transform.localScale = Vector3.zero; antura.transform.DOScale(Vector3.one, 0.2f); yield return(TimeEngine.Wait(0.9f)); antura.DoShout( () => AssessmentConfiguration.Instance.Context.GetAudioManager() .PlaySound(Sfx.DogBarking) ); yield return(TimeEngine.Wait(1.2f)); particles2 = Instantiate(poof, AnturaPosition.position, AnturaPosition.rotation) as GameObject; particles2.transform.localScale = new Vector3(2, 2, 2); particles2.SetLayerRecursive(AnturaLayers.ModelsOverUI); yield return(TimeEngine.Wait(1f)); antura.transform.DOScale(Vector3.zero, 0.2f).SetEase(Ease.InExpo); callback(); }
private IEnumerator AngryState() { while (true) { yield return(state.EnterState()); controller.IsAngry = true; controller.DoShout(() => audioManager.AnturaAngrySound()); yield return(Wait.For(3.0f)); controller.IsAngry = true; controller.State = AnturaAnimationStates.sitting; yield return(state.Change(Idle)); } }
void Update() { var distance = target - transform.position; distance.y = 0; if (IsAnturaTime) { if (nextAnturaBarkTimer <= 0) { PrepareNextAnturaBark(); antura.DoShout(() => { AudioManager.I.PlaySfx(Sfx.DogBarking); }); } else { nextAnturaBarkTimer -= Time.deltaTime; } } if (distance.sqrMagnitude < 0.1f) { // reached if (IsAnturaTime) { SetRandomTarget(); } } else { distance.Normalize(); transform.position += distance * Mathf.Abs(Vector3.Dot(distance, transform.forward)) * ANTURA_SPEED * Time.deltaTime; MathUtils.LerpLookAtPlanar(transform, target, Time.deltaTime * 4); } }
void Update() { antura.IsAngry = angry; antura.SetWalkingSpeed(walkSpeed); if (doTransition) { doTransition = false; antura.State = targetState; } if (doBurp) { doBurp = false; antura.DoBurp(); } if (doBite) { doBite = false; antura.DoBite(); } if (doShout) { doShout = false; antura.DoShout(); } if (doSniff) { doSniff = false; antura.DoSniff(); } if (onJumpStart) { onJumpStart = false; antura.OnJumpStart(); } if (onJumpMiddle) { onJumpMiddle = false; antura.OnJumpMaximumHeightReached(); } if (onJumpGrab) { onJumpGrab = false; antura.OnJumpGrab(); } if (onJumpEnd) { onJumpEnd = false; antura.OnJumpEnded(); } if (doCharge) { doCharge = false; antura.DoCharge(null); } if (doSpitOpen) { doSpitOpen = false; antura.DoSpit(true); } if (doSpitClosed) { doSpitClosed = false; antura.DoSpit(false); } if (onSlipStart) { onSlipStart = false; antura.OnSlipStarted(); } if (onSlipEnd) { onSlipEnd = false; antura.OnSlipEnded(); } }
/// <summary> /// Progress through the states for Antura: standby->movetoletter->rotationback->bark->movetostandby->rotation->... /// </summary> private void AnturaNextTransition() { if (m_eAnturaState == AnturaContollerState.SLEEPING) //go to the letter { m_bMovingToDestination = true; //m_oAntura.SetAnimation(m_eAnimationOnMoving); m_oAntura.State = m_eAnimationOnMoving; m_eAnturaState = AnturaContollerState.REACHINGLETTER; } else if (m_eAnturaState == AnturaContollerState.REACHINGLETTER)//letter reached, rotate { //swap dest and start Vector3 _v3Temp = m_v3StartPosition; m_v3StartPosition = m_v3Destination; m_v3Destination = _v3Temp; //rotate towards letter m_bRotatingToTarget = true; //set new state m_eAnturaState = AnturaContollerState.TURN_TO_BARK; } else if (m_eAnturaState == AnturaContollerState.TURN_TO_BARK)//now bark { //change animation and play sound //m_oAntura.SetAnimation(m_eAnimationOnLLReached); //m_oAntura.IsBarking = true; m_oAntura.State = m_eAnimationOnLLReached; m_oAntura.DoShout(); ColorTickleConfiguration.Instance.Context.GetAudioManager().PlaySound(Sfx.DogBarking); m_fBarkTimeProgress = 0; //set new state m_eAnturaState = AnturaContollerState.BARKING; } else if (m_eAnturaState == AnturaContollerState.BARKING) //return back { m_bMovingToDestination = true; //m_oAntura.SetAnimation(m_eAnimationOnMoving); //m_oAntura.IsBarking = false; m_oAntura.State = m_eAnimationOnMoving; m_eAnturaState = AnturaContollerState.COMINGBACK; } else if (m_eAnturaState == AnturaContollerState.COMINGBACK) //rotate towards letter again { //swap dest and start Vector3 _v3Temp = m_v3StartPosition; m_v3StartPosition = m_v3Destination; m_v3Destination = _v3Temp; //rotate m_bRotatingToTarget = true; //set new state m_eAnturaState = AnturaContollerState.ROTATION; } else if (m_eAnturaState == AnturaContollerState.ROTATION) //gone back to start { //change animation //m_oAntura.SetAnimation(m_eAnimationOnStandby); m_oAntura.State = m_eAnimationOnStandby; //set new state m_eAnturaState = AnturaContollerState.SLEEPING; } //launch event if (OnStateChanged != null) { OnStateChanged(m_eAnturaState); } }
public void ReactNegatively() { animationController.DoShout(); }
public void ReactNegatively() { animationController.DoShout(); Audio.AudioManager.I.PlaySound(Sfx.DogBarking); }