/*
http://www.cgsoso.com/forum-211-1.html
CG搜搜 Unity3d 每日Unity3d插件免费更新 更有VIP资源!
CGSOSO 主打游戏开发,影视设计等CG资源素材。
插件如若商用,请务必官网购买!
daily assets update for try.
U should buy the asset from home store if u use it in your project!
*/
using MS;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class LevelDesignCell : MonoBehaviour
{
public Vector2Int pos;
public Image selectionImage;
public LevelCellData cellData;
public Cell cell;
public LevelDesignCell RightCell
{
get
{
Vector2Int v = pos + Vector2Int.right;
if (!IsValidIndex(v))
{
return null;
}
return GetCellFromVector(v);
}
}
public LevelDesignCell LeftCell
{
get
{
Vector2Int v = pos + Vector2Int.left;
if (!IsValidIndex(v))
{
return null;
}
return GetCellFromVector(v);
}
}
public LevelDesignCell TopCell
{
get
{
Vector2Int v = pos + Vector2Int.down;
if (!IsValidIndex(v))
{
return null;
}
return GetCellFromVector(v);
}
}
public LevelDesignCell BottomCell
{
get
{
Vector2Int v = pos + Vector2Int.up;
if (!IsValidIndex(v))
{
return null;
}
return GetCellFromVector(v);
}
}
private void Start()
{
if (LevelDesigner.instance != null)
{
GetComponent().onLeftClick.AddListener(delegate
{
LevelDesigner.instance.OnButtonClick(this);
});
GetComponent().onRightClick.AddListener(delegate
{
LevelDesigner.instance.OnButtonClick(this);
LevelDesigner.instance.cellTypePopup.Open();
});
}
}
[ContextMenu("Update")]
public void UpdateCell()
{
if (cell != null)
{
UnityEngine.Object.Destroy(cell.gameObject);
}
cell = UnityEngine.Object.Instantiate(LevelDesigner.instance._cellPrefab[cellData.CellIndex], base.transform);
cell.SetLevelData(cellData);
cell.GetComponent().enabled = false;
cell.GetComponent