public override void Update() { if (enteredTrigger) { if (isNearFriend) { helpDelayCounter += Time.deltaTime; if (helpDelayCounter >= helpDelay) { playerAnimator.SetBool("isHelping", true); portalGun.EnableBeam(true); //Light friend color lightTimer += 0.1f * Time.deltaTime; Color newColor = Color.Lerp(Color.white * 0f, Color.white, lightTimer); friendMaterial.SetColor("_EmissionColor", newColor); if (Utils.ColorEquals(Color.white, newColor)) { GameState.Next(); return; } } } else { //Walk towards the friend Vector3 targetDir = friend.transform.position - player.transform.position; targetDir.y = 0f; targetDir = Quaternion.Euler(0f, -25f, 0f) * targetDir; if (targetDir.magnitude > 1.5f) { float step = 50f * Time.deltaTime; Vector3 newDir = Vector3.RotateTowards(player.transform.forward, targetDir, step, 0.0f); GameInput.cameraEulerAngles = Quaternion.LookRotation(newDir).eulerAngles; GameInput.vertical = 1f; GameInput.cameraForward = newDir; } else { GameInput.SimulateInput(false); GameInput.CaptureInput(true); isNearFriend = true; playerAnimator.SetTrigger("startKneeling"); GameManager.GetArtifact().GetComponent <AudioSource>().PlayDelayed(helpDelay); } } } }
public override void Update() { if (enteredTrigger) { float elapsed = Time.time - startTime; if (isNearSage && elapsed >= talkDuration) { if (elapsed >= talkDuration + pointDuration) { GameState.Next(); return; } //Update sage sage.transform.rotation = Quaternion.RotateTowards(sage.transform.rotation, sageTargetRotation, 250f * Time.deltaTime); if (!isPointing) { sage.GetComponent <Animator>().SetTrigger("isPointing"); isPointing = true; } } //Walk towards the sage Vector3 targetDir = sage.transform.position - player.transform.position; targetDir.y = 0f; if (targetDir.magnitude > 1.5f) { float step = 50f * Time.deltaTime; Vector3 newDir = Vector3.RotateTowards(player.transform.forward, targetDir, step, 0.0f); GameInput.cameraEulerAngles = Quaternion.LookRotation(newDir).eulerAngles; GameInput.vertical = 1f; GameInput.cameraForward = newDir; } else { GameInput.SimulateInput(false); GameInput.CaptureInput(true); isNearSage = true; if (startTime < 0) { startTime = Time.time; player.GetComponent <Animator>().SetTrigger("isYelling"); player.GetComponent <PlayerSound>().YellingSound(); } } } }
public override State Next() { if (!enteredTrigger) { OnFriendTrigger(); return(this); } else { playerAnimator.SetTrigger("stopKneeling"); playerAnimator.SetBool("isHelping", false); GameInput.SimulateInput(false); GameInput.CaptureInput(false); portalGun.EnableBeam(false); SceneManager.LoadScene(MenuManager.MENU_SCENE_INDEX); return(new NullState()); } }
public IEnumerator FreeInput() { yield return(new WaitForSeconds(fadeTime)); GameInput.CaptureInput(false); }
public override State Next() { GameInput.CaptureInput(false); return(new SageState()); }