Created
April 24, 2018 09:57
-
-
Save todorok1/5fe1e84e9fe24a32ade51b8a3ed9ba02 to your computer and use it in GitHub Desktop.
Unityチュートリアル・角度に合わせて矢印を動かすスクリプト。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void ChangeForceAngle(){ | |
// 角度の増分が0なら、以降の処理を行わない | |
if (angleDelta == 0){ | |
return; | |
} | |
// forceAngleに角度の増分をfloat型として加算 | |
forceAngle += angleDelta * 1.0f; | |
if (angleDelta == AngleIncreasing){ | |
// forceAngleが最大値を超えた場合には最大値をセット | |
if (forceAngle >= MaxAngle){ | |
forceAngle = MaxAngle; | |
} | |
} else if(angleDelta == AngleDecreasing){ | |
// forceAngleが最小値より小さい場合には最小値をセット | |
if (forceAngle <= MinAngle){ | |
forceAngle = MinAngle; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment