73 lines
2.1 KiB
C#
73 lines
2.1 KiB
C#
using cfg.CharacterCfg;
|
|
using Cysharp.Threading.Tasks;
|
|
using Gameplay.Area;
|
|
using Gameplay.Character;
|
|
using Gameplay.Performance;
|
|
using Gameplay.Unit;
|
|
using Gameplay.Unit.Data;
|
|
using Gameplay.Utils;
|
|
using PhxhSDK;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Security.Claims;
|
|
using UnityEngine;
|
|
|
|
namespace Gameplay.LegionBattle.Unit
|
|
{
|
|
/// <summary>
|
|
/// 军团战单位
|
|
/// </summary>
|
|
public class LegionBattleUnit : Framework.Wrapper.Unit
|
|
{
|
|
private readonly string modelPath;
|
|
|
|
/// <summary>
|
|
/// 军团战单位类型
|
|
/// </summary>
|
|
public readonly E_LegionBattleUnitType LegionBattleUnitType;
|
|
|
|
#region 属性
|
|
/// <summary>
|
|
/// 军团战单位数据
|
|
/// </summary>
|
|
public LegionBattleUnitData UnitData { get; private set; }
|
|
|
|
/// <summary>
|
|
/// 阵营
|
|
/// </summary>
|
|
public E_Faction Faction { get; private set; }
|
|
|
|
public Transform Transform { get { return _node.transform; } }
|
|
#endregion
|
|
|
|
public LegionBattleUnit(uint id, E_LegionBattleUnitType unitType, E_Faction faction) : base(id)
|
|
{
|
|
LegionBattleUnitType = unitType;
|
|
Faction = faction;
|
|
|
|
modelPath = PathEx.GetCharacterFightModelPath("A00001", 1);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 创建模型
|
|
/// </summary>
|
|
public async UniTask CreateAsync()
|
|
{
|
|
await AssetManager.Instance.PostPreload<GameObject>(modelPath);
|
|
GameObject obj = Load(modelPath);
|
|
PerformanceManager.instance.HandleCreateUnit(obj);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 设置位置
|
|
/// </summary>
|
|
/// <param name="cellIndex"></param>
|
|
/// <param name="yaw"></param>
|
|
public void SetPosAndYaw(int cellIndex, float yaw)
|
|
{
|
|
// 设置view
|
|
_node.GameObject.transform.position = LegionBattleManager.Instance.TGS.CellGetPosition(cellIndex);
|
|
_node.GameObject.transform.eulerAngles = new Vector3(0f, yaw, 0f);
|
|
}
|
|
}
|
|
} |