Created
July 5, 2021 06:31
-
-
Save cacapon/92f0349855ff92adae3f6d910c7ee736 to your computer and use it in GitHub Desktop.
アニメーション用に作成した本のスクリプト例。実際にゲームでアタッチしているスクリプトからアニメーション部分だけピックアップし改修しました。
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
using UnityEngine; | |
public class BookObject: MonoBehaviour | |
{ | |
[SerializeField] | |
private Animator PageTurn; | |
public void BookPrev() | |
{ | |
PageTurn.SetTrigger("BookPrev"); | |
} | |
public void BookNext() | |
{ | |
PageTurn.SetTrigger("BookNext"); | |
} | |
private void OnAnimatorMove() | |
{ | |
// 動作中にトリガーをリセットしておいて、すぐに新しい動作を受け入れるようにしています。 | |
PageTurn.ResetTrigger("BookNext"); | |
PageTurn.ResetTrigger("BookPrev"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment