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;
'Unity > 슈팅게임 만들기' 카테고리의 다른 글
Unity :: 간단한 슈팅게임 예제 - UI 설정2 (게임시작) (0) | 2016.06.21 |
---|---|
Unity :: 간단한 슈팅게임 예제 - UI 설정1 (게임시작) (0) | 2016.06.20 |
Unity :: 간단한 슈팅게임 예제 - 플레이어 가두기, 적 카메라 나갔을 때 제거 (0) | 2016.06.13 |
Unity :: 간단한 슈팅게임 예제 - 적 랜덤생성 (0) | 2016.06.07 |
Unity :: 간단한 슈팅게임 예제 - 자동 공격 (0) | 2016.04.18 |
WRITTEN BY