This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
public class AIUnit : Unit { | |
Renderer rend; | |
GameManager gm; | |
Pathfinding path; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
public class AIUnit : Unit { | |
GameManager gm; | |
Pathfinding path; | |
Grid grid; | |
Renderer rend; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
public class AIUnit : Unit { | |
GameManager gm; | |
Pathfinding path; | |
Grid grid; | |
Renderer rend; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Method to add in forest tiles to the map | |
void AddForests() { | |
// A for loop is run, with i starting at 0, and increasing until it has reached a sixth | |
// of the total tiles, calculated by multiplying the X and Y map lengths, and dividing | |
// the result by 6 | |
for (int i = 0; i < Mathf.RoundToInt((worldSize.x * worldSize.y) / 6); i++) { | |
// Random X and Y variables are generated | |
int x = Mathf.RoundToInt(Random.Range(0, worldSize.x)); | |
int y = Mathf.RoundToInt(Random.Range(0, worldSize.y)); | |
// If the forest bool of the tile attached to the node with the random |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Makes tiles populated by units unwalkable, so they cannot be moved to, or stopped on | |
void BlockUnitTiles() { | |
// If the current unit is a User unit, and moving | |
if (userUnits.Contains(units[currentUnitIndex]) && units[currentUnitIndex].moving) { | |
// For every unit | |
foreach(Unit u in units) { | |
// If the unit is not the current unit | |
if(u != units[currentUnitIndex]) | |
// Set the walkable bool on the node of the populated tile to false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using System.Collections.Generic; | |
public class AIUnit : Unit { | |
GameManager gm; | |
Pathfinding path; | |
Grid grid; | |
Renderer rend; |
OlderNewer