private void PropMove(Drawer drawer, bool isGuide = false) { if (m_SelectProps == null) { return; } float x = UnityEngine.Random.Range(-1f, 1f); Vector3 newPos = drawer.transform.position + new Vector3(x, 0, 0); Vector3[] path = new Vector3[3] { m_SelectProps.transform.position, m_SelectProps.transform.position - new Vector3(3, -3, 0), newPos }; Tween tween1 = m_SelectProps.transform.DOPath(path, 0.5f, PathType.CatmullRom).SetEase(Ease.InCubic); GameEntry.Sound.PlayUISound((int)UISoundId.biu); tween1.OnComplete(() => { m_SelectProps.ResetProp(); drawer.Close(); DrawerProp prop = CloneProp(drawer.Parent, newPos); prop.Clone(); if (!isGuide) { Enter_Success(); } }); }
private void TouchProp(GameObject go) { if (go == null) { return; } if (m_IsChooseSuccessCondition) { return; } for (int i = 0; i < m_DrawerProps.Length; i++) { if (m_DrawerProps[i].gameObject == go) { m_SelectProps = m_DrawerProps[i]; if (m_IsChooseSuccessCondition = m_DrawerProps[i].Select(m_CurPropType)) { for (int j = 0; j < m_DrawerProps.Length; j++) { if (m_DrawerProps[j].gameObject != go) { m_DrawerProps[j].Gary(); } } } else { m_PennyAnimator.SetInteger("state", 6); } break; } } }
private DrawerProp CloneProp(Transform trs, Vector3 pos) { DrawerProp item = Instantiate(m_SelectProps); Transform transform = item.GetComponent <Transform>(); transform.SetParent(trs); transform.position = pos; transform.localScale = Vector3.one * 0.8f; return(item); }
protected override void Enter_Teaching() { base.Enter_Teaching(); for (int i = 0; i < m_DrawerProps.Length; i++) { m_DrawerProps[i].Scale(); if (m_DrawerProps[i].PropType == PropType.Snacks && m_SelectProps == null) { m_SelectProps = m_DrawerProps[i]; } } Drawer selectDrawer = null; for (int i = 0; i < m_DrawerTouch_L.Length; i++) { if (m_DrawerTouch_L[i].Id == 5) { selectDrawer = m_DrawerTouch_L[i]; break; } } m_Guide.StartGuide(m_SelectProps.transform, selectDrawer.transform, () => { m_SelectProps.Select(PropType.Snacks); for (int j = 0; j < m_DrawerProps.Length; j++) { if (m_DrawerProps[j].gameObject != m_SelectProps) { m_DrawerProps[j].Gary(); } } }, () => { selectDrawer.Select(DirType.Left, 5, (x) => { PropMove(x, true); }); }, m_PennyAnimator ); }
/// <summary> /// 重置数据 /// </summary> protected override void ResetData() { base.ResetData(); m_SelectProps = null; m_SelectDrawer = null; }