NLDClient-yudde/ProjectNLD/Assets/Code/Scripts/Gameplay/Area/BoardView/BoardViewData.cs

38 lines
1.5 KiB
C#

using System.Collections.Generic;
using Gameplay.Level;
using UnityEngine;
namespace Gameplay.Area.BoardView
{
public class BoardViewData
{
public TGS.Territory tgsTerritory;
public GameObject borderObj;
public List<int> cellIndexList = new List<int>();
private static readonly int Prop_HintColor1 = Shader.PropertyToID("_Color");
private static readonly int Prop_HintColor2 = Shader.PropertyToID("_SecondColor");
public void Destroy()
{
var tgsMap = LevelManager.Instance.CurrentLevel.Map.TerrainGridSystem;
var tIndex = tgsMap.TerritoryGetIndex(tgsTerritory);
tgsMap.TerritoryDestroy(tIndex);
Object.Destroy(borderObj);
}
public void CreateBoardViewObj(Color hintColor1, Color hintColor2)
{
var tgsSystem = LevelManager.Instance.CurrentLevel.Map.TerrainGridSystem;
tgsTerritory = tgsSystem.TerritoryCreate(cellIndexList);
borderObj = tgsSystem.ForceDrawTerritoryDrawInteriorBorder(tgsTerritory, 0, 1, hintColor1, hintColor2);
if (borderObj == null)
{
DebugUtil.LogError("GenerateBoard: borderObj is null: cellIndexList.count:" + cellIndexList.Count);
}
var getMaterial = borderObj.transform.GetChild(0).GetComponent<MeshRenderer>().material;
getMaterial.SetColor(Prop_HintColor1, hintColor1);
getMaterial.SetColor(Prop_HintColor2, hintColor2);
}
}
}