Co-authored-by: zzdxxz <2079238449@qq.com> Co-committed-by: zzdxxz <2079238449@qq.com>
52 lines
1.2 KiB
C#
52 lines
1.2 KiB
C#
using System;
|
|
using System.Linq;
|
|
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;
|
|
|
|
public Vector3 Position
|
|
{
|
|
get
|
|
{
|
|
return transform.position;
|
|
}
|
|
set
|
|
{
|
|
transform.position = value;
|
|
}
|
|
}
|
|
|
|
public void Init(Data.EntityDef entityDef)
|
|
{
|
|
entity.Init(entityDef);
|
|
|
|
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());
|
|
outline.Init();
|
|
outline.Hide();
|
|
}
|
|
|
|
|
|
|
|
}
|
|
} |