Ejemplo n.º 1
0
    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);
    }
Ejemplo n.º 2
0
    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));
    }
Ejemplo n.º 3
0
    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,
        }));
    }