mirror of
http://47.107.252.169:3000/Roguelite-Game-Developing-Team/Gen_Hack-and-Slash-Roguelite.git
synced 2025-11-19 23:37:13 +08:00
Co-authored-by: m0_75251201 <m0_75251201@noreply.gitcode.com> Reviewed-on: http://47.107.252.169:3000/Roguelite-Game-Developing-Team/Gen_Hack-and-Slash-Roguelite/pulls/60
50 lines
1.4 KiB
C#
50 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Base;
|
|
using Data;
|
|
using Entity;
|
|
using UnityEngine;
|
|
|
|
namespace Prefab
|
|
{
|
|
public class EntityPrefab : MonoBehaviour
|
|
{
|
|
public Entity.Entity entity;
|
|
public Outline outline;
|
|
|
|
public Vector3 Position
|
|
{
|
|
get => transform.position;
|
|
set => transform.position = value;
|
|
}
|
|
|
|
public void Init(EntityDef entityDef)
|
|
{
|
|
entity.Init(entityDef);
|
|
outline.Init();
|
|
outline.Hide();
|
|
}
|
|
|
|
public void DefaultInit()
|
|
{
|
|
var animator = GetComponentsInChildren<SpriteAnimator>();
|
|
var inf = animator.Cast<ITick>().ToArray();
|
|
foreach (EntityState state in Enum.GetValues(typeof(EntityState)))
|
|
{
|
|
var orientationDict = new Dictionary<Orientation, ITick[]>();
|
|
foreach (Orientation orientation in Enum.GetValues(typeof(Orientation)))
|
|
orientationDict[orientation] = inf; // 所有值都指向同一个列表
|
|
}
|
|
|
|
outline.Init();
|
|
outline.Hide();
|
|
}
|
|
|
|
public override string ToString()
|
|
{
|
|
return $"实体定义: {entity.entityDef.defName}" +
|
|
$"实体位置: {entity.Position.x},{entity.Position.y},{entity.Position.z}";
|
|
}
|
|
}
|
|
} |