コード例 #1
0
    private void Awake()
    {
        player = FindObjectOfType <Player>();
        if (player)
        {
            player.InitializePlayer(this);
        }

        playerCamera = FindObjectOfType <FirstPersonCamera>();
        if (playerCamera)
        {
            playerCamera.InitializePlayerCamera(this);
        }
        titleScreen = FindObjectOfType <TitleScreen>();
        if (titleScreen)
        {
            titleScreen.InitializeTitleScreen(this);
        }


        checkObjectCamera = FindObjectOfType <CheckObjectCamera>();
        if (checkObjectCamera)
        {
            checkObjectCamera.InitializeCheckObjectCamera(this);
        }

        playerCamera.target = player.headPosition;

        interfactableObjectList = new List <InteractableObject>();

        InteractableObject[] interactableObjects = FindObjectsOfType <InteractableObject>();

        foreach (InteractableObject i in interactableObjects)
        {
            i.InitializeInteractableObject(this);
            interfactableObjectList.Add(i);
        }

        titaDialogue = FindObjectOfType <TitaDialogue>();
        if (titaDialogue)
        {
            titaDialogue.InitializeDialogue(this);
        }

        creditsScene = FindObjectOfType <CreditsScene>();
        if (creditsScene)
        {
            creditsScene.InitializeCreditsScene(this);
        }
        miniGame = MiniGame.None;

        loadingScreen = FindObjectOfType <LoadingScreen>();
        if (loadingScreen)
        {
            loadingScreen.InitializeLoadingScreen(this);
        }


        InitializeLumpiaMiniGame();
        InitializeLechonMiniGame();
        volume = 0.5f;

        audioSource      = GetComponent <AudioSource>();
        audioSource.clip = introMusic;
        audioSource.Play();
    }