bool CheckPassFail() { TabPoint tp = SysMgr.GetTapInfo(TabIndex).script; if (tp == null) { State = CubeState.Fail; SysMgr.StopJump(); gameObject.SetActive(false); MessageBox.Show("GameOver", "Failed", null); return(true); } float x = tp.transform.position.x - transform.position.x; float time = Curve.GetLinearT(x); float tolerance = Setting.Inst().TimePerBar *Setting.Inst().RatePassFail; if (Mathf.Abs(time) > tolerance) { State = CubeState.Fail; SysMgr.StopJump(); gameObject.SetActive(false); MessageBox.Show("GameOver", "Failed", null); return(true); } else if (tp.IsFinalTab()) { State = CubeState.Success; SysMgr.StopJump(); gameObject.SetActive(false); MessageBox.Show("Success", "Success", null); return(true); } return(false); }
void TouchTabPoint() { TabPoint tp = SysMgr.GetTapInfo(TabIndex).script; float x = tp.transform.position.x - transform.position.x; float time = Curve.GetLinearT(x); float tolerance = Setting.Inst().TimePerBar *Setting.Inst().RateAccuracy; if (Mathf.Abs(time) < tolerance) { tp.CleanHit(); } }
private bool InstantiateTapPoint() { if (IndexNextTP >= tabPoints.Count) { return(false); } TabInfo info = tabPoints[IndexNextTP]; if (accTime >= tabPoints[IndexNextTP].time - TabPoint.Delay) { Vector3 pos = info.worldPos; GameObject tab = Instantiate(PrefabTapPoint, pos, Quaternion.identity); TabPoint tp = tab.GetComponent <TabPoint>(); info.script = tp; tp.TapInfo = info; tabPoints[IndexNextTP] = info; IndexNextTP++; return(true); } return(false); }
public TabInfo(float _time, TabType _type, int _idxStep) { time = _time; type = _type; idxStep = _idxStep; idxStepToNext = -1; worldPos = new Vector2(); script = null; }