Exemple #1
0
 private RunningStep GetFirstRunningStep(GameObject parent)
 {
     for (int stepIndex = 0; stepIndex < currentSteps.Count; ++stepIndex)
     {
         RunningStep runningStep = currentSteps[stepIndex];
         if (runningStep.parent == parent)
         {
             return(runningStep);
         }
     }
     return(new RunningStep());
 }
Exemple #2
0
    private void StepGood(RunningStep runningStep)
    {
        Game.data.health += HEALTH_GOOD;
        Game.data.misses++;
        Game.data.lastStep = StepValues.GOOD;

        SetMaterialColors(runningStep.markInstance, Game.GetStepColor(StepValues.GOOD));

        for (int characterIndex = 0; characterIndex < Game.data.characterCount; ++characterIndex)
        {
            Character character = Game.data.characters[characterIndex];
            character.StartDance();
        }
    }
Exemple #3
0
    private void StepMiss(RunningStep runningStep)
    {
        Game.data.health += HEALTH_MISS;
        Game.data.misses++;
        Game.data.lastStep = StepValues.MISS;

        SetMaterialColors(runningStep.markInstance, Game.GetStepColor(StepValues.MISS));

        LeanTween.scale(runningStep.markInstance, Vector3.zero, PERFECT_TIME_DELTA).setOnComplete(
            () =>
        {
            Destroy(runningStep.markInstance);
            currentSteps.Remove(runningStep);
        }
            );

        for (int characterIndex = 0; characterIndex < Game.data.characterCount; ++characterIndex)
        {
            Character character = Game.data.characters[characterIndex];
            character.StopDance();
        }
    }
Exemple #4
0
    private void Update()
    {
        playTime += Time.deltaTime;

        if (playingList != null && !songFinished)
        {
            nextStepTime += Time.deltaTime;
            Step  step      = playingList.steps[stepIndex];
            float startTime = step.startTime;
            if (nextStepTime > startTime)
            {
                nextStepTime -= startTime;
                Transform  componentTransform = componentList[(int)step.component].transform;
                GameObject markInstance       = null;
                Vector3    startPosition      = new Vector3(0, 4, 0);
                Vector3    endPosition        = Vector3.zero;

                //InteractButton interactButton = componentTransform.GetComponent<InteractButton>();
                //InteractSlider interactSlider = componentTransform.GetComponent<InteractSlider>();
                //InteractTurntable interactTurntable = componentTransform.GetComponent<InteractTurntable>();
                //if (interactButton != null) {
                //    markInstance = Instantiate(stepmarkButtonPrefab, componentTransform);
                //}
                //else if (interactSlider != null)
                //{
                //    markInstance = Instantiate(stepmarkSliderPrefab, componentTransform);
                //    startPosition += interactSlider.GetValueOffset(step.value);
                //    endPosition += interactSlider.GetValueOffset(step.value);
                //}
                //else if(interactTurntable != null)
                //{
                //    markInstance = Instantiate(stepmarTurntablePrefab, componentTransform);
                //    markInstance.transform.localScale = new Vector3(1, step.value, 1);
                //    startPosition += new Vector3(0, step.value, 0);
                //    endPosition += new Vector3(0, step.value, 0);
                //}
                //else
                //{
                //    markInstance = Instantiate(stepmarkPrefab, componentTransform);
                //}

                markInstance.transform.localPosition = startPosition;

                RunningStep runningStep = new RunningStep();
                runningStep.parent         = componentTransform.gameObject;
                runningStep.startTimestamp = playTime;
                runningStep.step           = step;
                runningStep.markInstance   = markInstance;
                currentSteps.Add(runningStep);

                //LeanTween.moveLocal(markInstance, endPosition, step.perfectTime).setOnComplete(
                //    () => {
                //        if (interactTurntable)
                //        {
                //            LeanTween.moveLocal(runningStep.markInstance, new Vector3(0, -step.value, 0), step.value).setOnComplete(
                //                () =>
                //                {
                //                    StepPerfect(runningStep);
                //                }
                //            );
                //        }
                //        else
                //        {
                //            LeanTween.scale(runningStep.markInstance, Vector3.zero, PERFECT_TIME_DELTA).setOnComplete(
                //                () =>
                //                {
                //                    if (interactButton != null)
                //                    {
                //                        StepMiss(runningStep);
                //                    }
                //                    else if (interactSlider != null)
                //                    {
                //                        float deltaValue = step.value - interactSlider.value;
                //                        if (Mathf.Abs(deltaValue) < PERFECT_VALUE_DELTA)
                //                        {
                //                            StepPerfect(runningStep);
                //                        }
                //                        else
                //                        {
                //                            StepMiss(runningStep);
                //                        }
                //                    }
                //                }
                //            );
                //        }
                //    }
                //);

                ++stepIndex;
                if (stepIndex == playingList.steps.Length)
                {
                    if (loopSteps)
                    {
                        stepIndex    = 0;
                        nextStepTime = 0;
                    }
                    else
                    {
                        songFinished = true;
                    }
                }
            }
        }
    }