void OnMouseEnter() { if (!EventSystem.current.IsPointerOverGameObject()) { EntityBehaviour entity = IsThereAnEntity(); EntityBehaviour currentEntityBehaviour = GameManager.instance.currentEntityBehaviour; if (GameManager.instance.selectedSpell != null) { if (cellsColor[cellsColor.Count - 1] == grid.reachableSpellRange) { List <Vector2> aoeOfSpell = currentEntityBehaviour.GetAoeOfSpell( GameManager.instance.selectedSpell, new Vector2(x, y) ); foreach (Vector2 cell in aoeOfSpell) { CellBehaviour cellBehaviour = grid.GetCellBehaviour( x + (int)cell.x, y + (int)cell.y ); if (cellBehaviour != null && cellBehaviour.isWalkable) { coloredCells.Add( new Vector2(x + (int)cell.x, y + (int)cell.y) ); cellBehaviour.colorCell(grid.aoeSpellRange); } } } } else if (entity) { entity.MouseEnter(); } else { if (!GameManager.instance.currentEntityBehaviour.doMove) { List <Vector2> path = currentEntityBehaviour.SetMoveTargets(cell); if (path.Count <= currentEntityBehaviour.character.stats[Characteristic.CurrentMP]) { foreach (Vector2 cell in path) { coloredCells.Add(new Vector2(cell.x, cell.y)); grid.GetCellBehaviour( (int)cell.x, (int)cell.y ).colorCell(grid.pathMP); } } } } } else { OnMouseExit(); } }
public void ColorCells(List <Vector2> cells, Material material) { foreach (Vector2 cell in cells) { CellBehaviour cellBehaviour = GetCellBehaviour((int)cell.x, (int)cell.y); if (cellBehaviour != null && cellBehaviour.isWalkable) { cellBehaviour.colorCell(material); } } }