using System; using System.Collections; using System.Collections.Generic; using UnityEngine; /// /// 进度实体 /// [RequireComponent(typeof(Collider))] public class ProgressInstance : MonoBehaviour { public Progress progress; public float lineWidth = 0.02f; private float width; private MaterialPropertyBlock _materialPropertyBlock; private void Awake() { _materialPropertyBlock = new MaterialPropertyBlock(); GetComponent().tag = "Action"; CloseLine(); } public void OpenLine() { width = lineWidth; GetComponent().enabled = true; GetComponent().enabled = true; } public void CloseLine() { width = 0; GetComponent().enabled = false; GetComponent().enabled = false; } /// /// 开启提示特效 /// public void OpenTip() { EffectManager.Instance.EnableTipEffect(transform); } /// /// 开启交互特效 /// public void StartInteractEffect(Progress progress) { if (progress != this.progress) { UI.Instance.help.ShowError(transform.position,"组装顺序错误"); return; } EffectManager.Instance.EnableInteractEffect(Camera.main.WorldToScreenPoint(transform.position)); } public void EndInteractEffect() { EffectManager.Instance.DisableInteractEffect(); } private void Update() { _materialPropertyBlock.SetFloat("_LineWidth",width); GetComponent()?.SetPropertyBlock(_materialPropertyBlock); } }