Files
HX_MapEditor/Assets/Scripts/Map/SceneArea.cs
tangbin b1c9facf3e dd
2025-06-22 18:23:47 +08:00

52 lines
1.3 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using static MapManager;
using static UnityEditor.PlayerSettings;
public class SceneArea : MonoBehaviour
{
public EditCellType editCellType;
public int Idx;
public void SetSceneAreaData(EditCellType editCellType,int idx)
{
this.editCellType = editCellType;
Idx = idx;
}
public void OnPointerClick()
{
Debug.Log($"Ñ¡ÖÐÎÒÁË...");
switch (editCellType)
{
case EditCellType.MonsterArea:
UIWindow.Instance.uiMonstersPanel.SelectMonsterPos(Idx);
break;
}
}
public void OnPointerDrag(Vector3 mousePosition)
{
Vector2Int pos = MapManager.Instance.map.selector.GetMouseByCell();
SetAreaPos(pos);
switch (editCellType)
{
case EditCellType.MonsterArea:
UIWindow.Instance.uiMonstersPanel.UpdateMonsterPos(Idx,pos);
break;
}
}
public void OnPointerUp()
{
Debug.Log($"ËÉ¿ªÎÒÁË...");
}
public void SetAreaPos(Vector2Int pos)
{
Vector3 realpos = MapManager.Instance.map.selector.getPosByGrid(pos);
transform.position = realpos;
}
}