Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Unityチュートリアル・角度に合わせて矢印を動かすスクリプト。
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
You can’t perform that action at this time.