Skip to content

Commit

Permalink
scripts that are used in the project
Browse files Browse the repository at this point in the history
  • Loading branch information
Angus-Fan authored Dec 3, 2019
1 parent dcf7200 commit 20f503a
Show file tree
Hide file tree
Showing 9 changed files with 2,630 additions and 0 deletions.
27 changes: 27 additions & 0 deletions ClickableTileScript.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ClickableTileScript : MonoBehaviour
{
//The x and y co-ordinate of the tile
public int tileX;
public int tileY;
//The unit on the tile
public GameObject unitOnTile;
public tileMapScript map;


/*
* This was used in Quill18Create'sTutorial, I no longer use this portion
private void OnMouseDown()
{
Debug.Log("tile has been clicked");
if (map.selectedUnit != null)
{
map.generatePathTo(tileX, tileY);
}
}*/
}
23 changes: 23 additions & 0 deletions Node.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Node {

public List<Node> neighbours;
public int x;
public int y;
//Edges
public Node()
{
neighbours = new List<Node>();
}

public float DistanceTo(Node n)
{
return Vector2.Distance(new Vector2(x, y), new Vector2(n.x, n.y));
}



}
33 changes: 33 additions & 0 deletions Tile.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[System.Serializable]
public class Tile
{

public string name;
public GameObject tileVisualPrefab;
public GameObject unitOnTile;
public float movementCost = 1;
public bool isWalkable=true;

/*
private int x;
private int y;
public Tile( int xLocation, int yLocation)
{
x = xLocation;
y = yLocation;
}
public void setCoords(int xLocation, int yLocation)
{
x = xLocation;
y = yLocation;
}
*/
}
Loading

0 comments on commit 20f503a

Please sign in to comment.