private void StartUpdate() { timeSinceLast += Time.deltaTime; if (timeSinceLast < .1f) { return; } GazePosition gaze = GetGaze(); if (gaze == GazePosition.Centre || gaze == GazePosition.Right) { timeLookingAtModel += timeSinceLast; } if (timeLookingAtModel >= 2f) { lookingActive = true; timeOfLookingChange = Time.time; justChangedLooking = true; StartCoroutine(SitUp(2f)); Invoke("AnimGetUp", 4f); StartCoroutine(WalkTo(CharFrontLoc.position, 6f, 5f, Phase.InFront)); currPhase = Phase.WalkingTo; } timeSinceLast = 0f; }
private void StartUpdate() { timeSinceLast += Time.deltaTime; if (timeSinceLast < .1f) { return; } GazePosition gaze = GetGaze(); if (gaze == GazePosition.Centre || gaze == GazePosition.Right) { timeLookingAtModel += timeSinceLast; } if (timeLookingAtModel >= 1f) { StartCoroutine(ChangeLooking(0f, true)); StartCoroutine(SitUp(2f)); timeLookingAtModel = float.MinValue; //make sure it doesn't happen again } timeSinceLast = 0f; }
private void InFrontUpdate() { inFrontTime -= Time.deltaTime; if (inFrontTime <= 0) { currPhase = Phase.ToCorner; WalkTo(CharCornerLoc.position, 2f, 4f, Phase.ToCorner); WalkTo(CharEndLoc.position, 6f, 4f, Phase.End); } GazePosition gaze = GetGaze(); if (gaze == GazePosition.Left) { animator.SetFloat(speedHash, .2f); currPos = gameObject.transform.position + (Vector3.forward * .2f * Time.deltaTime); } else if (gaze == GazePosition.Right) { animator.SetFloat(speedHash, .2f); currPos = Vector3.Lerp(gameObject.transform.position, gameObject.transform.position + Vector3.back, .2f * Time.deltaTime); } }