(client) chore:修改了角色的身体结构的定义方式,现在图片资源统一使用ImageDef加载,使用了更节省资源的初始化方式;fix:修复了定义加载数组时只能初始化数组而不能初始化列表的问题

This commit is contained in:
m0_75251201
2025-08-22 20:43:55 +08:00
parent 3e099137a1
commit 8916440e7e
28 changed files with 1411 additions and 954 deletions

View File

@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using AI;
using Base;
@ -37,11 +38,17 @@ namespace Prefab
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());
var inf = animator.Cast<ITick>().ToList();
foreach (EntityState state in Enum.GetValues(typeof(EntityState)))
{
var orientationDict = new Dictionary<Orientation, List<ITick>>();
foreach (Orientation orientation in Enum.GetValues(typeof(Orientation)))
{
orientationDict[orientation] = inf; // 所有值都指向同一个列表
}
entity.bodyAnimationNode[state] = orientationDict;
}
outline.Init();
outline.Hide();
}