Skip to content

Instantly share code, notes, and snippets.

@tetya
Created June 25, 2016 10:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tetya/639e7f04ee257464a9526af9b2d55a1e to your computer and use it in GitHub Desktop.
Save tetya/639e7f04ee257464a9526af9b2d55a1e to your computer and use it in GitHub Desktop.
using UnityEngine;
using System.Collections;
public class MunuAnimationManager : MonoBehaviour {
[SerializeField] private GameObject helpButton;
private Animator animator;
private bool isClosed = true;
void Start(){
animator = GetComponent<Animator> ();
}
public void ClickMuenuButton(){
if (isClosed) {
animator.SetTrigger ("Open");
animator.ResetTrigger ("Close");
isClosed = false;
//ヘルプボタンの描画順をメニューの裏に変更
int myIndex = transform.GetSiblingIndex();
helpButton.transform.SetSiblingIndex (myIndex - 1);
} else {
animator.SetTrigger ("Close");
animator.ResetTrigger ("Open");
isClosed = true;
//ヘルプボタンの描画順を最後(表示の一番上)に戻す
helpButton.transform.SetAsLastSibling();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment