[스파르타코딩]3주차 게임 앱 개발

최다혜
Jun 26, 2021

오늘은 게임의 효과음이나 코인 등 요소 등을 추가하는 작업을 했다.

이건 내 유니티 화면이당

배경이랑 캐릭터, 적 이미지는 일단 이대로하고 마지막에 내 맘에 드는 걸로 바꿀 예정이다. 저작권에 걸리지 않게!

  • soundmanager

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

public class SoundManager : MonoBehaviour

{

public static SoundManager I;

public float Volume;

public void Awake()

{

}

}

  • gameManager

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

using UnityEngine.SceneManagement;

public class GameManager : MonoBehaviour

{

public static GameManager I; // 게임 전체에서 단 하나만 존재(싱글톤)

public int Score;

private void Awake() //start보다 앞 과정

{

I = this;

}

public void AddScore(int score)

{

Score = Score + score;

Debug.Log(Score.ToString());

}

public void GameOver()

{

Invoke(“GameOver_”, 2);

}

void GameOver_()

{

SceneManager.LoadScene(0); //첫번째 씬을 불러옴(로드함)

}

public void WinGame()

{

GameOver_();

}

}

--

--