70 lines
2.2 KiB
C#
70 lines
2.2 KiB
C#
using HighlightPlus;
|
|
using UnityEngine;
|
|
using UnityEngine.Playables;
|
|
|
|
public class RayClliderManager : MonoBehaviour
|
|
{
|
|
public static RayClliderManager instance;
|
|
public PlayableDirector ChuCao_PlayableDirector;
|
|
public PlayableDirector Shengfangengtian_PlayableDirector;
|
|
public PlayableDirector Padi_PlayableDirector;
|
|
|
|
|
|
public GameObject[] farmTools;
|
|
//public Animator Gengtian_animator;
|
|
public HighlightEffect TuoChe_highlightEffect;
|
|
public bool TuoChe_enabled;
|
|
// Start is called before the first frame update
|
|
private void Awake()
|
|
{
|
|
instance = this;
|
|
}
|
|
void Start()
|
|
{
|
|
ChuCao_PlayableDirector.Stop();
|
|
Shengfangengtian_PlayableDirector.Stop();
|
|
Padi_PlayableDirector.Stop();
|
|
ChuCao_PlayableDirector.gameObject.SetActive(true);
|
|
Shengfangengtian_PlayableDirector.gameObject.SetActive(false); ;
|
|
Padi_PlayableDirector.gameObject.SetActive(false); ;
|
|
farmTools[1].SetActive(true);
|
|
farmTools[0].SetActive(false);
|
|
farmTools[2].SetActive(false);
|
|
//Gengtian_animator.enabled = false;
|
|
if (Bootstrap.Instance != null)
|
|
|
|
Bootstrap.Instance.eventCenter.AddEventListener<bool>(Enum_EventType.Íϳµ, TuoCheEnabled);
|
|
}
|
|
|
|
private void TuoCheEnabled(bool value)
|
|
{
|
|
TuoChe_enabled = value;
|
|
}
|
|
|
|
// Update is called once per frame
|
|
//void Update()
|
|
//{
|
|
// if (Input.GetMouseButtonDown(0) && TuoChe_enabled)
|
|
// {
|
|
// Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
|
|
// RaycastHit hit;
|
|
// bool raycast = Physics.Raycast(ray, out hit);
|
|
// if (raycast)
|
|
// {
|
|
// if (hit.collider.gameObject.name.Equals("Íϳµ"))
|
|
// {
|
|
// Gengtian_animator.enabled = true;
|
|
// TuoChe_highlightEffect.highlighted = false;
|
|
// TuoChe_PlayableDirector.Play();
|
|
// }
|
|
// }
|
|
// }
|
|
//}
|
|
|
|
private void OnDisable()
|
|
{
|
|
if (Bootstrap.Instance != null)
|
|
Bootstrap.Instance.eventCenter.RemoveEventListener<bool>(Enum_EventType.Íϳµ, TuoCheEnabled);
|
|
}
|
|
}
|