1. player.cs 편집



canshoot=false



2. spawnManager.cs를 편집


public static spawnManager instance;


void Awake(){

if (spawnManager.instance == null)

spawnManager.instance = this;

}



3. GameManager.cs 편집

GameObject player;

int score = 0;


public static gameManager instance;


void Awake(){

if (gameManager.instance == null)

gameManager.instance = this;

}

// Use this for initialization

void Start () {

player = GameObject.FindWithTag ("Player");

Invoke ("StartGame", 3f);

}


void StartGame(){

player.GetComponent<player> ().canShoot = true;

spawnManager.instance.isSpawn = true;

}


public void AddScore(int enemyScore){

score += enemyScore;

print (score);

}


4. enemy.cs 편집

public int killScore = 100;

gameManager.instance.AddScore (killScore);



5 gameManager.cs 편집

public Text scoreText;

scoreText.text = "Score:"+score;



WRITTEN BY
Who1sth1s

,