You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.5 KiB

using System.Runtime.CompilerServices;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Cell : MonoBehaviour
{
GameManager gameManager;
public GameObject mask = null; //选中角色时在单元格上显示攻击范围
public int cost = 1; //走在单元格上消耗的行动点数
public int damage = 0; //单元格对站在上面的角色造成的伤害
bool occupied = false; //是否有角色占着单元格
public Character currentCharacter; //当前单元格上的角色
public Vector2 GetPos => new Vector2(((int)this.transform.position.x), ((int)this.transform.position.y));
private void Awake()
{
gameManager = GameObject.Find("GameManager").GetComponent<GameManager>();
}
public void SetOccupied(bool value)
{
occupied = value;
}
public bool GetOccupied()
{
return occupied;
}
public void SetMask(bool value)
{
mask.SetActive(value);
}
public void SetCurrentCharacter(Character character)
{
currentCharacter = character;
if(character != null)
{
character.mCell = this;
}
}
public Character GetCurrentCharacter()
{
return currentCharacter;
}
private void OnMouseEnter()
{
gameManager.ChangeCellInformation(cost, damage);
}
}