Пример #1
0
    void layoutGame()
    {
        if (layoutAnchor == null)
        {
            GameObject tGO = new GameObject("_LayoutAnchor");
            layoutAnchor = tGO.transform;
            layoutAnchor.transform.position = layoutCenter;
        }
        arrangeDrawPile();
        PlayerBl pl;

        players = new List <PlayerBl> ();
        List <SlotDefBl> tShowDefList = new List <SlotDefBl> ();

        foreach (SlotDefBl tSSD in layout.showDefs)
        {
            tShowDefList.Add(tSSD);
        }
        int k = 0;

        foreach (SlotDefBl tSD in layout.slotDefs)
        {
            pl             = new PlayerBl();
            pl.handSlotDef = tSD;
            pl.showSlotDef = tShowDefList [k];
            k++;
            players.Add(pl);
            pl.playerNum = players.Count - 1;
        }
        players [0].type = PlayerType.human;
        deal();
    }
Пример #2
0
    public void passTurn(int num = -1)
    {
        if (num == -1)
        {
            int ndx = players.IndexOf(CURRENT_PLAYER);
            num = (ndx + 1) % 4;
        }
        int lastPlayerNum = -1;

        if (CURRENT_PLAYER != null)
        {
            lastPlayerNum = CURRENT_PLAYER.playerNum;
            if (checkGameOver())
            {
                restartGame();
            }
        }
        CURRENT_PLAYER = players [num];
        phase          = TurnPhase.pre;
        CURRENT_PLAYER.takeTurn();
        Vector3 lPos = CURRENT_PLAYER.handSlotDef.pos + Vector3.back * 5;

        turnLight.transform.position = lPos;
        Utils.tr(Utils.RoundToPlaces(Time.time), "Blackjack.passTurn()", "Old: " + lastPlayerNum, "New: " + CURRENT_PLAYER.playerNum);
    }
Пример #3
0
 public void restartGame()
 {
     CURRENT_PLAYER = null;
     foreach (PlayerBl pl in players)
     {
         foreach (CardBlackjack cb in pl.show)
         {
             moveToDiscard(cb);
         }
     }
     deal();
 }
Пример #4
0
 void Update()
 {
     switch (state)
     {
     case CBlState.toHand:
     case CBlState.to:
         float u  = (Time.time - timeStart) / timeDuration;
         float uC = Easing.Ease(u, MOVE_EASING);
         if (u < 0)
         {
             transform.localPosition = bezierPts [0];
             transform.rotation      = bezierRots [0];
             return;
         }
         if (u >= 1)
         {
             uC = 1;
             if (state == CBlState.toHand)
             {
                 state = CBlState.hand;
             }
             if (state == CBlState.to)
             {
                 state = CBlState.idle;
             }
             if (state == CBlState.toShow)
             {
                 state = CBlState.show;
             }
             transform.localPosition = bezierPts [bezierPts.Count - 1];
             transform.rotation      = bezierRots [bezierPts.Count - 1];
             timeStart = 0;
             if (reportFinishTo != null)
             {
                 reportFinishTo.SendMessage("CBCallback", this);
                 reportFinishTo = null;
             }
             else if (callbackPlayer != null)
             {
                 callbackPlayer.CBCallback(this);
                 callbackPlayer = null;
             }
             else
             {
                 //do nothing
             }
         }
         else
         {
             Vector3 pos = Utils.Bezier(uC, bezierPts);
             transform.localPosition = pos;
             Quaternion rotQ = Utils.Bezier(uC, bezierRots);                        //This doesn't work because Utils.Bezier is looking for a list of floats, not a list of Quaternions.
             transform.rotation = rotQ;
             if (u > 0.5f && spriteRenderers[0].sortingOrder != eventualSortOrder)
             {
                 setSortOrder(eventualSortOrder);
             }
             if (u > 0.75f && spriteRenderers[0].sortingLayerName != eventualSortLayer)
             {
                 setSortingLayerName(eventualSortLayer);
             }
         }
         break;
     }
 }
Пример #5
0
 void Awake()
 {
     callbackPlayer = null;
 }