格子划分正常

This commit is contained in:
2025-06-15 20:14:45 +08:00
parent c7700419cb
commit bc58a9d0d5
29 changed files with 1546 additions and 107 deletions

View File

@@ -0,0 +1,121 @@
using System;
using UnityEngine;
public enum CellType
{
/// <summary>
/// <20><>Ч<EFBFBD><D0A7>
/// </summary>
None = 0,
/// <summary>
/// <20>ƶ<EFBFBD>
/// </summary>
Move = 1,
/// <summary>
/// <20>
/// </summary>
Obstacle = 2,
/// <summary>
/// <20><><EFBFBD><EFBFBD>
/// </summary>
Hide = 4,
/// <summary>
/// <20>н<EFBFBD>ɫռ<C9AB>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>̬<EFBFBD>仯ʱ<E4BBAF><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
/// </summary>
HadRole = 8,
/// <summary>
/// <20><>ȫ<EFBFBD><C8AB>
/// </summary>
Safe = 16,
/// <summary>
/// <20><>̯<EFBFBD><CCAF><EFBFBD><EFBFBD>
/// </summary>
Stall = 32,
}
[Flags]
public enum CellLayer
{
Move = 1, //<2F>ƶ<EFBFBD>
Obstacle = 2, //<2F>
Hide = 4, //<2F><><EFBFBD><EFBFBD>
Safe = 16, //<2F><>ȫ<EFBFBD><C8AB>
Stall = 32, //<2F><>̯
Audio = 64, //<2F><>Ч
Trigger = 128, //<2F><><EFBFBD><EFBFBD>
Monster = 256 //<2F><><EFBFBD><EFBFBD>
}
/// <summary>
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫ
/// </summary>
public class AreaColor
{
public static Color Monster = Color.red;
public static Color Npc = Color.yellow;
public static Color Stall = Color.magenta;
public static Color Relive = Color.green;
public static Color Audio = Color.white;
public static Color Trans = Color.blue;
public static Color Born = Color.green;
}
public class CellTypeColors
{
public static Color None = new Color(0x80 / 255f, 0x80 / 255f, 0x80 / 255f); // <20><>ɫ (#808080)
public static Color Move = new Color(0x33 / 255f, 0xcc / 255f, 0x33 / 255f); // <20><>ɫ (#33cc33)
public static Color Obstacle = new Color(0xff / 255f, 0x00 / 255f, 0x00 / 255f); // <20><>ɫ (#ff4d4d)
public static Color Hide = new Color(0x33 / 255f, 0x33 / 255f, 0x33 / 255f); // <20><><EFBFBD><EFBFBD>ɫ (#333333)
public static Color HadRole = new Color(0xb3 / 255f, 0x33 / 255f, 0xb3 / 255f); // <20><>ɫ (#b333b3)
public static Color Safe = new Color(0x00 / 255f, 0xff / 255f, 0xff / 255f); // <20><>ɫ (#00ffff)
public static Color Stall = new Color(0xff / 255f, 0xff / 255f, 0x99 / 255f); // dz<><C7B3>ɫ (#ffff99)
public static Color Water = new Color(0x00 / 255f, 0x4c / 255f, 0xb3 / 255f); // ˮ<><CBAE>ɫ (#004cb3)
public static Color Snow = new Color(0xff / 255f, 0xff / 255f, 0xff / 255f); // <20><>ɫ (#ffffff)
public static Color Sand = new Color(0xff / 255f, 0xcc / 255f, 0x66 / 255f); // ɳ<><C9B3>ɫ (#ffcc66)
public static Color Stone = new Color(0x66 / 255f, 0x66 / 255f, 0x66 / 255f); // <20><><EFBFBD><EFBFBD>ɫ (#666666)
public static Color Wood = new Color(0x8B / 255f, 0x45 / 255f, 0x13 / 255f); // <20><>ɫ (#8B4513)
public static Color Grass = new Color(0x00 / 255f, 0xff / 255f, 0xff / 255f); // <20><>ɫ (#00ffff)
public static Color Dirt = new Color(0xff / 255f, 0x49 / 255f, 0x00 / 255f); // dz<><C7B3>ɫ (#FF4900)
public static Color GetColor(CellType cellType)
{
Color color = Color.clear; // <20><>ʼ<EFBFBD><CABC>Ϊ<EFBFBD><CEAA>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB>ƥ<EFBFBD><C6A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
if (cellType == CellType.None) return CellTypeColors.None;
if (true)
{
if (cellType.HasFlag(CellType.Move)) color += CellTypeColors.Move;
}
else if (true)
{
if (cellType.HasFlag(CellType.Safe)) color += CellTypeColors.Safe;
}
else if (true)
{
if (cellType.HasFlag(CellType.Stall)) color += CellTypeColors.Stall;
}
if (cellType.HasFlag(CellType.Obstacle)) color += CellTypeColors.Obstacle;
// <20><><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Χ,<2C>Ȳ<EFBFBD><C8B2><EFBFBD>һ<EFBFBD><D2BB>
//color /= 7.0f; // 7 <20><> CellType <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
return color;
}
public static string GetAreaStr(int barrier)
{
string areaStr = " ";
CellType cellType = (CellType)(barrier & 0xffff);
if (cellType == CellType.None)
{
areaStr = "<22><>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>";
return areaStr;
}
if (cellType.HasFlag(CellType.Move)) areaStr += "<22><><EFBFBD>ƶ<EFBFBD>";
if (cellType.HasFlag(CellType.Obstacle)) areaStr += "|<7C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
if (cellType.HasFlag(CellType.Safe)) areaStr += "|<7C><>ȫ<EFBFBD><C8AB>";
if (cellType.HasFlag(CellType.Stall)) areaStr += "|<7C><>̯<EFBFBD><CCAF>";
return areaStr;
}
}