NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Gameplay/Character/Character.GameObject.cs

47 lines
1.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using cfg.CharacterCfg;
using Cysharp.Threading.Tasks;
using Framework;
using Gameplay.Emoji;
using Gameplay.Level;
using Gameplay.Performance;
using UnityEngine;
namespace Gameplay.Character
{
public partial class Character
{
public async UniTask LoadAsync()
{
var obj = await Load(runtimeData.configData.modelPath);
PerformanceManager.instance.HandleCreateUnit(obj);
await _OnObjLoaded(obj);
}
private async UniTask _OnObjLoaded(GameObject obj)
{
var isEnemy = troopId != ETroopsId.Self;
emojiManager = EmojiManager.inst.InitCharacter(this);
// emoji 会替换outline所以要在emoji之后
OutlineManager.instance.AutoAddFromObj(obj, isEnemy);
cAnim = new CharacterAnim(this);
await cAnim.Init();
weapon = new Weapon.ViewWeapon(this);
}
protected override void UpdateGameObjectName()
{
SetName($"Character_{GetID()}");
DebugUtil.Log(Node.GameObject.name);
}
protected override void OnDispose()
{
base.OnDispose();
emojiManager.Dispose();
SelecterView.Instance.UnSelect(Node);
}
}
}