2025-07-21 13:58:58 +08:00
|
|
|
using System;
|
2025-07-31 17:45:50 +08:00
|
|
|
using System.Linq;
|
2025-07-21 13:58:58 +08:00
|
|
|
using AI;
|
|
|
|
using Base;
|
|
|
|
using Data;
|
|
|
|
using Entity;
|
|
|
|
using Unity.VisualScripting;
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
namespace Prefab
|
|
|
|
{
|
|
|
|
public class EntityPrefab : MonoBehaviour
|
|
|
|
{
|
|
|
|
public Entity.Entity entity;
|
|
|
|
public Outline outline;
|
|
|
|
|
2025-07-31 17:45:50 +08:00
|
|
|
public Vector3 Position
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
return transform.position;
|
|
|
|
}
|
|
|
|
set
|
|
|
|
{
|
|
|
|
transform.position = value;
|
|
|
|
}
|
|
|
|
}
|
2025-07-21 13:58:58 +08:00
|
|
|
|
|
|
|
public void Init(Data.PawnDef pawnDef)
|
|
|
|
{
|
2025-07-25 19:16:58 +08:00
|
|
|
entity.Init(pawnDef);
|
2025-07-31 17:45:50 +08:00
|
|
|
|
|
|
|
outline.Init();
|
|
|
|
outline.Hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void DefaultInit()
|
|
|
|
{
|
|
|
|
var animator = GetComponentsInChildren<SpriteAnimator>();
|
|
|
|
ITick[] inf = animator;
|
|
|
|
entity.bodyAnimationNode.Add(Orientation.Down,inf.ToList());
|
|
|
|
entity.bodyAnimationNode.Add(Orientation.Up,inf.ToList());
|
|
|
|
entity.bodyAnimationNode.Add(Orientation.Left,inf.ToList());
|
|
|
|
entity.bodyAnimationNode.Add(Orientation.Right,inf.ToList());
|
2025-07-21 13:58:58 +08:00
|
|
|
outline.Init();
|
|
|
|
outline.Hide();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|