2024-08-31 15:35:12 +08:00
|
|
|
|
using AppGame;
|
|
|
|
|
using AppGame.Sync;
|
|
|
|
|
using Cinemachine;
|
|
|
|
|
using DG.Tweening;
|
|
|
|
|
using Game.JNGFrame.Logic.Entity;
|
|
|
|
|
using Game.JNGState.Logic.Data;
|
|
|
|
|
using JNGame.Math;
|
|
|
|
|
using JNGame.Sync.System;
|
|
|
|
|
using JNGame.Sync.View;
|
|
|
|
|
using Service;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace Game.JNGFrame.View.Entity
|
|
|
|
|
{
|
2024-09-22 03:27:16 +08:00
|
|
|
|
public class VDBoss : VDEntityBasis<EDBossData>
|
2024-08-31 15:35:12 +08:00
|
|
|
|
{
|
|
|
|
|
public GameObject VWorld => App.Resource.VWorld;
|
|
|
|
|
public GameObject Boss => App.Resource.Boss;
|
|
|
|
|
|
|
|
|
|
public VDBoss(SViewSystem root) : base(root)
|
|
|
|
|
{
|
2024-09-22 03:27:16 +08:00
|
|
|
|
Register((int)GDataValueCode.Position, OnUpdatePosition);
|
2024-08-31 15:35:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
2024-09-22 03:27:16 +08:00
|
|
|
|
private void OnUpdatePosition((GameObject View, EDBossData Data) tuple)
|
2024-08-31 15:35:12 +08:00
|
|
|
|
{
|
2024-09-22 03:27:16 +08:00
|
|
|
|
var (view, data) = tuple;
|
2024-08-31 15:35:12 +08:00
|
|
|
|
if (data.Value.Position != null)
|
|
|
|
|
{
|
|
|
|
|
view.transform.DOMove(data.Value.Position.ToVector3(), 0.5f);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override GameObject NewView(EDBossData data)
|
|
|
|
|
{
|
2024-09-22 03:27:16 +08:00
|
|
|
|
var view = Object.Instantiate(Boss, VWorld.transform);
|
|
|
|
|
view.name = $"Boss_{data.Id}";
|
|
|
|
|
return view;
|
2024-08-31 15:35:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override EDBossData[] GetData()
|
|
|
|
|
{
|
|
|
|
|
return GetService<EDBossDataSystem>().Datas;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void ViewRemove(GameObject view)
|
|
|
|
|
{
|
2024-09-13 04:06:25 +08:00
|
|
|
|
view.transform.DOKill();
|
2024-08-31 15:35:12 +08:00
|
|
|
|
Object.Destroy(view);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|