void Update() { if (path != null) { var target = path[currentNode]; var distance = target - transform.position; float distanceSqrMagnitude = distance.sqrMagnitude; distance.y = 0; if (distanceSqrMagnitude < 2) { // reached ++currentNode; if (currentNode >= path.Count) { animationController.State = AnturaAnimationStates.idle; path = null; } } else { if (isSniffing) { return; } randomSniffTime -= Time.deltaTime; if (randomSniffTime < 0) { randomSniffTime = UnityEngine.Random.Range(3, 6); isSniffing = true; speed = 0; animationController.DoSniff(() => { isSniffing = false; }); Audio.AudioManager.I.PlaySound(Sfx.DogSnorting); } else { distance.Normalize(); speed = Mathf.Min(12, speed + 20 * Time.deltaTime); //transform.position += distance * Mathf.Abs(Vector3.Dot(distance, transform.forward)) * speed * Time.deltaTime; Vector3 direction = Vector3.Slerp(distance, transform.forward, Mathf.Sqrt(distanceSqrMagnitude) / 2); transform.position += direction * speed * Time.deltaTime; GameplayHelper.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(); } }
public void ReactPositively() { animationController.DoSniff(); }
public void ReactPositively() { animationController.DoSniff(); Audio.AudioManager.I.PlaySound(Sfx.DogSnorting); }