Commit 3cede061 authored by tmorga18's avatar tmorga18
Browse files

added the map maker

parent 08af3fb3
fileFormatVersion: 2
guid: a3ed57936c2e54d79bd7b02efc51f48f
timeCreated: 1480641508
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: f43c4164f274d4d64905506dad6a5f3f
timeCreated: 1480641523
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
......@@ -17,6 +17,7 @@ public class Actions : MonoBehaviour {
public int fireballSpeed = 5;
public bool unlockedWaterShield = false;
public bool waterShieldUsable = true;
private float waterShieldTimer = 0.0f;
public float waterShieldCooldown = 5.0f;
......@@ -72,17 +73,19 @@ public class Actions : MonoBehaviour {
}
if(Input.GetButtonDown("Fire3")) {
if(unlockedWaterShield == true) {
// Increment the counter
abilitiesCounter++;
// Increment the counter
abilitiesCounter++;
// If the counter goes out of range of the array's size, reset it to 0
if(abilitiesCounter > abilities.Length - 1) {
abilitiesCounter = 0;
}
// If the counter goes out of range of the array's size, reset it to 0
if(abilitiesCounter > abilities.Length - 1) {
abilitiesCounter = 0;
}
// Call the ChooseAbility() function
CycleAbility();
// Call the ChooseAbility() function
CycleAbility();
}
}
// Checks to see if the water shield is off cooldown and changes the image opacity accordingly
......
......@@ -8,7 +8,7 @@ public class MapLoader : MonoBehaviour {
void Start () {
string text = System.IO.File.ReadAllText ("Assets\\Resources\\Maps\\" + fileName + ".txt");
string text = System.IO.File.ReadAllText ("Assets/Resources/Maps/" + fileName + ".txt");
string[] delim = { "\r\n" };
......@@ -19,7 +19,7 @@ public class MapLoader : MonoBehaviour {
int x = int.Parse (coords[0].ToString ());
int y = int.Parse (coords[1].ToString ());
Tile[,] map = new Tile[y, x];
//Tile[,] map = new Tile[y, x];
float startx;
float starty;
......@@ -31,19 +31,25 @@ public class MapLoader : MonoBehaviour {
x = int.Parse (args [0]);
y = int.Parse (args [1]);
map [x, y].walkable = bool.Parse (args [2]);
map [x, y].weight = float.Parse (args [3]);
//map [x, y].walkable = bool.Parse (args [2]);
//map [x, y].weight = float.Parse (args [3]);
map [x, y] = ((GameObject) Instantiate(Resources.Load<GameObject> ("Prefabs/" + args[4]))).GetComponent<Tile> ();
//map [x, y] = ((GameObject)
string path = "Prefabs/" + args[4];
GameObject prefab = Resources.Load<GameObject> (path);
Debug.Log(path);
Debug.Log(prefab);
GameObject go = Instantiate(prefab);//.GetComponent<Tile> ();
go.transform.position = new Vector3(x, y, 0);
startx = (float)x - (float)map.GetLength(0) / 2f;
starty = (float)y - (float)map.GetLength(1) / 2f;
//startx = (float)x - (float)map.GetLength(0) / 2f;
//starty = (float)y - (float)map.GetLength(1) / 2f;
map [x, y].transform.position = new Vector3 (startx, starty, 0);
//map [x, y].transform.position = new Vector3 (startx, starty, 0);
}
Map.map = map;
//Map.map = map;
}
Tile[,] GenerateTiles (int rows, int cols) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment