コード例 #1
0
    void Awake()
    {
        instance = this;

        if (ScenarioController.instance == null)
        {
            //Debug Mode Start (scene open by itself)
            ScenarioController.beatLength = 60f / 130f;
            Time.timeScale = ScenarioController.getSpeedMult(debugSpeed);

            debugObjects = Instantiate(debugObjects, Vector3.zero, Quaternion.identity) as GameObject;

            MicrogameTimer.instance           = debugObjects.transform.FindChild("UI Camera").FindChild("Timer").GetComponent <MicrogameTimer>();
            MicrogameTimer.instance.beatsLeft = (float)beatDuration + (debugSimulateDelay ? 1f : 0f);
            if (!debugTimer)
            {
                MicrogameTimer.instance.disableDisplay = true;
            }
            if (debugTimerTick)
            {
                MicrogameTimer.instance.invokeTick();
            }

            victory           = defaultVictory;
            victoryDetermined = false;

            if (debugMusic && musicClip != null)
            {
                AudioSource source = debugObjects.transform.FindChild("Music").GetComponent <AudioSource>();
                source.clip  = musicClip;
                source.pitch = ScenarioController.getSpeedMult(debugSpeed);
                if (!debugSimulateDelay)
                {
                    source.Play();
                }
                else
                {
                    AudioHelper.playScheduled(source, ScenarioController.beatLength);
                }
            }

            Transform UICam = debugObjects.transform.FindChild("UI Camera");
            commandTransform = UICam.FindChild("Command");
            UICam.gameObject.SetActive(true);
            if (debugCommand)
            {
                commandTransform.gameObject.SetActive(true);
                commandTransform.FindChild("Text").GetComponent <TextMesh>().text = command;
            }

            if (controlScheme == ControlScheme.Mouse)
            {
                Cursor.visible = true;
            }
        }
        else
        {
            //Normal Start
            ScenarioController.instance.scenarioCamera.tag     = "Camera";
            Camera.main.GetComponent <AudioListener>().enabled = false;

            MicrogameTimer.instance.beatsLeft = ScenarioController.instance.getBeatsRemaining();
            MicrogameTimer.instance.gameObject.SetActive(true);

            ScenarioController.instance.microgameMusicSource.clip = musicClip;

            commandTransform = ScenarioController.instance.transform.FindChild("Command");

            ScenarioController.instance.resetVictory();
            ScenarioController.instance.invokeNextCycle();
        }
    }