コード例 #1
0
ファイル: HeightBar.cs プロジェクト: BuDDi/GEA
    void Update()
    {
        distanceToGround = lander.GetDistanceToGround();
        float currentVisibleHeight = scalings [currentScalingIndex] * maxVisibleHeight;

        if (distanceToGround > (currentVisibleHeight * 2 / 3) && currentScalingIndex < scalings.Length)
        {
            Debug.Log("currScalingIndex1: " + currentScalingIndex);
            currentScalingIndex++;
            Debug.Log("currScalingIndex2: " + currentScalingIndex);
            //currentScalingIndex %= scalings.Length;
        }
        else if (distanceToGround < (currentVisibleHeight * 1 / 3) && currentScalingIndex > 0)
        {
            Debug.Log("currScalingIndex3: " + currentScalingIndex);
            currentScalingIndex--;
            Debug.Log("currScalingIndex4: " + currentScalingIndex);
            currentScalingIndex %= scalings.Length;

            /*if(currentScalingIndex < 0) {
             *              currentScalingIndex = 0;
             *      }*/
        }
    }