Example #1
0
    // Use this for initialization
    void OnEnable()
    {
        GameObject bmGO = GameObject.FindWithTag("Music");

        m_pBeatMaster = bmGO.GetComponent <BeatMaster>();
        m_fSpeed      = m_pBeatMaster.getDiscoPeteSpeedDependingOnMusic();

        GameObject gmGO = GameObject.FindWithTag("GridMaster");

        m_pGridMaster = gmGO.GetComponent <GridMaster>();
        m_pGridMaster.SetDiscoPeteToStart();

        m_pBeatMaster.beatEvent += BeatMasterOnBeatEvent;
        m_pBeatMaster.onJumpChancePassedEvent += BeatMasterOnJumpChancePassedEvent;

        m_pAnimator = GetComponent <Animator>();
        m_pAnimator.SetFloat(JUMP_DURATION, m_fSpeed);
        m_pAnimator.SetFloat(SPEED, m_pBeatMaster.songInfo.Bps);

        GameObject lapGO = GameObject.FindWithTag("LevelAndPointMaster");

        m_pLevelAndPointMaster = lapGO.GetComponent <LevelAndPointBehaviour>();

        if (m_pLevelAndPointMaster == null)
        {
            Debug.Log("DiscoPeteBehaviour: LevelAndPointMaster not found!");
        }
    }
Example #2
0
        protected virtual void OnEnable()
        {
            GameObject bmGO = GameObject.FindWithTag("Music");

            beatMaster = bmGO.GetComponent <BeatMaster>();

            beatMaster.beatEvent += OnBeat;
        }
Example #3
0
    private void Awake()
    {
        if (Instance != null)
        {
            Destroy(Instance);
        }
        Instance = this;

        beatMaster  = beatMaster ?? FindObjectOfType <BeatMaster>();
        audioSource = GetComponent <AudioSource>();
    }
Example #4
0
    private void Awake()
    {
        if (instance != null)
        {
            Debug.LogWarning("BeatMaster instantiat de doua ori");
            Destroy(gameObject);
        }
        m_ObserverList = new List <IBeat>();
        instance       = gameObject.GetComponent <BeatMaster>();
        m_Audio        = GetComponent <AudioSource>();
        ReadBeat beatReader = new ReadBeat();

        m_BeatsList = beatReader.GetBeatList();

        m_BeatParity = BEAT_PARITY.Even;
    }
Example #5
0
    void Start()
    {
        m_SoundManager = Instantiate(m_SoundManager);
        m_Library      = Instantiate(m_Library);
        m_BeatMaster   = Instantiate(m_BeatMaster);
        m_Map          = Instantiate(m_Map);
        m_Player       = Instantiate(m_Player);
        m_Camera       = Instantiate(m_Camera);

        m_Camera.SetPlayerReference(m_Player);
        m_Map.SetPlayerReference(m_Player);
        m_Player.Equip("dagger");

        foreach (MonoBehaviour test in m_Tests)
        {
            Instantiate(test);
        }
    }
Example #6
0
	// Use this for initialization
	void Start () {
		if(Global.audioClip != null) {
			audioClip = Global.audioClip;
		} else {
			Global.audioClip = audioClip;
		}
		beatCount = new int[numberOfBands];
		sampleSizeForFFT = (int)Mathf.Pow (2f, (float)sampleSizeFactorOf2);
		beatMaster = beatMasterGameObject.GetComponent<BeatMaster> ();
		beatMaster.audioFrequency = audioClip.frequency;
		beatMaster.sampleSize = sampleSizeForFFT;
		beatMaster.sampleRate = sampleSizeForFFT / audioClip.frequency;
		//Camera.main.transform.position = new Vector3 (2f * numberOfBands, 2.5f * numberOfBands, -2f);
		//Debug.Log (audioClip.samples);
		//Debug.Log (audioClip.channels);
		//Debug.Log (audioClip.frequency);
		DoManyIterations (audioClip.samples/sampleSizeForFFT, sampleSizeForFFT, true);
		// StartCoroutine (DoManyIterations (100, sampleSizeForFFT, false));
	}
    private void ItlFindObjects()
    {
        Debug.Log("LevelAndPointBehaviour::ItlFindObjects");

        GameObject guiGO = GameObject.FindWithTag("GUIMaster");

        m_pGUIMaster = guiGO.GetComponent <GUIMaster>();
        m_pGUIMaster.HideText();

        GameObject dpGO = GameObject.FindWithTag("DiscoPete");

        m_pDiscoPete = dpGO.GetComponent <DiscoPeteBehaviour>();

        GameObject gmGO = GameObject.FindWithTag("GridMaster");

        m_pGridMaster = gmGO.GetComponent <GridMaster>();

        GameObject bmGO = GameObject.FindWithTag("Music");

        m_pBeatMaster            = bmGO.GetComponent <BeatMaster>();
        m_pBeatMaster.beatEvent += OnBeat;

        if (m_pGUIMaster == null)
        {
            Debug.Log("LevelAndPointBehaviour: GUIMaster not found");
        }

        if (m_pDiscoPete == null)
        {
            Debug.Log("LevelAndPointBehaviour: DiscoPeteBehaviour not found");
        }

        if (m_pGridMaster == null)
        {
            Debug.Log("LevelAndPointBehaviour: GridMaster not found");
        }

        if (m_pBeatMaster == null)
        {
            Debug.Log("LevelAndPointBehaviour: BeatMaster not found");
        }
    }