85 lines
1.8 KiB
C#
85 lines
1.8 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
[RequireComponent(typeof(Animator))]
|
|
public class CameraAnimController : MonoBehaviour
|
|
{
|
|
public bool playAnim;
|
|
|
|
Animator anim;
|
|
|
|
public Button btnSkipAnim;
|
|
|
|
void Start()
|
|
{
|
|
anim = GetComponent<Animator>();
|
|
|
|
//if (Application.isEditor || playAnim)
|
|
//{
|
|
// AudioManager.Instance.PlayBg(0);
|
|
// if (anim.enabled)
|
|
// {
|
|
// OnEnterGame();
|
|
// }
|
|
//}
|
|
|
|
btnSkipAnim.onClick.AddListener(OnSkipAnimClick);
|
|
}
|
|
|
|
public void OnEnterGame()
|
|
{
|
|
if (anim != null && anim.enabled)
|
|
{
|
|
BaseController.IsAnimatorOnControl = true;
|
|
anim.SetTrigger("EnterGame");
|
|
}
|
|
else
|
|
{
|
|
OnEnterAnimPlayEnd();
|
|
}
|
|
}
|
|
|
|
|
|
public GameObject objHelp;
|
|
|
|
public void OnEnterAnimPlayEnd()
|
|
{
|
|
DestroyBtnSkipAnim();
|
|
anim.enabled = false;
|
|
BaseController.CanControl = true;
|
|
BaseController.IsAnimatorOnControl = false;
|
|
Invoke("LoadTexture", 0.5f);
|
|
}
|
|
|
|
private void LoadTexture()
|
|
{
|
|
TipPointCollider.Instance.ControllerStatusChanged();
|
|
}
|
|
|
|
public void OnSkipAnimClick()
|
|
{
|
|
Skip();
|
|
}
|
|
|
|
public void DestroyBtnSkipAnim()
|
|
{
|
|
if (btnSkipAnim != null && btnSkipAnim.gameObject != null)
|
|
Destroy(btnSkipAnim.gameObject);
|
|
}
|
|
|
|
void Skip()
|
|
{
|
|
if (anim.GetCurrentAnimatorClipInfo(0).Length > 0)
|
|
{
|
|
AnimationClip clip = anim.GetCurrentAnimatorClipInfo(0)[0].clip;
|
|
anim.Play(clip.name, 0, 1);
|
|
}
|
|
|
|
SceneLoader.Instance.SetCameraPosition(0);
|
|
CommonData.MainCamera.fieldOfView = 60;
|
|
|
|
OnEnterAnimPlayEnd();
|
|
}
|
|
} |