NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Gameplay/Camp/Fsm/BuildingCampState.cs

44 lines
1.3 KiB
C#

using LTGame;
using System.Collections;
using System.Collections.Generic;
using TGS;
using UnityEngine;
namespace Gameplay.Camp.Fsm
{
/// <summary>
/// 营地编辑状态
/// </summary>
public class BuildingCampState : BaseCampState
{
public BuildingCampState(Camp camp) : base((int)E_CampState.Building, camp)
{
}
public override void Enter(NBaseState exitState, object param)
{
base.Enter(exitState, param);
camp.GridSystem.showCells = true;
camp.GridSystem.showTerritories = true;
camp.GridSystem.showTerritoriesInteriorBorders = true;
camp.GridSystem.ShowAll();
#region 设置格子颜色
foreach (Cell cell in camp.GridSystem.cells)
{
if (!camp.TryGetCellStateByIndex(cell.index, out E_CampCellState cellState))
continue;
Color color = cellState switch
{
E_CampCellState.Occupancy => Color.black,
E_CampCellState.Empty => new Color(0f, 0f, 0f, 0f),
_ => Color.white,
};
camp.GridSystem.CellSetColor(cell.index, color);
}
#endregion
}
}
}