protected void UpdatePlayerAnim() { if (timeIdle > 0) { if (!playerGameItem.IsIdle) { playerGameItem.ChangeAnim(PlayerAnimType.Idle_Side); } else if (playerGameItem.CurAnim == PlayerAnimType.Idle_Side && timeIdle > 2f) { playerGameItem.ChangeAnim(PlayerAnimType.Idle_Front); } } else { if (isJumping) { if (playerGameItem.CurAnim != PlayerAnimType.Jump) { playerGameItem.ChangeAnim(PlayerAnimType.Jump); } } else { if (playerGameItem.CurAnim != PlayerAnimType.Walk) { playerGameItem.ChangeAnim(PlayerAnimType.Walk); } } if (horizontalInputSinceFixedUpdate > 0.05f) { playerGameItem.SetFlip(true); } else if (horizontalInputSinceFixedUpdate < -0.05f) { playerGameItem.SetFlip(false); } } }
protected void DoorStateLogic() { if (isDelay) { return; } if (!doorOpen) { doorOpen = true; houseRenderer.material.SetTexture("_MainTex", doorTexture); houseRenderer.material.SetTexture("_EmissionMap", doorTexture); doorGameObject.SetActive(true); roomAudioSource.Stop(); roomAudioSource.clip = doorAudioClip; roomAudioSource.Play(); } if (timingTimeInState >= currentIntroState.timing) { player.gameObject.SetActive(true); playerRb = player.GetComponent <Rigidbody>(); player.SetFlip(true); player.ChangeAnim(PlayerAnimType.Walk); playerRb.AddForce(Vector3.right * 5f, ForceMode.Impulse); keysGameObject.SetActive(true); FlipKeys(0); NextState(); return; } }