This file contains hidden or 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
// this needs to go into the ship's AI script | |
public integer numFramesBetweenAICall; | |
integer currentFrame; | |
void Awake() | |
{ | |
numFramesBetweenAICall = 5; | |
currentFrame = 0; | |
} |
This file contains hidden or 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
public class GameManager : MonoBehaviour | |
{ | |
public static GameManager instance = null; | |
void Awake() | |
{ | |
//Check if instance already exists | |
if (instance == null) | |
This file contains hidden or 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
//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( |
NewerOlder