Created
June 25, 2016 10:19
-
-
Save tetya/639e7f04ee257464a9526af9b2d55a1e 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; | |
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