コード例 #1
0
ファイル: HintScript.cs プロジェクト: zimpzon/haps
    // 0 1 2
    // 3 4 5
    // 6 7 8
    void PointerShowWinLine(int idx0, int idx1, HelpingHandScript handScript)
    {
        int  line0      = (idx0 / 3) - 1; // -1 -> 1
        int  line1      = (idx1 / 3) - 1; // -1 -> 1
        bool isDiagonal = line0 != line1;

        var   go        = GameObject.FindGameObjectWithTag("SpinWheel");
        var   rectTrans = go.transform.rectTransform();
        var   pos       = go.transform.position;
        float x0        = pos.x - rectTrans.rect.width * 0.45f;
        float x1        = pos.x + rectTrans.rect.width * 0.45f;
        float y0        = pos.y + rectTrans.rect.height * (isDiagonal ? 0.6f : 0.5f);
        float y1        = pos.y - rectTrans.rect.height * (isDiagonal ? 0.6f : 0.5f);
        float w         = x1 - x0;
        float h         = y1 - y0;
        float iconH     = h / 3;
        float iconW     = w / 3;

        var startPoint = pos + (new Vector3(x0, iconH * line0, 0.0f));
        var endPoint   = pos + (new Vector3(x1, iconH * line1, 0.0f));

        PointerMoveTo(startPoint, PointerMoveSpeed, handScript);
        handScript.AddCommand(new HandCommandPointerDown());
        handScript.AddCommand(HandCommandPause.Create(0.5f));
        PointerMoveTo(endPoint, PointerMoveSpeed, handScript);
        handScript.AddCommand(new HandCommandPointerUp());
        handScript.AddCommand(HandCommandPause.Create(0.5f));
    }
コード例 #2
0
ファイル: HintScript.cs プロジェクト: zimpzon/haps
    void PointerShowHoldIfSet(bool isSet, string tag, HelpingHandScript handScript)
    {
        if (!isSet)
        {
            return;
        }

        const float HoldPointTime = 0.5f;

        MoveToObjectWithTag(tag, handScript);
        handScript.AddCommand(new HandCommandPointerDown());
        handScript.AddCommand(HandCommandPause.Create(HoldPointTime));
        handScript.AddCommand(new HandCommandPointerUp());
        handScript.AddCommand(HandCommandPause.Create(HoldPointTime * 0.5f));
    }
コード例 #3
0
ファイル: HintScript.cs プロジェクト: zimpzon/haps
 void MoveToObjectWithTag(string tag, HelpingHandScript hand, float speed = PointerMoveSpeed)
 {
     PointerMoveTo(GetCenterFromTag(tag), speed, hand);
 }
コード例 #4
0
ファイル: HintScript.cs プロジェクト: zimpzon/haps
 void PointerMoveTo(Vector3 target, float speed, HelpingHandScript handScript)
 {
     handScript.AddCommand(HandCommandMoveTo.Create(target, speed));
 }