Merge branch 'develop' of https://git.brew.monster/anhld/perfect-world-unity into develop
This commit is contained in:
@@ -93,32 +93,32 @@ public class CharacterCtrl : MonoBehaviour
|
||||
playerVelocity.y = 0f;
|
||||
}
|
||||
|
||||
float x = joystick.Horizontal;
|
||||
float z = joystick.Vertical;
|
||||
//float x = joystick.Horizontal;
|
||||
//float z = joystick.Vertical;
|
||||
|
||||
Vector3 move = new Vector3(x, 0, z);
|
||||
move = Vector3.ClampMagnitude(move, 1f);
|
||||
//Vector3 move = new Vector3(x, 0, z);
|
||||
//move = Vector3.ClampMagnitude(move, 1f);
|
||||
|
||||
if (move != Vector3.zero)
|
||||
{
|
||||
transform.forward = move;
|
||||
if (isRun)
|
||||
{
|
||||
SetAnimRun();
|
||||
}
|
||||
else
|
||||
{
|
||||
SetAnimWalk();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SetAnimIdle();
|
||||
}
|
||||
//if (move != Vector3.zero)
|
||||
//{
|
||||
// transform.forward = move;
|
||||
// if (isRun)
|
||||
// {
|
||||
// SetAnimRun();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// SetAnimWalk();
|
||||
// }
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// SetAnimIdle();
|
||||
//}
|
||||
|
||||
playerVelocity.y += gravityValue * Time.deltaTime;
|
||||
Vector3 finalMove = (move * playerSpeed) + (playerVelocity.y * Vector3.up);
|
||||
controller.Move(finalMove * Time.deltaTime);
|
||||
//playerVelocity.y += gravityValue * Time.deltaTime;
|
||||
//Vector3 finalMove = (move * playerSpeed) + (playerVelocity.y * Vector3.up);
|
||||
//controller.Move(finalMove * Time.deltaTime);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +1,47 @@
|
||||
using CSNetwork.Protocols.RPCData;
|
||||
using System.Data;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
|
||||
public class GameController : MonoBehaviour
|
||||
{
|
||||
private static GameController instance;
|
||||
|
||||
[SerializeField] private CharacterCtrl characterPrefab;
|
||||
[SerializeField] private Transform ground;
|
||||
|
||||
Camera camera;
|
||||
|
||||
public static GameController Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = new GameController();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if(instance == null)
|
||||
{
|
||||
instance = this;
|
||||
}
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
camera = Camera.main;
|
||||
}
|
||||
|
||||
public void Log(string s)
|
||||
{
|
||||
Debug.LogError(s);
|
||||
}
|
||||
|
||||
public void InitCharacter(RoleInfo roleInfo)
|
||||
{
|
||||
CharacterCtrl character = Instantiate(characterPrefab, transform);
|
||||
|
||||
Reference in New Issue
Block a user