NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Gameplay/Map/MapBlockData.cs

59 lines
1.5 KiB
C#
Raw Normal View History

2023-12-20 19:25:48 +08:00
using LC.Newtonsoft.Json;
2023-08-22 19:08:45 +08:00
using System;
2024-03-26 12:19:26 +08:00
using System.Collections.Generic;
using cfg.BuffCfg;
2023-08-22 19:08:45 +08:00
using Gameplay;
2024-03-26 12:19:26 +08:00
using Gameplay.Buff;
using Gameplay.Character;
using Gameplay.Unit.Data;
2023-11-30 15:47:49 +08:00
using PhxhSDK.Phxh;
2024-03-26 12:19:26 +08:00
using Sirenix.OdinInspector;
2023-08-22 19:08:45 +08:00
using UnityEngine;
using UnityEngine.Serialization;
2023-11-19 22:57:17 +08:00
[Serializable]
2023-08-22 19:08:45 +08:00
public class MapBlockData
{
2023-12-18 19:42:46 +08:00
public int TerrainTypeIndex = -1;
2024-03-26 12:19:26 +08:00
2023-08-22 19:08:45 +08:00
public bool IsDefaultTerrainType()
{
return TerrainTypeIndex == -1;
}
public TerrainTypeProperty GetTerrainTypeProperty()
{
var props = TerrainTypeConfig.TerrainTypeProperties;
if (props != null && TerrainTypeIndex >= 0 && TerrainTypeIndex < props.Count)
{
return props[TerrainTypeIndex];
}
2024-03-26 12:19:26 +08:00
2023-08-22 19:08:45 +08:00
return TerrainTypeConfig.DefaultTerrainTypeProperty;
}
}
[Serializable]
public class TerrainTypeProperty
{
public string name;
public bool selectable;
[FormerlySerializedAs("canPass")] public bool emptyBlock;
public bool banAttack;
public bool banGFX;
public int crossLevel;
2024-03-26 12:19:26 +08:00
public bool AddBuff;
2023-08-22 19:08:45 +08:00
2024-03-26 12:19:26 +08:00
[ShowIf("AddBuff")] public EBuffType BuffType;
[ShowIf("AddBuff")] public EGameUnitType BuffTarget;
[ShowIf("IsAddBuffToCharacter")] public int BuffToTroopId;
2023-08-22 19:08:45 +08:00
2024-03-26 12:19:26 +08:00
[JsonConverter(typeof(ColorJsonConverter))]
public Color Color;
2023-08-22 19:08:45 +08:00
2024-03-26 12:19:26 +08:00
private bool IsAddBuffToCharacter()
{
return AddBuff && BuffTarget == EGameUnitType.Character;
}
}