mirror of
http://47.107.252.169:3000/Roguelite-Game-Developing-Team/Gen_Hack-and-Slash-Roguelite.git
synced 2025-11-20 07:17:14 +08:00
(client) feat:实现技能树界面,实现地图生成器,实现维度指定,实现规则瓦片定义,实现逃跑逻辑,实现消息定义,实现武器动画,实现受击动画 fix: 修复单攻击子弹击中多个目标,修复人物属性计算错误 (#56)
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/56
This commit is contained in:
@@ -1,50 +1,52 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Xml.Linq;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Tilemaps;
|
||||
|
||||
namespace Data
|
||||
{
|
||||
public class TileDef : Define
|
||||
{
|
||||
public ImageDef texture;
|
||||
public string name = "";
|
||||
public Tile.ColliderType collider = Tile.ColliderType.None;
|
||||
|
||||
public override bool Init(XElement xmlDef)
|
||||
{
|
||||
base.Init(xmlDef);
|
||||
name = defName;
|
||||
return false;
|
||||
}
|
||||
public string texture;
|
||||
public RuleTileRuleDef[] rules;
|
||||
}
|
||||
|
||||
public class TileMappingTableDef : Define
|
||||
|
||||
public class RuleTileRuleDef : Define
|
||||
{
|
||||
public Dictionary<string, string> tileDict = new();
|
||||
public override bool Init(XElement xmlDef)
|
||||
public enum NeighborConditionType
|
||||
{
|
||||
base.Init(xmlDef);
|
||||
// 清空字典以确保没有遗留数据
|
||||
tileDict.Clear();
|
||||
// 检查 xmlDef 是否为空
|
||||
if (xmlDef == null)
|
||||
return false;
|
||||
foreach (var element in xmlDef.Elements())
|
||||
Any, // 可以是任何瓦片
|
||||
This, // 必须是当前 Rule Tile 自身 (用于[4]位置)
|
||||
NotThis, // 不能是当前 Rule Tile 自身
|
||||
}
|
||||
|
||||
public NeighborConditionType[] neighborConditions = new NeighborConditionType[8];
|
||||
|
||||
public RuleTile.TilingRuleOutput.OutputSprite outputType = RuleTile.TilingRuleOutput.OutputSprite.Single;
|
||||
public RuleTile.TilingRuleOutput.Transform transform = RuleTile.TilingRuleOutput.Transform.Fixed;
|
||||
|
||||
// --- 输出碰撞器类型 (Output Collider Type) ---
|
||||
// 如果需要为该规则设置特定的碰撞器类型
|
||||
public Tile.ColliderType outputCollider = Tile.ColliderType.None;
|
||||
|
||||
// --- 概率 (Probability) / Perlin Offset ---
|
||||
// 决定此规则被选中的可能性,或者用于Perlin噪声偏移
|
||||
public float chance = 0.5f; // 默认为100%
|
||||
|
||||
// --- 动画精灵 (Animation Sprites) ---
|
||||
// 如果 outputType 是 Animation,这里可以定义一系列动画帧的纹理路径或名称
|
||||
public List<string> animationTextures;
|
||||
public float animationSpeed = 1f;
|
||||
|
||||
// 构造函数或其他辅助方法
|
||||
public RuleTileRuleDef()
|
||||
{
|
||||
for (int i = 0; i < neighborConditions.Length; i++)
|
||||
{
|
||||
// 获取子元素的名称作为键
|
||||
var key = element.Name.LocalName;
|
||||
// 获取子元素的 value 属性作为值
|
||||
var value = element.Attribute("value")?.Value;
|
||||
// 检查 value 是否存在
|
||||
if (!string.IsNullOrEmpty(value))
|
||||
{
|
||||
tileDict[key] = value;
|
||||
}
|
||||
neighborConditions[i] = NeighborConditionType.Any;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user