123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using VertexAnimationTools_30;
- public class QHCControl : MonoBehaviour
- {
- public SCButton m_Button;
- public GameObject ShowObj;
- public GameObject BrockObj;
- MeshSequencePlayer mesh_script;
- private bool m_IsPoSui;
- private float m_Time;
- private void OnEnable()
- {
- m_IsPoSui = false;
- m_Time = 0;
- }
- void Start()
- {
- mesh_script = BrockObj.GetComponent<MeshSequencePlayer>();
- BrockObj.SetActive(false);
- m_Button.onDown.AddListener(OnButtonDown);
- }
- private void OnButtonDown()
- {
- ChinaOnDown();
- }
- // Update is called once per frame
- void Update()
- {
- if (m_IsPoSui)
- {
- m_Time += Time.deltaTime;
- if (m_Time >= 5f)
- {
- ResetChinaPlayer();
- }
- }
- }
- //青花瓷触碰 青花瓷破碎
- public void ChinaOnDown()
- {
- ShowObj.SetActive(false);
- BrockObj.SetActive(true);
- mesh_script.PlaybackMode = AutoPlaybackTypeEnum.Once;
- m_IsPoSui = true;
- }
- //重置青花瓷破碎效果
- private void ResetChinaPlayer()
- {
- ShowObj.SetActive(true);
- BrockObj.SetActive(false);
- mesh_script.PlaybackMode = AutoPlaybackTypeEnum.None;
- mesh_script.NormalizedTime = 0;
- m_Time = 0;
- m_IsPoSui = false;
- }
- private void OnDisable()
- {
- ResetChinaPlayer();
- }
- }
|