Beispiel #1
0
    void Start()
    {
        SongStarted = false;
        SS          = FindObjectOfType <SongSelect>();
        song        = SS.Selectedsong;

        hit1           = GameObject.FindGameObjectWithTag("p1");
        hit2           = GameObject.FindGameObjectWithTag("p2");
        hit3           = GameObject.FindGameObjectWithTag("p3");
        SpritePosition = GameObject.FindGameObjectWithTag("Sprite");

        rhythmtool = GetComponent <RhythmTool>();
        REP        = GetComponent <RhythmEventProvider>();

        rhythmtool.NewSong(song);
        rhythmtool.SongLoaded += OnSongLoaded;

        REP.onSubBeat.AddListener(OnSubBeat);

        combo = 0;
        score = 0;

        LHeld = false;
        MHeld = false;
        RHeld = false;

        TotalFrames = rhythmtool.totalFrames;
    }
    // Use this for initialization
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        // Getting RhythmTool needed components
        rTool                  = GetComponent <RhythmTool>();
        audioClip              = GetComponent <AudioSource>().clip;
        rTool.audioClip        = audioClip;
        rTool.SongLoaded      += OnSongLoaded;
        eventProvider.SubBeat += onSubBeat;

        player = playerObject.GetComponent <Player>();

        DontDestroyOnLoad(gameObject);
        enemies          = new List <Enemy>();
        boardScripts     = GetComponent <BoardManager>();
        boardBossScripts = GetComponent <BoardManagerBoss>();
        InitGame();
    }
Beispiel #3
0
    void Start()
    {
        //grab the audio source and the audio analysis tool
        source = this.gameObject.GetComponent <AudioSource>();
        tool   = this.gameObject.GetComponent <RhythmTool>();

        //check to see if the game has been restarted or not
        if (Retry.hasBeenRestarted)
        {
            //if so, reset the path to file
            path = Retry.oldPath;
            Retry.hasBeenRestarted = false;
        }
        else
        {
            path = StartGame.path;
        }

        //get the file extention
        fileExt = Path.GetFileName(path);

        //create the file path
        file = "file://" + path;

        StartCoroutine(LoadAudio());
    }
Beispiel #4
0
    // Use this for initialization
    void Start()
    {
        rhythmTool = GetComponent <RhythmTool>();
        audioClip  = GetComponent <AudioSource>().clip;

        rhythmTool.NewSong(audioClip);
    }
Beispiel #5
0
    private void Start()
    {
        //grab the audio analysis tool
        tool = GameObject.Find("AudioHandler").GetComponent <RhythmTool>();
        new WaitForSecondsRealtime(3);

        //start endGame coroutine
        StartCoroutine(endGame());
    }
Beispiel #6
0
    void SetUpRhythmTool()
    {
        rhythmTool = GetComponent <RhythmTool>();

        //Give it a song.
        rhythmTool.NewSong(audioClip);

        //Subscribe to SongLoaded event.
        rhythmTool.SongLoaded += OnSongLoaded;
    }
Beispiel #7
0
    // Start is called before the first frame update
    void Start()
    {
        //grab the audio analysis tool
        tool = GameObject.Find("AudioHandler").GetComponent <RhythmTool>();

        //initalize the colors that can be changed
        colors = new Color[] { Color.white, Color.blue, Color.cyan, Color.green, Color.magenta.gamma, Color.red, Color.yellow, Color.gray };

        //wait for 2 seconds
        StartCoroutine(Wait());
    }
Beispiel #8
0
    void Start()
    {
        rhythmtool = GetComponent <RhythmTool>();
        events     = GetComponent <RhythmEventProvider>();
        wspawn     = FindObjectOfType <Weapon>();


        rhythmtool.NewSong(Theme);
        rhythmtool.SongLoaded += OnSongLoaded;

        events.onSubBeat.AddListener(OnSubBeat);
    }
Beispiel #9
0
    // Start is called before the first frame update
    void Start()
    {
        //push the enemy out to the left to start it's movement
        this.GetComponent <Rigidbody>().AddForce(new Vector2(-5, 0), ForceMode.Impulse);

        //grab the audio analysis tool
        tool = GameObject.Find("AudioHandler").GetComponent <RhythmTool>();

        //grab the game mangaer
        manager = GameObject.Find("GameHandler").GetComponent <GameManager>();

        //set the movement speed to the bpm
        speed = tool.bpm;
    }
Beispiel #10
0
    void Start()
    {
        //s = transform.Find("spawn").GetComponent<spawn> ();
        backAmount = StartVar.nback;            //get nback amount from the global start values
        print(backAmount);

        rhythmTool = GetComponent <RhythmTool>();      //get the rhythm tool

        rhythmTool.NewSong(audioClip);                 //set song for the rhythm tool to play

        low         = rhythmTool.Low.Frames;
        nbacktrack  = new int[backAmount + 1];          //create nback list
        missReserve = new int[backAmount - 1];          //create reserve list
        //GetComponent<reachscaler>().enabled = true;
        //Instantiate (startball, new Vector3 (((float)0.08), ((float)2.05), ((float)-0.23)), Quaternion.identity);
    }
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        RhythmTool rhythmTool = (RhythmTool)target;

        EditorGUILayout.LabelField("Total frames:", rhythmTool.totalFrames.ToString());
        EditorGUILayout.LabelField("Last Frame:", rhythmTool.lastFrame.ToString());
        EditorGUILayout.LabelField("Current Frame:", rhythmTool.currentFrame.ToString());
        EditorGUILayout.Separator();

        EditorGUILayout.LabelField("BPM:", rhythmTool.bpm.ToString());
        EditorGUILayout.LabelField("Beat Length:", rhythmTool.beatLength.ToString() + " frames");
        EditorGUILayout.Separator();

        //Note: Uncomment and make _audioClip field serializable for editor support
        //EditorGUI.BeginChangeCheck();
        //SerializedProperty audioClip = serializedObject.FindProperty("_audioClip");
        //EditorGUILayout.PropertyField(audioClip);
        //if (EditorGUI.EndChangeCheck())
        //    rhythmTool.audioClip = (AudioClip)audioClip.objectReferenceValue;
        //EditorGUILayout.Separator();

        SerializedProperty _trackBeat = serializedObject.FindProperty("_trackBeat");

        EditorGUILayout.PropertyField(_trackBeat);

        SerializedProperty _preAnalyze = serializedObject.FindProperty("_preAnalyze");

        EditorGUILayout.PropertyField(_preAnalyze);

        if (_preAnalyze.boolValue)
        {
            SerializedProperty _cacheAnalysis = serializedObject.FindProperty("_cacheAnalysis");
            EditorGUILayout.PropertyField(_cacheAnalysis);
        }
        else
        {
            SerializedProperty _lead = serializedObject.FindProperty("_lead");
            EditorGUILayout.IntSlider(_lead, 1, 1800);
        }

        serializedObject.ApplyModifiedProperties();
        EditorUtility.SetDirty(target);
    }
Beispiel #12
0
    public override void OnInspectorGUI()
    {
        RhythmTool myTarget = (RhythmTool)target;

        EditorGUILayout.LabelField("Total frames:", myTarget.totalFrames.ToString());
        EditorGUILayout.LabelField("Last Frame:", myTarget.lastFrame.ToString());
        EditorGUILayout.LabelField("Current Frame:", myTarget.currentFrame.ToString());
        EditorGUILayout.Separator();

        EditorGUILayout.LabelField("BPM:", myTarget.bpm.ToString());
        EditorGUILayout.LabelField("Beat Length:", myTarget.beatLength.ToString() + " frames");
        EditorGUILayout.Separator();

        EditorGUI.BeginDisabledGroup(Application.isPlaying);

        SerializedProperty calculateTempo = serializedObject.FindProperty("_calculateTempo");

        EditorGUILayout.PropertyField(calculateTempo);

        SerializedProperty preCalculate = serializedObject.FindProperty("_preCalculate");

        EditorGUILayout.PropertyField(preCalculate);

        if (preCalculate.boolValue)
        {
            SerializedProperty storeAnalyses = serializedObject.FindProperty("_storeAnalyses");
            EditorGUILayout.PropertyField(storeAnalyses);
        }

        EditorGUI.EndDisabledGroup();

        if (!preCalculate.boolValue)
        {
            SerializedProperty lead = serializedObject.FindProperty("_lead");
            EditorGUILayout.IntSlider(lead, 300, 10000);
        }

        serializedObject.ApplyModifiedProperties();
        serializedObject.Update();
    }
Beispiel #13
0
 // Start is called before the first frame update
 void Start()
 {
     tool   = GameObject.Find("AudioHandler").GetComponent <RhythmTool>();
     rand   = new System.Random();
     health = GameObject.Find("Player").GetComponent <HealthManager>();
 }