예제 #1
0
    // Use this for initialization
    void Start()
    {
        PlayerPrefs.SetInt("L1Notes", l1UpNotes.Length + l1LeftNotes.Length + l1RightNotes.Length);
        PlayerPrefs.SetInt("L2Notes", l1UpNotes.Length + l1LeftNotes.Length + l1RightNotes.Length);
        PlayerPrefs.SetInt("L3Notes", l1UpNotes.Length + l1LeftNotes.Length + l1RightNotes.Length);

        maxCombo  = -1;
        character = GameObject.Find("Character").GetComponent <Character>();

        healthBar     = GameObject.Find("HealthBar").GetComponent <Slider>();
        healthBarFill = GameObject.Find("HealthBarFill").GetComponent <Image>();

        comboText        = GameObject.Find("ComboBar").GetComponent <Text>();
        upNoteSpawner    = GameObject.Find("UpSpawner").GetComponent <NoteSpawner>();
        leftNoteSpawner  = GameObject.Find("LeftSpawner").GetComponent <NoteSpawner>();
        rightNoteSpawner = GameObject.Find("RightSpawner").GetComponent <NoteSpawner>();

        upRecord    = GameObject.Find("RecorderUp").GetComponent <Recorder>();
        leftRecord  = GameObject.Find("RecorderLeft").GetComponent <Recorder>();
        rightRecord = GameObject.Find("RecorderRight").GetComponent <Recorder>();

        music = GameObject.Find("Music").GetComponent <AudioSource>();

        secPerBeat  = 60f / bpm;
        dsptimesong = (float)AudioSettings.dspTime;
        Debug.Log("secPerBeat: " + secPerBeat);
        Debug.Log("dsptimesong: " + dsptimesong);
    }
예제 #2
0
    void Update()
    {
        // Only run update if there is an Audio Clip
        if (source.clip == null)
        {
            Debug.Log(" No clip to play");
            return;
        }

        runTime     += Time.deltaTime;
        songPosition = source.timeSamples / (float)source.clip.frequency;

        // Update the next beat time.
        while (songPosition > spawnTime && currentNoteIndex < beatmap.Notes.Count)
        {
            // Debug.Log("Spawn Time: " + spawnTime + ", Song Position " + songPosition + ", bIndex: " + currentNoteIndex + "/" + beatmap.Notes.Count);
            NoteSpawner.SpawnHitObject(beatmap.Notes[currentNoteIndex]);

            // Update Timings:
            currentNoteIndex++;
            if (currentNoteIndex < beatmap.Notes.Count)
            {
                nextBeatTime = GetNextBeatTime(beatmap.Notes[currentNoteIndex]);
                spawnTime    = nextBeatTime - SpawnTimeOffset;
            }
            // Debug.Log("Current Song Position: " + songPosition);
        }

        // Check to finish
        CheckIfFinished();

        // Debug.Log("Current Song Position: " + songPosition + ", Spawn Time: " + spawnTime);
    }
예제 #3
0
    public void OnSceneGUI()
    {
        if (ns == null)
        {
            ns = this.target as NoteSpawner;
        }

        Handles.color = Color.red;
        //Handles.CircleHandleCap(0, ns.noteHitPoint.transform.position, Quaternion.identity, ns.BadHitRange, EventType.Ignore);
        Handles.DrawWireDisc(ns.noteHitPoint.transform.position, ns.noteHitPoint.transform.forward, ns.BadHitRange);
        Handles.color = Color.yellow;
        Handles.DrawWireDisc(ns.noteHitPoint.transform.position, ns.noteHitPoint.transform.forward, ns.OkayHitRange);
        Handles.color = Color.green;
        Handles.DrawWireDisc(ns.noteHitPoint.transform.position, ns.noteHitPoint.transform.forward, ns.PerfectHitRange);

        if (Selection.activeGameObject == ns.gameObject)
        {
            EditorGUI.BeginChangeCheck();
            Vector3 newTargetPosition = Handles.PositionHandle(ns.noteHitPoint.transform.position, Quaternion.identity);
            if (EditorGUI.EndChangeCheck())
            {
                Undo.RecordObject(ns, "Change Position");
                ns.noteHitPosition = newTargetPosition;
                //ns.UpdateNoteHitPosition();
            }
        }
        else
        {
        }
    }
예제 #4
0
 void Start()
 {
     touchBar    = touchJudgement.GetComponent <BoxCollider2D>();
     touchEffect = touchEffectSpawner.GetComponent <TouchEffectSpawner>();
     note        = noteSpawner.GetComponent <NoteSpawner>();
     scene       = SceneManager.GetComponent <PlaySceneManager>();
 }
예제 #5
0
    //public Vector3 scrollDirection = Vector3.down;

    // Start is called before the first frame update
    void Start()
    {
        if (GameManager.instance != null)
        {
            if (GameManager.instance.selectedSong != null)
            {
                beatTempo = GameManager.instance.selectedSong.bpm;
            }
            else
            {
                NoteSpawner ns = GetComponent <NoteSpawner>();
                if (ns)
                {
                    if (ns.DEBUG_songInfo != null)
                    {
                        beatTempo = GetComponent <NoteSpawner>().DEBUG_songInfo.bpm;
                    }
                }
            }
        }
        else
        {
            NoteSpawner ns = GetComponent <NoteSpawner>();
            if (ns)
            {
                if (ns.DEBUG_songInfo != null)
                {
                    beatTempo = GetComponent <NoteSpawner>().DEBUG_songInfo.bpm;
                }
            }
        }
        scrollSpeed = beatTempo / 60f;
    }
예제 #6
0
 public void Init(Transform target, float beat, float noteSpeed, NoteSpawner ns, Conductor conductor)
 {
     transform.SetParent(target);
     targetBeat     = beat;
     this.noteSpeed = noteSpeed;
     this.ns        = ns;
     this.conductor = conductor;
 }
예제 #7
0
	// Use this for initialization
	void Start () {
		PS = GameObject.FindGameObjectWithTag ("Player").GetComponent<PlayerScript> ();
		ES = GameObject.FindGameObjectWithTag ("Enemy").GetComponent<EnemyScript> ();
		NS = GameObject.FindGameObjectWithTag ("Spawner").GetComponent<NoteSpawner> ();
		//NM = GameObject.FindGameObjectWithTag ("Note").GetComponent<NoteMovement> ();
		//MBM = GameObject.FindGameObjectWithTag ("MeasureBar").GetComponent<MeasureBarMovement> ();
		playerDamage.enabled = false;
		enemyDamage.enabled = false;
	}
예제 #8
0
    private void Awake()
    {
        m_Instance = this;

        m_NoteSpawner = GetComponent <NoteSpawner>();
        m_NoteChecker = GetComponent <NoteChecker>();
        m_SongManager = GetComponent <SongManager>();
        m_GameManager = GetComponent <GameManager>();
    }
예제 #9
0
        public void Start()
        {
            _noteSpawner  = GetComponent <NoteSpawner>();
            _scoreManager = GetComponent <ScoreManager>();
            _stateHolder  = FindObjectOfType <GameStateHolder>();

            if (_stateHolder.ChartFolder != null)
            {
                StartCoroutine(StartSong(_stateHolder.ChartFolder));
            }
        }
예제 #10
0
 //SpawnAllNote from G_sheetToPlay for Play
 void SpawnAllNote() {
     note.Clear();
     for (int i = 0; i < GlobalInfo.G_sheetToPlay.note.Count; i++) {
         note.Add(NoteSpawner.SpawnNote(notePrefab, GlobalInfo.G_sheetToPlay.note[i].enotePos, GlobalInfo.G_sheetToPlay.note[i].enoteType, GlobalInfo.G_sheetToPlay.note[i].noteTime, noteColor[(int)GlobalInfo.G_sheetToPlay.note[i].enotePos]));
         note[note.Count - 1].name = "note" + note.Count;
         note[note.Count - 1].transform.parent = spawnNoteParent.transform;
         note[note.Count - 1].GetComponent<PlayNote>().manager = this;
         note[note.Count - 1].GetComponent<MeshRenderer>().enabled = false;
         note[note.Count - 1].GetComponent<PlayNote>().noteTime = GlobalInfo.G_sheetToPlay.note[note.Count-1].noteTime;
         totalScore += GlobalInfo.G_basicNoteScore * (1+((i+1.0f) / GlobalInfo.G_sheetToPlay.note.Count)) * GlobalInfo.G_scoreBonus;
     }
 }
예제 #11
0
파일: Movement.cs 프로젝트: Quoclon/GGJ19
    // Start is called before the first frame update
    void Start()
    {
        spawnPos     = transform.position;
        noteSpawner  = GameObject.Find("Spawner").GetComponent <NoteSpawner>();
        swipeinput   = GetComponent <SwipeInput>();
        scoreManager = GameObject.Find("ScoreManager").GetComponent <ScoreManager>();


        NoteDeathTimer = 1000;
        isSwiped       = false;
        canSwipe       = false;
    }
예제 #12
0
    void Start()
    {
        ns = GameObject.FindObjectOfType<NoteSpawner>();
        juice = GameObject.FindObjectOfType<Juicificationator>();

        timeElapsed = 0;
        timePerBeat = 60 / GameProperties.BeatsPerMinute;
        timeTillNextBeat = timePerBeat;
        timeTillNextMeasure = timePerBeat * 4;		// 4/4 time signature, 4 beats per measure	timePerBeat = 60 / bpm;

        waveSequence = ClapWaveSequence.LoadSequenceFile(songName,timePerBeat);
    }
예제 #13
0
 void SpawnAllNote()
 {
     note.Clear();
     for (int i = 0; i < sheet.note.Count; i++)
     {
         note.Add(NoteSpawner.SpawnNote(spawnNotePrefab, sheet.note[i].enotePos, sheet.note[i].enoteType, sheet.note[i].noteTime, noteColor[(int)sheet.note[i].enotePos]));
         note[note.Count - 1].GetComponent <SpawnNote>().index = note.Count;
         note[note.Count - 1].name             = "note" + note.Count;
         note[note.Count - 1].transform.parent = spawnNoteParent.transform;
     }
     isSheetLoad = false;
 }
예제 #14
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else if (instance != this)
     {
         Destroy(this.gameObject);
         return;
     }
 }
예제 #15
0
    public void Reset()
    {
        f                = null;
        tMap             = null;
        notes            = null;
        chords           = null;
        spawner          = null;
        audioSource.clip = null;
        difficulty       = SongDifficulty.Easy;
        MidiName         = "";

        PlayingSongForLevel = false;
    }
예제 #16
0
 private void SceneManager_sceneLoaded(Scene arg0, LoadSceneMode arg1)
 {
     if (spawner == null)
     {
         if (FindObjectOfType <NoteSpawner>() != null)
         {
             spawner = FindObjectOfType <NoteSpawner>();
             InitialiseSong();
             PlayingSongForLevel = true;
         }
         else
         {
             PlayingSongForLevel = false;
         }
     }
 }
예제 #17
0
    // Use this for initialization
    void Start()
    {
        PlayerPrefs.SetInt("L1Notes", l1UpNotesList.Length + l1LeftNotesList.Length + l1RightNotesList.Length);
        PlayerPrefs.SetInt("L2Notes", l2UpNotesList.Length + l2LeftNotesList.Length + l2RightNotesList.Length);
        PlayerPrefs.SetInt("L3Notes", l3UpNotesList.Length + l3LeftNotesList.Length + l3RightNotesList.Length);
        PlayerPrefs.SetString("CurrentScene", SceneManager.GetActiveScene().name);

        maxCombo  = -1;
        character = GameObject.Find("Character").GetComponent <Character>();

        healthBar     = GameObject.Find("HealthBar").GetComponent <Slider>();
        healthText    = GameObject.Find("HealthText").GetComponent <Text>();
        healthBarFill = GameObject.Find("HealthBarFill").GetComponent <Image>();

        comboText        = GameObject.Find("ComboBar").GetComponent <Text>();
        comboAnimator    = GameObject.Find("ComboBar").GetComponent <Animator>();
        upNoteSpawner    = GameObject.Find("UpSpawner").GetComponent <NoteSpawner>();
        leftNoteSpawner  = GameObject.Find("LeftSpawner").GetComponent <NoteSpawner>();
        rightNoteSpawner = GameObject.Find("RightSpawner").GetComponent <NoteSpawner>();

        upRecord    = GameObject.Find("RecorderUp").GetComponent <Recorder>();
        leftRecord  = GameObject.Find("RecorderLeft").GetComponent <Recorder>();
        rightRecord = GameObject.Find("RecorderRight").GetComponent <Recorder>();

        music = GameObject.Find("Music").GetComponent <AudioSource>();

        secPerBeat  = 60f / bpm;
        dsptimesong = (float)AudioSettings.dspTime;
        Debug.Log("secPerBeat: " + secPerBeat);
        Debug.Log("dsptimesong: " + dsptimesong);

        upNextIndex    = 0;
        leftNextIndex  = 0;
        rightNextIndex = 0;
        maxCombo       = 0;
    }
예제 #18
0
 // Use this for initialization
 void Start()
 {
     Screen.lockCursor = true;
     noteSpawner       = gameObject.GetComponent <NoteSpawner>();
 }
예제 #19
0
    // Update is called once per frame
    void Update()
    {
        time                 += Time.deltaTime;
        noteSpawner.time      = this.time;
        noteSpawner.musMap    = this.map;
        noteSpawner.musMapLoc = this.mapLoc;

        if (Input.GetMouseButtonDown(0) || Input.GetKeyDown(KeyCode.Z) || Input.GetKeyDown(KeyCode.X))
        //mwclick addnote
        {
            if (firstInput == -1)
            {
                firstInput = time + NoteSpawner.GetGlobalSyncOffset();
            }
            float guidedTime;
            //bpm 기준으로 1/4 박자 시간 계산
            float smallBeat = 1 / (bpm / 60f * 4f);//최소 초당 비트크기의 1/4
            float modv      = (time + NoteSpawner.GetGlobalSyncOffset() - firstInput) % smallBeat;
            float divv      = (time + NoteSpawner.GetGlobalSyncOffset() - firstInput) / smallBeat;
            if (modv > 0.5f)
            {
                //올림적용
                guidedTime = smallBeat * (divv - modv + 1) + firstInput;
            }
            else
            {
                //내림 적용
                guidedTime = smallBeat * (divv) + firstInput;
            }
            map.Insert(noteSpawner.mapIndex, guidedTime);
            Vector3 mouse2DPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            float   angle      = CalculateAngle(Vector3.zero, mouse2DPos);
            float   guideAngle = Mathf.Round(angle * 10) / 10;
            mapLoc.Insert(noteSpawner.mapIndex, guideAngle);
            noteSpawner.mapIndex++;
            noteSpawner.SpawnNoteAngleWithTime(angle, 1.8f);//1.8=perfect delta
            print(guidedTime);
            print(time + NoteSpawner.GetGlobalSyncOffset());
        }
        if (Input.GetMouseButtonDown(2))
        {
            //mwrightclick removenote
        }
        if (Input.GetMouseButtonDown(1))
        //mwhell export
        {
            string result = "";
            for (int i = 0; i < map.Count; i++)
            {
                if (i == map.Count - 1)
                {
                    result += map[i].ToString();
                }
                else
                {
                    result += map[i].ToString() + ",";
                }
            }
            result += "A";
            for (int i = 0; i < mapLoc.Count; i++)
            {
                if (i == mapLoc.Count - 1)
                {
                    result += mapLoc[i].ToString();
                }
                else
                {
                    result += mapLoc[i].ToString() + ",";
                }
            }
            print(result);
        }
    }
예제 #20
0
 // Start is called before the first frame update
 void Start()
 {
     noteSpawner = this;
 }
예제 #21
0
	// Use this for initialization
	void Start () {
		NM = GameObject.FindGameObjectWithTag("NoteManager").GetComponent<NoteManager>();
		NS = GameObject.FindGameObjectWithTag("Spawner").GetComponent<NoteSpawner>();
		this.gameObject.transform.position = new Vector3(transform.position.x, 0, transform.position.z);
	}