using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class cha : MonoBehaviour
{public charactercontrller characterContrller;
public gameobject Camra;
[range(1, 10)] public float WalkingSpeed;
[range(1, 10)] public float TurnSpeed;
void Start()
{
Cursor.LockState = CursorLockMode.Locked
charactercontrller = getcomponent();
}
void Update()
{
float verticalValue = input.Getaxis(“vertical”) * WalkingSpeed;
float HorizontalVaule = input.Getaxis(“horizontal”) * WalkingSpeed;
Vector3 fowardDirection = VerticalValue * Transform.Foward;
Vector3 SideDirection = HorizontalVaule * Transform.right;
Vector3 totalDirection = fowardDirection + SideDirection;
CharacterContrller.SimpleMove(totalDirection);
float rotatevalue = input.Getaxis(“mouse X”) * TurnSpeed;
Transform.Rotate(0, rotatevalue, 0);
float CamraRotatevalue = input.Getaxis(“mouse Y”) * TurnSpeed;
Camra.Transform.Rotate(CamraRotatevalue, 0, 0);
if (input.GetKeyDown(“escape”))
CursorLockState = CursorLockMode.none;
}
}