AkiraPixelWind/Assets/Scripts/Main/Role/RoleBase.cs
2023-01-05 18:32:58 +08:00

69 lines
1.7 KiB
C#

using Axibug;
using Axibug.Runtime;
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR;
namespace Game
{
public abstract class RoleBase : MonoBehaviour
{
public E_NODE_TYPE RoleType => mBaseData.RoleType;
public long RoleID => mBaseData.innate.roleid;
public ICharMachineBase Anime => mAnime;
public Vector2 InputV2;
public bool mIsMove = false;
/// <summary>
/// ¶¯»­¿ØÖÆÆ÷
/// </summary>
protected ICharMachineBase mAnime;
protected S_ROLE_DATA_BASE mBaseData;
bool LastIsMove = false;
public void Update()
{
bool ToMoveState = false;
if (InputV2 != Vector2.zero)
ToMoveState = true;
if (LastIsMove != ToMoveState)
{
AxibugLog.Debug("MeshChangeState =>" + ToMoveState);
MeshChangeState(ToMoveState);
}
LastIsMove = ToMoveState;
}
public abstract void MeshChangeState(bool ToMoveState);
/// <summary>
/// ³õʼ»¯
/// </summary>
/// <param name="data"></param>
public virtual void Init(S_ROLE_DATA_BASE data)
{
mBaseData = data;
if (RoleType == E_NODE_TYPE.N_MAINPLAYER)
{
mAnime = new CharacterMachine();
mAnime.InitMachine(transform.Find("Model"));
}
else if (RoleType == E_NODE_TYPE.N_MONSTER)
{
}
else if (RoleType == E_NODE_TYPE.N_NPC)
{
}
}
public abstract void Release();
}
}