Init
This commit is contained in:
43
Assets/GameScripts/Main/Player/ThirdCharacterController.cs
Normal file
43
Assets/GameScripts/Main/Player/ThirdCharacterController.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using static UnityEngine.InputSystem.InputAction;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using YooAsset;
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
namespace Tuan.GameScripts.Main
|
||||
{
|
||||
public class ThirdCharacterController : MonoBehaviour
|
||||
{
|
||||
public CharacterController characterController;
|
||||
public Animator animator;
|
||||
public Transform forward;
|
||||
public Transform model;
|
||||
|
||||
public float moveSpeed = 5f;
|
||||
public float turnSpeed = 10f;
|
||||
public float jumpSpeed = 8f;
|
||||
public float gravity = 20f;
|
||||
public float minCameraDistance = 2f;
|
||||
public float maxCameraDistance = 10f;
|
||||
public float cameraZoomSpeed = 0.1f;
|
||||
|
||||
InputActionAsset playerActions;
|
||||
Vector2 moveInput;
|
||||
|
||||
async void Awake()
|
||||
{
|
||||
await LoadInputActonAsset();
|
||||
}
|
||||
async UniTask LoadInputActonAsset()
|
||||
{
|
||||
AssetHandle handle = YooAssets.LoadAssetAsync<InputActionAsset>("PlayerActions");
|
||||
await handle.ToUniTask();
|
||||
playerActions = handle.AssetObject as InputActionAsset;
|
||||
}
|
||||
|
||||
public void OnMove(CallbackContext context)
|
||||
{
|
||||
moveInput = context.ReadValue<Vector2>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2d7272fcdcd432041a59c95e74fb41f6
|
||||
Reference in New Issue
Block a user