示例#1
0
    void Awake()
    {
        noteObjectList = new List <NoteObject>();

        camera = Camera.main;

        audio         = GetComponent <AudioSource>();
        lowPassFilter = GetComponent <AudioLowPassFilter>();

        Transform beatDetectorObject = transform.GetChild(0);

        if (RuntimeData.useCustomMusic)
        {
            beatDetector   = beatDetectorObject.GetComponent <BeatDetection>();
            detectionAudio = beatDetectorObject.GetComponent <AudioSource>();
        }
        else
        {
            beatDetectorObject.gameObject.SetActive(false);
        }

        //noteSpawnPosYMultiplier = Mathf.Tan(camera.fieldOfView / 2 * Mathf.Deg2Rad) * defaultNoteSpawnDistance;
        //noteSpawnPosXMultiplier = noteSpawnPosYMultiplier * camera.aspect;

        noteDestroyDistance = missDistance;

        noteSpawnPosXMultiplier = defaultNoteSpawnDistance / -camera.transform.position.z * noteSpawnDispersion;
        //noteSpawnPosYMultiplier = defaultNoteSpawnDistance / -noteDestroyDistance * noteSpawnDispersion;

        noteSpawnAdvanceTime = defaultNoteSpawnDistance / defaultNoteSpeed;
    }
示例#2
0
    void Start()
    {
        beatDetection = GameObject.FindGameObjectWithTag("SoundController").GetComponent <BeatDetection>();

        beater = GetComponents <IBeatObject>();

        beatDetection.CallBackFunction += OnBeatDetected;
    }
    void Start()
    {
        EventManager.StartListening("Pause", PauseSong);
        EventManager.StartListening("Resume", ResumeSong);

        _beatManager = GetComponent <BeatDetection>();
        StartCoroutine(LaunchSong());
    }
示例#4
0
    void Awake()
    {
        beatDetection = KeepAlive.instance.GetComponent <BeatDetection>();
        textSync      = new List <MusicTextSync>();
        hueSync       = new List <MusicHueSync>();
        pressStart.SetActive(true);
        instance = this;
        score    = winningScore / 2f;
        players  = new List <PlayerController>();

        beatDetection.CallBackFunction = MyCallbackEventHandler;
    }
    void ToggleBeatDect()
    {
        BeatDetection obj = GetComponent <BeatDetection>();

        if (BeatTog.isOn)
        {
            obj.enabled = true;
        }
        else
        {
            obj.enabled = false;
        }
    }
示例#6
0
    private int minFreq, maxFreq; 						//Max and min frequencies window

    public void MyCallbackEventHandler(BeatDetection.EventInfo eventInfo)
    {
        switch (eventInfo.messageInfo)
        {
            case BeatDetection.EventType.Energy:
                StartCoroutine(showText(energy, genergy));
                break;
            case BeatDetection.EventType.HitHat:
                StartCoroutine(showText(hithat, ghithat));
                break;
            case BeatDetection.EventType.Kick:
                StartCoroutine(showText(kick, gkick));
                break;
            case BeatDetection.EventType.Snare:
                StartCoroutine(showText(snare, gsnare));
                break;
        }
    }
示例#7
0
 public EventInformation(EventType _type, BeatDetection _detection)
 {
     this.messageInfo = _type;
     this.sender      = _detection;
 }
示例#8
0
 void Start()
 {
     beatDetection = GameObject.FindGameObjectWithTag("BeatDetector").GetComponent <BeatDetection>();
     frameRate     = (60f / beatDetection.bpm) / frameCount;
 }
 private void Start()
 {
     Cursor.SetCursor(cursorTextureArray[0], new Vector2(16, 16), CursorMode.Auto);
     beatDetection = GameObject.FindGameObjectWithTag("BeatDetector").GetComponent <BeatDetection>();
     frameRate     = (60f / beatDetection.bpm) / frameCount;
 }