mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-27 11:54:41 +00:00
39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
using HPJ.Simulation;
|
|
using HPJ.Simulation.Map;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace HPJ.Presentation
|
|
{
|
|
public class AreaDisplayTile : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
private Material _canReachMaterial;
|
|
[SerializeField]
|
|
private Material _cannotReachMaterial;
|
|
[SerializeField]
|
|
private MeshRenderer _meshRenderer;
|
|
public IntVector2 CurrentTileIndex { get; protected set; }
|
|
|
|
public void Initialize(int TileSize)
|
|
{
|
|
transform.localScale = new Vector3(0.9f * TileSize, 0.5f * TileSize, 0.9f * TileSize) / 100f;
|
|
}
|
|
|
|
public void Set(MapSet Map, IntVector2 TileIndex, bool CanReach)
|
|
{
|
|
if (CanReach)
|
|
{
|
|
_meshRenderer.material = _canReachMaterial;
|
|
}
|
|
else
|
|
{
|
|
_meshRenderer.material = _cannotReachMaterial;
|
|
}
|
|
CurrentTileIndex = TileIndex;
|
|
transform.position = NavigationManager.Instance.GetTileCenterWorldPosition(TileIndex, Map);
|
|
}
|
|
}
|
|
}
|