2023-01-02 23:28:14 +08:00
|
|
|
|
using Axibug.Runtime;
|
|
|
|
|
using Bright.Serialization;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using Game.Config;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using static Axibug.Utility;
|
|
|
|
|
using UnityEditor;
|
|
|
|
|
using Axibug.Resources;
|
|
|
|
|
|
|
|
|
|
namespace Game
|
|
|
|
|
{
|
|
|
|
|
public class MainPlayerComponent : GameComponent
|
|
|
|
|
{
|
|
|
|
|
public Transform CamPos;
|
|
|
|
|
|
2023-01-05 18:32:58 +08:00
|
|
|
|
public MainRole Player;
|
|
|
|
|
|
|
|
|
|
//Rigidbody mRigidbody;
|
2023-01-02 23:28:14 +08:00
|
|
|
|
public bool bLoadFinish { get; private set; } = false;
|
|
|
|
|
|
2023-01-05 18:32:58 +08:00
|
|
|
|
public bool InGame = false;
|
|
|
|
|
|
2023-01-02 23:28:14 +08:00
|
|
|
|
private void OnEnable()
|
|
|
|
|
{
|
|
|
|
|
CamPos = transform.Find("CamPos");
|
2023-01-05 18:32:58 +08:00
|
|
|
|
InGame = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void ReSetMainPlayer()
|
|
|
|
|
{
|
|
|
|
|
Player = null;
|
2023-01-02 23:28:14 +08:00
|
|
|
|
}
|
2023-01-05 18:32:58 +08:00
|
|
|
|
|
2023-01-02 23:28:14 +08:00
|
|
|
|
void Start()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-05 18:32:58 +08:00
|
|
|
|
void Update()
|
|
|
|
|
{
|
|
|
|
|
Update_MoveForInput();
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-02 23:28:14 +08:00
|
|
|
|
public void LoadPlayer()
|
|
|
|
|
{
|
|
|
|
|
bLoadFinish = false;
|
|
|
|
|
|
2023-01-05 18:32:58 +08:00
|
|
|
|
Player = GamePlayEntry.RoleMgr.CreateMainRole();
|
2023-01-02 23:28:14 +08:00
|
|
|
|
|
2023-01-05 18:32:58 +08:00
|
|
|
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
SetMainCamera();
|
2023-01-02 23:28:14 +08:00
|
|
|
|
|
|
|
|
|
bLoadFinish = true;
|
|
|
|
|
}
|
|
|
|
|
|
2023-01-05 18:32:58 +08:00
|
|
|
|
public void SetMainCamera()
|
|
|
|
|
{
|
|
|
|
|
Camera.main.transform.parent = CamPos;
|
|
|
|
|
Camera.main.transform.localPosition = Vector3.zero;
|
|
|
|
|
Camera.main.transform.localEulerAngles = Vector3.zero;
|
|
|
|
|
}
|
2023-01-02 23:28:14 +08:00
|
|
|
|
|
2023-01-05 18:32:58 +08:00
|
|
|
|
public void Update_MoveForInput()
|
2023-01-02 23:28:14 +08:00
|
|
|
|
{
|
2023-01-05 18:32:58 +08:00
|
|
|
|
if (!Player) return;
|
|
|
|
|
Player.InputV2 = GamePlayEntry.Input.InputV2;
|
2023-01-02 23:28:14 +08:00
|
|
|
|
}
|
2023-01-05 18:32:58 +08:00
|
|
|
|
|
2023-01-02 23:28:14 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|