예제 #1
0
파일: GameEnding.cs 프로젝트: koshakji/Maze
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.GetComponent <DirectedAgent>())
     {
         // if a game object with a DirectedAgent component (e.g. AI) ¯\_(ツ)_/¯
     }
     else if (other.GetComponent <GettingHelp>())
     {
         // if a human reaches the end
         GettingHelp playerHelp = other.GetComponent <GettingHelp>();
         playerHelp.setGameOver(true);
         GOController.timeToWin = playerHelp.getTime();
         SceneManager.LoadScene("GameOver");
     }
 }
예제 #2
0
    // Use this for initialization
    void Start()
    {
        Cursor.visible = false;

        // initializing maze

        InitializeMaze();

        // building the maze with the hunt and kill algorithm
        MazeAlgorithm ma = new HuntAndKillMazeAlgorithm(mazeCells);

        ma.CreateMaze();

        // building the navmesh for the navAgent
        surface.BuildNavMesh();

        // instantiating the endobject at endpoint
        endObject = Instantiate(endObject, endPoint, Quaternion.identity);

        // giving the endobject audio source to the player
        playerHelp = player.GetComponent <GettingHelp>();
        playerHelp.setEnding(endObject.GetComponent <AudioSource>());
    }