void ShowMovementRange() { List<int> neighbours = tgs.CellGetNeighbours(tgs.cellLastClickedIndex, (int)unitMovementPoints); if (neighbours != null) { tgs.CellFlash(neighbours, Color.yellow, 1f); } }
public List <int> AttackRange() { List <int> attackRange = new List <int>(); int maxRange = equippedWeapon.STATS["MAX_RANGE"].CalculateValue(); attackRange = tgs.CellGetNeighbours(currentCellIndex, maxRange); // If equipped weapon cannot be used at close range... if (equippedWeapon.STATS["MIN_RANGE"].CalculateValue() > 1) { List <Cell> neighbors = tgs.CellGetNeighbours(currentCellIndex); foreach (Cell unattackableCell in neighbors) { attackRange.Remove(unattackableCell.index); } } return(attackRange); }
private void ShowRange(bool useLineOfSight = false) { List <int> neighbours = tgs.CellGetNeighbours(tgs.cellHighlightedIndex, HighlightRange); if (neighbours != null) { if (useLineOfSight) { tgs.CellTestLineOfSight(tgs.cellHighlightedIndex, neighbours); } tgs.CellFlash(neighbours, Color.yellow, 1f); } }
void Start() { // playAud = GetComponent<playSequence>(); //grabs Audio treeSounds = gameObject.AddComponent <AudioSource>(); //TerrainGridSystem ref tgs = TerrainGridSystem.instance; randomRotation = 60 * Random.Range(0, 6); // Clone Sapling prefabs and Instantiate groundTile = tgs.CellGetAtPosition(transform.position, true); //transform.SetParent (); cellIndex = tgs.CellGetIndex(groundTile); neighbors = tgs.CellGetNeighbours(groundTile); tgs.CellSetCanCross(cellIndex, false); //fills up neighborIndexes with the proper cell indexes for (int i = 0; i < neighbors.Count; i++) { int index = tgs.CellGetIndex(neighbors[i]); neighborIndexes.Add(index); neighbourPos[i] = tgs.CellGetPosition(index); //this gives you neighbor cell position //can be used to see which cell you’re being given //raycast to this position to get the plant collider and get the sequencer if (tgs.CellGetTag(index) == 1) { //this cell has a tree planted, but don’t run this in start //send to an array of “plants nearby” //for any rule make a bool in plantlife for “isFollowingRule” to see if neighbours are occupied or following a rule already //are two adjacent cells in the index occupied that’s a triad //if all cells are occupied that’s an arp, arp beats triad } } if (plantedInEditor) { ageCounter -= 1; transform.position = tgs.CellGetPosition(cellIndex); tgs.CellSetTag(cellIndex, 1); tgs.CellToggleRegionSurface(cellIndex, true, growingTexture); } else { //Set age and fruit ageCounter = 0; //fruitAmount = 0; growthPeriod = 1; } StartCoroutine(Growth()); }