mirror of
http://47.107.252.169:3000/Roguelite-Game-Developing-Team/Gen_Hack-and-Slash-Roguelite.git
synced 2025-11-20 05:37:11 +08:00
(client) feat:支持定义实体的碰撞体大小和偏移;建筑支持定义实体建筑和瓦片建筑,建筑支持指定按钮回调;添加存档管理器;Dev支持设置是否暂停;实体允许定义事件组;添加基地界面 (#57)
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/57
This commit is contained in:
59
Client/Assets/Scripts/Data/TileDef.cs
Normal file
59
Client/Assets/Scripts/Data/TileDef.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Tilemaps;
|
||||
|
||||
namespace Data
|
||||
{
|
||||
public class TileDef : Define
|
||||
{
|
||||
public Tile.ColliderType collider = Tile.ColliderType.None;
|
||||
public string texture;
|
||||
public float tileCost = 0;
|
||||
public RuleTileRuleDef[] rules;
|
||||
}
|
||||
|
||||
public class NeighborConditionDef:Define
|
||||
{
|
||||
public string position;
|
||||
public RuleTileRuleDef.NeighborConditionType Type;
|
||||
}
|
||||
public class RuleTileRuleDef : Define
|
||||
{
|
||||
public enum NeighborConditionType
|
||||
{
|
||||
Any, // 可以是任何瓦片
|
||||
This, // 必须是当前 Rule Tile 自身 (用于[4]位置)
|
||||
NotThis, // 不能是当前 Rule Tile 自身
|
||||
}
|
||||
|
||||
public NeighborConditionType[] neighborConditions = new NeighborConditionType[8];
|
||||
public NeighborConditionDef[] neighborConditionExtend;
|
||||
|
||||
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 float tileCost = 0;
|
||||
|
||||
// 构造函数或其他辅助方法
|
||||
public RuleTileRuleDef()
|
||||
{
|
||||
for (int i = 0; i < neighborConditions.Length; i++)
|
||||
{
|
||||
neighborConditions[i] = NeighborConditionType.Any;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user