2024-07-10 19:51:24 +08:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using Framework;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
namespace Gameplay.Unit.Data
|
|
|
|
|
|
{
|
|
|
|
|
|
public class UnitViewData
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
public GameUnit owner;
|
|
|
|
|
|
|
|
|
|
|
|
public bool isShow;
|
2024-07-11 12:26:25 +08:00
|
|
|
|
|
|
|
|
|
|
private GameObject _activeObj;
|
2024-07-10 19:51:24 +08:00
|
|
|
|
|
|
|
|
|
|
public UnitViewData(GameUnit owner)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.owner = owner;
|
2024-07-11 12:26:25 +08:00
|
|
|
|
_SetActiveObj();
|
2024-07-10 19:51:24 +08:00
|
|
|
|
isShow = true;
|
|
|
|
|
|
}
|
2024-07-11 12:26:25 +08:00
|
|
|
|
|
|
|
|
|
|
private void _SetActiveObj()
|
|
|
|
|
|
{
|
|
|
|
|
|
switch (owner.gameunitType)
|
|
|
|
|
|
{
|
|
|
|
|
|
case EGameUnitType.Character:
|
|
|
|
|
|
_activeObj = owner.Node.GameObject.transform.GetChild(0).GetChild(1).gameObject;
|
|
|
|
|
|
break;
|
|
|
|
|
|
case EGameUnitType.Vehicle:
|
|
|
|
|
|
_activeObj = owner.Node.GameObject.transform.GetChild(0).gameObject;
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
_activeObj = owner.Node.GameObject.transform.GetChild(0).gameObject;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-07-10 19:51:24 +08:00
|
|
|
|
|
|
|
|
|
|
public void SetShow(bool setShow)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (isShow == setShow) return;
|
|
|
|
|
|
isShow = setShow;
|
|
|
|
|
|
EventManager.Instance.Send(EventManager.EventName.INFIGHT_UNIT_VISIBLE_CHANGE, owner);
|
2024-07-11 12:26:25 +08:00
|
|
|
|
_activeObj.SetActive(isShow);
|
2024-07-10 19:51:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|