mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 03:14:47 +00:00
52 lines
1.4 KiB
C#
52 lines
1.4 KiB
C#
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
|
|
{
|
|
public class VDBoss : VDEntityBasis<EDBossData>
|
|
{
|
|
public GameObject VWorld => App.Resource.VWorld;
|
|
public GameObject Boss => App.Resource.Boss;
|
|
|
|
public VDBoss(SViewSystem root) : base(root)
|
|
{
|
|
Register((int)GDataValueCode.Position, OnUpdatePosition);
|
|
}
|
|
|
|
private void OnUpdatePosition((GameObject View, EDBossData Data) tuple)
|
|
{
|
|
var (view, data) = tuple;
|
|
if (data.Value.Position != null)
|
|
{
|
|
view.transform.DOMove(data.Value.Position.ToVector3(), 0.5f);
|
|
}
|
|
}
|
|
|
|
public override GameObject NewView(EDBossData data)
|
|
{
|
|
var view = Object.Instantiate(Boss, VWorld.transform);
|
|
view.name = $"Boss_{data.Id}";
|
|
return view;
|
|
}
|
|
|
|
public override EDBossData[] GetData()
|
|
{
|
|
return GetService<EDBossDataSystem>().Datas;
|
|
}
|
|
|
|
public override void ViewRemove(GameObject view)
|
|
{
|
|
view.transform.DOKill();
|
|
Object.Destroy(view);
|
|
}
|
|
}
|
|
} |