Example #1
0
    public static int ExperienceForLevel(int level)
    {
        float levelPercent = Mathf.Clamp01((float)(level - minLevel) / (float)(maxLevel - minLevel));

        return((int)EasingEquations.Linear(0, maxExperience, levelPercent));
        //利用函數來控制升級所需經驗值,我在這裡用線性
    }
Example #2
0
    // This returns the grand total number of accumulated experience required to reach a certain level
    public static int ExperienceForLevel(int level)
    {
        float levelPercent    = Mathf.Clamp01((float)(level - Consts.GAME_MIN_LEVEL) / (float)(Consts.GAME_MAX_LEVEL - Consts.GAME_MIN_LEVEL));
        int   totalExperience = (int)EasingEquations.EaseInQuad(0, Consts.GAME_MAX_TOTAL_EXP, levelPercent);

        return(totalExperience);
    }
Example #3
0
    IEnumerator Animate(float endAngle, bool skipAnimation = false)
    {
        isSpinning = true;

        float clock      = 0;
        float startAngle = (transform.eulerAngles.z);

        endAngle = endAngle + startAngle;

        if (skipAnimation)
        {
            transform.eulerAngles = new Vector3(0, 0, endAngle);
            isSpinning            = false;
            yield break;
        }


        // Tilt backwards
        while (clock < tiltBackDuration)
        {
            transform.Rotate(0, 0, tiltBackAmount);

            clock += Time.deltaTime;
            yield return(null);
        }

        // Main Rotation
        clock = 0;
        float angleBeforeDeceleration = endAngle;

        while (clock < rotationDuration)
        {
            float angle = EasingEquations.EaseOutCubic(startAngle, endAngle, clock / rotationDuration);
            transform.eulerAngles = new Vector3(0, 0, startAngle + angle);

            clock += Time.deltaTime;
            yield return(null);
        }

        transform.eulerAngles = new Vector3(0, 0, Item.ClampEulers(transform.eulerAngles.z));

        button.SetActive(false);
        // Show Results
        yield return(StartCoroutine(gm.results.ShowResults(items[dropIndex])));

        button.SetActive(true);
        // Enable spin again
        isSpinning = false;
    }
Example #4
0
    private IEnumerator OpenAnim_c(Transform targetTransform, Vector3 start, Vector3 end, float startScale, float endScale)
    {
        float duration   = 0.2f;
        float resolution = duration * 30f; //30 FPS

        float step = duration / resolution;

        for (int i = 1; i < resolution + 1; i++)
        {
            float x = EasingEquations.EaseOutCubic(start.x, end.x, i / resolution);
            float y = EasingEquations.EaseOutCubic(start.y, end.y, i / resolution);
            targetTransform.position = new Vector3(x, y, selectorMarkerZ);             //targetTransform.position.z);

            float scale = EasingEquations.EaseOutCubic(startScale, endScale, i / resolution);
            targetTransform.localScale = new Vector3(scale, scale, scale);

            yield return(new WaitForSeconds(step));
        }
    }
Example #5
0
    public IEnumerator ZoomCamera(int index)
    {
        _isZooming = true;
        float   elapsedTime = 0f;
        Vector3 pitchRot    = pitch.localRotation.eulerAngles;
        Vector3 newLift     = new Vector3(0, zoomPoints[index].y, 0);
        Vector3 newPitch    = new Vector3(zoomPoints[index].x, pitchRot.y, 0);
        float   startSize   = GetComponentInChildren <Camera>().orthographicSize;
        float   newSize     = zoomPoints[index].z;

        Tweener liftTweener  = heading.MoveToLocal(newLift, 0.3f, EasingEquations.EaseInQuad);
        Tweener pitchTweener = pitch.RotateToLocal(newPitch, 0.3f, EasingEquations.EaseInQuad);

        while ((pitchTweener != null || liftTweener != null) && elapsedTime < 0.3f)
        {
            GetComponentInChildren <Camera>().orthographicSize = EasingEquations.EaseInQuad(startSize, newSize, elapsedTime / 0.3f);
            elapsedTime += Time.deltaTime;
            yield return(null);
        }
        _isZooming = false;
    }
Example #6
0
    public static int ExperienceForLevel(int level)
    {
        float levelPercent = Mathf.Clamp01((float)(level - minLevel) / (float)(maxLevel - minLevel));

        return((int)EasingEquations.EaseInQuad(0, maxExperience, levelPercent));
    }
Example #7
0
    public static int ExperienceForLevel(int lvl)
    {
        var levelPercent = (float)(lvl - CharacterDetails.MIN_LEVEL) / (CharacterDetails.MAX_LEVEL - CharacterDetails.MIN_LEVEL);

        return((int)EasingEquations.EaseInQuad(0, CharacterDetails.MAX_EXPERIENCE, levelPercent));
    }
Example #8
0
        /// <summary>
        /// <para>Experiencia por nivel</para>
        /// </summary>
        /// <param name="level"></param>
        /// <returns></returns>
        public static int ExperienciaPorNivel(int level)        // Experiencia por nivel
        {
            float porcentajeNivel = Mathf.Clamp01((float)(level - minLevel) / (float)(maxLevel - minLevel));

            return((int)EasingEquations.EaseInQuad(0, maxExperiencia, porcentajeNivel));
        }