using System.Collections; using System.Collections.Generic; using UnityEngine; using DG.Tweening; namespace DisComputer { public class CpuAnimation : SpareAnimationBase { [Header("Cpu")] public GameObject mainGo; public Vector3 mainShowPos; public Vector3 mainInitPos; [Header("卡扣")] public GameObject buckleGo; public Vector3 openEuler; public Vector3 closeEuler; // Start is called before the first frame update void Start() { } public override bool IsCompareTag(object data) { if (GameConfig.state == GameState.Unload) { ToolType toolType = ToolType.Hand; ToolItem item = (ToolItem)data; if (item.toolType == toolType) { return true; } CoolPointTip("请使用合适的工具"); return false; } else { Grid grid = (Grid)data; if(grid.type == _type) { return true; } CoolPointTip("请选择正确的零件"); return false; } } public override void OnLoadAct() { base.OnLoadAct(); buckleGo.SetActive(true); mainGo.SetActive(true); mainGo.transform.DOLocalMove(mainInitPos, 0.5f).SetEase(Ease.Linear).OnComplete(() => { buckleGo.transform.DOLocalRotate(closeEuler, 0.35f).SetDelay(0.3f).SetEase(Ease.OutQuart).OnComplete(() => { OnLoadFinishHandle?.Invoke(); }); }); } public override void OnUnLoadAct() { base.OnUnLoadAct(); buckleGo.transform.DOLocalRotate(openEuler, 0.35f).SetEase(Ease.Linear).OnComplete(() => { mainGo.transform.DOLocalMove(mainShowPos, 0.5f).SetDelay(0.3f).SetEase(Ease.OutQuart).OnComplete(() => { CommonTool.WaitTimeAfterDo(this,.350f,()=> { OnUnLoadFinishHandle?.Invoke(); mainGo.SetActive(false); }); }); }); } } }