void Update() { switch (currentState) { case State.Floating: DoFloating(); break; case State.TouchingBegin: DoTouchingBegin(); break; case State.Touching: DoTouching(); break; } if (currentState == State.Touched) { currentState = State.Floating; Vector3 worldPosition = GetLastWorldPosition(); if (EnablePlayOnComplete) { PlayParticleAt(worldPosition); } if (onTouchComplete != null) { TouchCompleteArg arg = new TouchCompleteArg(worldPosition, Time.realtimeSinceStartup); onTouchComplete(this, arg); } } }
void DoTouchingBegin() { Debug.Assert(currentState == State.TouchingBegin); currentState = State.Touching; if (onTouchBegin != null) { TouchCompleteArg arg = new TouchCompleteArg(GetFirstWorldPosition(), Time.realtimeSinceStartup); onTouchBegin(this, arg); } }
void OnTouchComplete(object o, TouchCompleteArg arg) { currentState = State.Scoring; TouchInterface t = (TouchInterface)o; score = Time.time - score; Vector3 point = phrase.transform.position; point.z = phrase.Z; recognitionTime.TextTo(score.ToString(), point); IncrementProgress(); t.PauseParticle(); }
void OnTouchBegin(object o, TouchCompleteArg arg) { currentState = State.Preparing; TouchInterface t = (TouchInterface)o; Vector3 pos = arg.Position; pos.x = pos.x + MagicTuneValue; currentChar = GetNextChar(); phrase.TextTo(GetNextPhrase(), pos); ScoreThePhraseExpectTime(); pos.y = pos.y + MagicTuneValue; t.PlayParticleAt(pos); }