Ejemplo n.º 1
0
		// Use this for initialization
		void Start () {
            BattleController._instance = this;
			stat = new Stat ();
			stat.Reset ();
            _LevelGenerator(song);
		}
Ejemplo n.º 2
0
        public void Hit(BattleController.InputData touch)
		{
            //Debug.Log("click start @ beat: " + BattleController.GetInstance().currBeat.ToString());
            float beatDiff = 100;
            Note selectedNote = null;
            //Debug.Log("_comingNotes.Count: " + _comingNotes.Count.ToString());
            for (int i = 0; i < _comingNotes.Count; i++)
            {
                //Debug.Log(i.ToString() + ": " + _comingNotes[i].notedata.beat.ToString());
				if(touch.state == BattleController.InputState.Down) {
	                if (Mathf.Abs(BattleController.GetInstance().currBeat - _comingNotes[i].notedata.beat) < beatDiff)
	                {
	                    beatDiff = Mathf.Abs(BattleController.GetInstance().currBeat - _comingNotes[i].notedata.beat);
	                    selectedNote = _comingNotes[i];
	                }
	                else
	                {
	                    break;
	                }
				} else {
					if(_comingNotes[i].notedata.duration > 0 && BattleController.GetInstance().currBeat - _comingNotes[i].notedata.beat < _comingNotes[i].notedata.duration ) {
						selectedNote = _comingNotes[i];
						break;
					}
				}
            }
            //Debug.Log("Selected note:" + (selectedNote == null ? "NULL" : selectedNote.notedata.beat.ToString()));

			if (selectedNote != null && beatDiff < 1f / 2f && touch.state == BattleController.InputState.Down)
            {
                if (beatDiff < 1f / 8f)
                {
                    // perfect
					BattleController.GetInstance().NoteAccuracyProcessor(Accuracy.Perfect, (selectedNote.notedata.duration > 0?"hold":"single"));
					if(selectedNote.notedata.duration > 0) {
						selectedNote.isLongNotePressed = true;
						selectedNote.longNoteFirstAcc = Accuracy.Perfect;
					}
                }
                else if (beatDiff < 1f / 4f)
                {
                    // great
					BattleController.GetInstance().NoteAccuracyProcessor(Accuracy.Great, (selectedNote.notedata.duration > 0?"hold":"single"));
					if(selectedNote.notedata.duration > 0) {
						selectedNote.isLongNotePressed = true;
						selectedNote.longNoteFirstAcc = Accuracy.Good;
					}
                }
                else
                {
                    // bad
					BattleController.GetInstance().NoteAccuracyProcessor(Accuracy.Good, (selectedNote.notedata.duration > 0?"hold":"single"));
                }

                if (selectedNote.notedata.duration == 0)
                {
                    _comingNotes.Remove(selectedNote);
                    NotePool.GetInstance().Return(selectedNote);
                }
            }
			else if (selectedNote != null && touch.state == BattleController.InputState.Hold) {
				if(BattleController.GetInstance().currBeat - selectedNote.notedata.beat - selectedNote.scoredDuration > 0.25f) {
					BattleController.GetInstance().NoteAccuracyProcessor(selectedNote.longNoteFirstAcc, "hold");
					selectedNote.scoredDuration += 0.25f;
				}
			}
            else
            {
                // out of range, no need to care it
            }

			if (touch.state == BattleController.InputState.Down && slideNoteStart != null) {
				// it is a slide start, pass the touch to slide note
				slideNoteStart.fingerId = touch.inputId;
				slideNoteStart.slidingNote.TouchStart(slideNoteStart);
			}

			if (touch.state == BattleController.InputState.Up && slideNoteEnd != null) {
				// it is a slide end, pass the touch to slide note
				slideNoteEnd.fingerId = touch.inputId;
				slideNoteEnd.slidingNote.TouchEnd(slideNoteEnd);
			}
        }
Ejemplo n.º 3
0
		public void Touching(BattleController.InputData touch) {
			if (_isHolding && touch.inputId == _holdingFingerId) {
				_isStillHolding = true;
			}
		}