Skip to content

Instantly share code, notes, and snippets.

View Henry-E's full-sized avatar
😃

Henry-E

😃
View GitHub Profile
// this needs to go into the ship's AI script
public integer numFramesBetweenAICall;
integer currentFrame;
void Awake()
{
numFramesBetweenAICall = 5;
currentFrame = 0;
}
public class GameManager : MonoBehaviour
{
public static GameManager instance = null;
void Awake()
{
//Check if instance already exists
if (instance == null)
//All this should be in the GameManager Script
// initialise the list
public List<Transform> asteroids;
//this function will all you to use the ship's transform and the asteroid list to find the closest asteroid
void SortCharactersByDistance(Transform myTransform, List<Transform> characterList)
{
characterList.Sort (delegate(Transform t1, Transform t2){
return Vector3.Distance(t1.position, myTransform.position).CompareTo(