public eDecision GetDecision(SHUIWidget_Stick pStick, SHUIWidget_Monster pMonster) { if ((null == pStick) || (null == pMonster)) { return(eDecision.Miss); } var fGap = Mathf.Abs(pMonster.GetLocalPosition().x - pStick.GetLocalPosition().x); var fSep = 50.0f;//pMonster.GetCollider().bounds.size.x / 3.0f; if (fGap <= (fSep * 0.5f)) { return(eDecision.Good); } if (fGap <= (fSep * 1.5f)) { return(eDecision.Normal); } if (fGap <= (fSep * 3.0f)) { return(eDecision.Bad); } return(eDecision.Miss); }
public float GetRatioToGap(SHUIWidget_Stick pStick, SHUIWidget_Monster pMonster) { if ((null == pStick) || (null == pMonster)) { return(0.0f); } var fRatio = Mathf.Abs(pMonster.GetLocalPosition().x - pStick.GetLocalPosition().x) / 150.0f; //pMonster.GetCollider().bounds.size.x; return(Mathf.Clamp(fRatio, 0.0f, 1.0f)); }
public eDirection GetDirection(SHUIWidget_Stick pStick, SHUIWidget_Monster pMonster) { if ((null != pStick) && (null != pMonster)) { if (pMonster.GetLocalPosition().x < pStick.GetLocalPosition().x) { return(eDirection.Left); } if (pMonster.GetLocalPosition().x > pStick.GetLocalPosition().x) { return(eDirection.Right); } } return(SHMath.RandomN(new List <eDirection>() { eDirection.Left, eDirection.Right, })); }