Exemple #1
0
 // Start is called before the first frame update
 public void Start()
 {
     skipper    = true;
     g          = GameObject.Find("Game_Controler").GetComponent <Game_Controler>();
     hand       = GameObject.Find("Game_Starter").GetComponent <Game>().Hand1;
     hand_graph = GameObject.Find("Game_Starter").GetComponent <Game>().Hand1_rand;
 }
Exemple #2
0
 private void Start()
 {
     left  = true;
     right = true;
     game  = GameObject.Find("Game_Controler");
     g     = GameObject.Find("Game_Controler").GetComponent <Game_Controler>();
     p     = GameObject.Find("Player").GetComponent <Player>();
 }
Exemple #3
0
    // Start is called before the first frame update
    public void Start()
    {
        g = GameObject.Find("Game_Controler").GetComponent <Game_Controler>();
        s = gameObject.name.Split('_')[1];


        if (s == "2")
        {
            hand       = GameObject.Find("Game_Starter").GetComponent <Game>().Hand2;
            hand_graph = GameObject.Find("Game_Starter").GetComponent <Game>().Hand2_rand;
        }
        if (s == "3")
        {
            hand       = GameObject.Find("Game_Starter").GetComponent <Game>().Hand3;
            hand_graph = GameObject.Find("Game_Starter").GetComponent <Game>().Hand3_rand;
        }
        if (s == "4")
        {
            hand       = GameObject.Find("Game_Starter").GetComponent <Game>().Hand4;
            hand_graph = GameObject.Find("Game_Starter").GetComponent <Game>().Hand4_rand;
        }
    }
Exemple #4
0
 // Start is called before the first frame update
 void Start()
 {
     g = FindObjectOfType <Game_Controler>();
 }
Exemple #5
0
    public void commit(int up, int down, CPU p)
    {
        p.turn = false;
        game   = GameObject.Find("Game_Controler");
        g      = GameObject.Find("Game_Controler").GetComponent <Game_Controler>();


        gameObject.GetComponent <SpriteRenderer>().color = Color.white;


        StartCoroutine(flip(1, up, down));
        StartCoroutine(flip2(1, 1, new Vector3(0, 1, 0)));



        StartCoroutine(ScaleOverTime(1));


        if (g.begining && g.round == 1)
        {
            g.lefty            = gameObject;
            g.righty           = gameObject;
            g.leftpiece.big    = 6;
            g.leftpiece.small  = 6;
            g.rightpiece.big   = 6;
            g.rightpiece.small = 6;


            if (g.play_num == 3)
            {
                StartCoroutine(flip2(1, 2, new Vector3(0, 0, 1)));
            }
            else if (g.play_num == 4)
            {
                StartCoroutine(flip2(1, 2, new Vector3(0, 0, -1)));
            }

            StartCoroutine(moveToPosition(gameObject.transform, g.V_left, 1));
            g.right    = 6;
            g.left     = 6;
            g.begining = false;
            p.setagian(up, down);
            g.V_left.x  -= 0.72f;
            g.V_right.x += 0.72f;
        }
        else if (g.begining)
        {
            g.lefty            = gameObject;
            g.righty           = gameObject;
            g.leftpiece.big    = up;
            g.leftpiece.small  = down;
            g.rightpiece.big   = up;
            g.rightpiece.small = down;


            if (g.play_num == 3)
            {
                StartCoroutine(flip2(1, 2, new Vector3(0, 0, 1)));
            }
            else if (g.play_num == 4)
            {
                StartCoroutine(flip2(1, 2, new Vector3(0, 0, -1)));
            }

            StartCoroutine(moveToPosition(gameObject.transform, g.V_left, 1));
            g.right    = up;
            g.left     = down;
            g.begining = false;
            p.setagian(up, down);
            g.V_left.x  -= 0.72f;
            g.V_right.x += 0.72f;
        }

        else if (up == down)
        {
            //print(g.left_played + " "+ g.right_played);
            if (up == g.left)
            {
                g.lefty = gameObject;

                if (g.left_played == 5)
                {
                    g.V_left.x += 0.48f;
                    g.V_left.y += 0.48f;
                }



                if (g.left_played < 5)
                {
                    g.left_played++;

                    if (g.play_num == 3)
                    {
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, 1)));
                    }
                    else if (g.play_num == 4)
                    {
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, -1)));
                    }
                    g.leftpiece.big   = up;
                    g.leftpiece.small = down;

                    StartCoroutine(moveToPosition(gameObject.transform, g.V_left, 1));
                    g.V_left.x -= 0.72f;
                    g.left      = up;
                    p.setagian(up, down);
                }

                else if (g.left_played > 4 && g.left_played < 7)
                {
                    //if(g.left_played == 6)
                    //{
                    //    g.V_left.x -= 0.48f;
                    //}

                    //print("r true");
                    g.left_played++;
                    g.leftpiece.big   = up;
                    g.leftpiece.small = down;

                    StartCoroutine(moveToPosition(gameObject.transform, g.V_left, 1));
                    if (g.play_num == 2)
                    {
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, 1)));
                    }

                    g.V_left.y += 0.72f;
                    g.left      = up;
                    p.setagian(up, down);
                }
                else if (g.left_played > 6)
                {
                    if (g.left_played == 7)
                    {
                        g.V_left.x += 0.48f;
                        g.V_left.y -= 0.48f;
                    }

                    g.left_played++;

                    if (g.play_num == 3)
                    {
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, 1)));
                    }
                    else if (g.play_num == 4)
                    {
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, -1)));
                    }
                    g.leftpiece.big   = up;
                    g.leftpiece.small = down;

                    StartCoroutine(moveToPosition(gameObject.transform, g.V_left, 1));
                    g.V_left.x += 0.72f;
                    g.left      = up;
                    p.setagian(up, down);
                }
            }
            else
            {
                g.righty = gameObject;
                if (g.right_played == 5)
                {
                    g.V_right.x -= 0.48f;
                    g.V_right.y -= 0.48f;
                }



                if (g.right_played < 5)
                {
                    g.right_played++;
                    if (g.play_num == 3)
                    {
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, 1)));
                    }
                    else if (g.play_num == 4)
                    {
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, -1)));
                    }
                    g.rightpiece.big   = up;
                    g.rightpiece.small = down;

                    StartCoroutine(moveToPosition(gameObject.transform, g.V_right, 1));
                    g.V_right.x += 0.72f;
                    g.right      = up;
                    p.setagian(up, down);
                }

                else if (g.right_played > 4 && g.right_played < 7)
                {
                    //if (g.right_played == 6)
                    //{
                    //    g.V_right.x += 0.48f;
                    //}
                    //print("l true");
                    g.right_played++;
                    g.rightpiece.big   = up;
                    g.rightpiece.small = down;

                    StartCoroutine(moveToPosition(gameObject.transform, g.V_right, 1));
                    if (g.play_num == 2)
                    {
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, 1)));
                    }

                    g.V_right.y -= 0.72f;
                    g.right      = up;
                    p.setagian(up, down);
                }
                else if (g.right_played > 6)
                {
                    if (g.right_played == 7)
                    {
                        g.V_right.x -= 0.48f;
                        g.V_right.y += 0.48f;
                    }

                    g.right_played++;
                    if (g.play_num == 3)
                    {
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, 1)));
                    }
                    else if (g.play_num == 4)
                    {
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, -1)));
                    }
                    g.rightpiece.big   = up;
                    g.rightpiece.small = down;

                    StartCoroutine(moveToPosition(gameObject.transform, g.V_right, 1));
                    g.V_right.x -= 0.72f;
                    g.right      = up;
                    p.setagian(up, down);
                }
            }
        }
        else
        {
            if (p.s == "2")
            {
                if (up == g.left)
                {
                    g.lefty = gameObject;
                    if (g.left_played < 5)
                    {
                        checkleft(up, down);
                        g.left_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_left, 1));
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, 1)));
                        g.V_left.x -= 0.72f;
                        g.left      = down;
                        p.setagian(up, down);
                    }
                    else if (g.left_played > 4 && g.left_played < 7)
                    {
                        checkleft(up, down);
                        g.left_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_left, 1));
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, 2)));
                        g.V_left.y += 0.72f;
                        g.left      = down;
                        p.setagian(up, down);
                    }
                    else if (g.left_played > 6)
                    {
                        checkleft(up, down);
                        g.left_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_left, 1));
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, -1)));
                        g.V_left.x += 0.72f;
                        g.left      = down;
                        p.setagian(up, down);
                    }
                }
                else if (up == g.right)
                {
                    g.righty = gameObject;
                    if (g.right_played < 5)
                    {
                        checkright(up, down);
                        g.right_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_right, 1));
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, -1)));
                        g.V_right.x += 0.72f;
                        g.right      = down;
                        p.setagian(up, down);
                    }
                    else if (g.right_played > 4 && g.right_played < 7)
                    {
                        checkright(up, down);
                        g.right_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_right, 1));
                        //StartCoroutine(flip2(1, 2, new Vector3(0, 0, 2)));
                        g.V_right.y -= 0.72f;
                        g.right      = down;
                        p.setagian(up, down);
                    }
                    else if (g.right_played > 6)
                    {
                        checkright(up, down);
                        g.right_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_right, 1));
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, 1)));
                        g.V_right.x -= 0.72f;
                        g.right      = down;
                        p.setagian(up, down);
                    }
                }
                else if (down == g.left)
                {
                    g.lefty = gameObject;
                    if (g.left_played < 5)
                    {
                        checkleft(up, down);
                        g.left_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_left, 1));
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, -1)));
                        g.V_left.x -= 0.72f;
                        g.left      = up;
                        p.setagian(up, down);
                    }
                    else if (g.left_played > 4 && g.left_played < 7)
                    {
                        checkleft(up, down);
                        g.left_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_left, 1));
                        //StartCoroutine(flip2(1, 2, new Vector3(0, 0, 2)));
                        g.V_left.y += 0.72f;
                        g.left      = up;
                        p.setagian(up, down);
                    }

                    else if (g.left_played > 6)
                    {
                        checkleft(up, down);
                        g.left_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_left, 1));
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, 1)));
                        g.V_left.x += 0.72f;
                        g.left      = up;
                        p.setagian(up, down);
                    }
                }
                else if (down == g.right)
                {
                    g.righty = gameObject;
                    if (g.right_played < 5)
                    {
                        checkright(up, down);
                        g.right_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_right, 1));
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, 1)));
                        g.V_right.x += 0.72f;
                        g.right      = up;
                        p.setagian(up, down);
                    }
                    else if (g.right_played > 4 && g.right_played < 7)
                    {
                        checkright(up, down);
                        g.right_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_right, 1));
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, 2)));
                        g.V_right.y -= 0.72f;
                        g.right      = up;
                        p.setagian(up, down);
                    }

                    else if (g.right_played > 6)
                    {
                        checkright(up, down);
                        g.right_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_right, 1));
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, -1)));
                        g.V_right.x -= 0.72f;
                        g.right      = up;
                        p.setagian(up, down);
                    }
                }
            }
            /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            if (p.s == "3")
            {
                if (up == g.left)
                {
                    g.lefty = gameObject;
                    if (g.left_played < 5)
                    {
                        checkleft(up, down);
                        g.left_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_left, 1));
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, 2)));
                        g.V_left.x -= 0.72f;
                        g.left      = down;
                        p.setagian(up, down);
                    }
                    else if (g.left_played > 4 && g.left_played < 7)
                    {
                        checkleft(up, down);
                        g.left_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_left, 1));
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, -1)));
                        g.V_left.y += 0.72f;
                        g.left      = down;
                        p.setagian(up, down);
                    }
                    else if (g.left_played > 6)
                    {
                        checkleft(up, down);
                        g.left_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_left, 1));
                        //StartCoroutine(flip2(1, 2, new Vector3(0, 0, -2)));
                        g.V_left.x += 0.72f;
                        g.left      = down;
                        p.setagian(up, down);
                    }
                }
                else if (up == g.right)
                {
                    g.righty = gameObject;
                    if (g.right_played < 5)
                    {
                        checkright(up, down);
                        g.right_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_right, 1));
                        //StartCoroutine(flip2(1, 2, new Vector3(0, 0, -1)));
                        g.V_right.x += 0.72f;
                        g.right      = down;
                        p.setagian(up, down);
                    }
                    else if (g.right_played > 4 && g.right_played < 7)
                    {
                        checkright(up, down);
                        g.right_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_right, 1));
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, 1)));
                        g.V_right.y -= 0.72f;
                        g.right      = down;
                        p.setagian(up, down);
                    }
                    else if (g.right_played > 6)
                    {
                        checkright(up, down);
                        g.right_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_right, 1));
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, 2)));
                        g.V_right.x -= 0.72f;
                        g.right      = down;
                        p.setagian(up, down);
                    }
                }
                else if (down == g.left)
                {
                    g.lefty = gameObject;
                    if (g.left_played < 5)
                    {
                        checkleft(up, down);
                        g.left_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_left, 1));
                        //StartCoroutine(flip2(1, 2, new Vector3(0, 0, -1)));
                        g.V_left.x -= 0.72f;
                        g.left      = up;
                        p.setagian(up, down);
                    }
                    else if (g.left_played > 4 && g.left_played < 7)
                    {
                        checkleft(up, down);
                        g.left_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_left, 1));
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, 1)));
                        g.V_left.y += 0.72f;
                        g.left      = up;
                        p.setagian(up, down);
                    }
                    else if (g.left_played > 6)
                    {
                        checkleft(up, down);
                        g.left_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_left, 1));
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, 2)));
                        g.V_left.x += 0.72f;
                        g.left      = up;
                        p.setagian(up, down);
                    }
                }
                else if (down == g.right)
                {
                    g.righty = gameObject;
                    if (g.right_played < 5)
                    {
                        checkright(up, down);
                        g.right_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_right, 1));
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, 2)));
                        g.V_right.x += 0.72f;
                        g.right      = up;
                        p.setagian(up, down);
                    }
                    else if (g.right_played > 4 && g.right_played < 7)
                    {
                        checkright(up, down);
                        g.right_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_right, 1));
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, -1)));
                        g.V_right.y -= 0.72f;
                        g.right      = up;
                        p.setagian(up, down);
                    }
                    if (g.right_played > 6)
                    {
                        checkright(up, down);
                        g.right_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_right, 1));
                        //StartCoroutine(flip2(1, 2, new Vector3(0, 0, -2)));
                        g.V_right.x -= 0.72f;
                        g.right      = up;
                        p.setagian(up, down);
                    }
                }
            }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
            if (p.s == "4")
            {
                if (up == g.left)
                {
                    g.lefty = gameObject;
                    if (g.left_played < 5)
                    {
                        checkleft(up, down);
                        g.left_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_left, 1));
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, 2)));
                        g.V_left.x -= 0.72f;
                        g.left      = down;
                        p.setagian(up, down);
                    }
                    else if (g.left_played > 4 && g.left_played < 7)
                    {
                        checkleft(up, down);
                        g.left_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_left, 1));
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, -1)));
                        g.V_left.y += 0.72f;
                        g.left      = down;
                        p.setagian(up, down);
                    }
                    else if (g.left_played > 6)
                    {
                        checkleft(up, down);
                        g.left_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_left, 1));
                        //StartCoroutine(flip2(1, 2, new Vector3(0, 0, -2)));
                        g.V_left.x += 0.72f;
                        g.left      = down;
                        p.setagian(up, down);
                    }
                }
                else if (up == g.right)
                {
                    g.righty = gameObject;
                    if (g.right_played < 5)
                    {
                        checkright(up, down);
                        g.right_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_right, 1));
                        //StartCoroutine(flip2(1, 2, new Vector3(0, 0, -1)));
                        g.V_right.x += 0.72f;
                        g.right      = down;
                        p.setagian(up, down);
                    }
                    else if (g.right_played > 4 && g.right_played < 7)
                    {
                        checkright(up, down);
                        g.right_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_right, 1));
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, 1)));
                        g.V_right.y -= 0.72f;
                        g.right      = down;
                        p.setagian(up, down);
                    }
                    else if (g.right_played > 6)
                    {
                        checkright(up, down);
                        g.right_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_right, 1));
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, 2)));
                        g.V_right.x -= 0.72f;
                        g.right      = down;
                        p.setagian(up, down);
                    }
                }
                else if (down == g.left)
                {
                    g.lefty = gameObject;
                    if (g.left_played < 5)
                    {
                        checkleft(up, down);
                        g.left_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_left, 1));
                        //StartCoroutine(flip2(1, 2, new Vector3(0, 0, -1)));
                        g.V_left.x -= 0.72f;
                        g.left      = up;
                        p.setagian(up, down);
                    }
                    else if (g.left_played > 4 && g.left_played < 7)
                    {
                        checkleft(up, down);
                        g.left_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_left, 1));
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, 1)));
                        g.V_left.y += 0.72f;
                        g.left      = up;
                        p.setagian(up, down);
                    }
                    else if (g.left_played > 6)
                    {
                        checkleft(up, down);
                        g.left_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_left, 1));
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, 2)));
                        g.V_left.x += 0.72f;
                        g.left      = up;
                        p.setagian(up, down);
                    }
                }
                else if (down == g.right)
                {
                    g.righty = gameObject;
                    if (g.right_played < 5)
                    {
                        checkright(up, down);
                        g.right_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_right, 1));
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, 2)));
                        g.V_right.x += 0.72f;
                        g.right      = up;
                        p.setagian(up, down);
                    }
                    else if (g.right_played > 4 && g.right_played < 7)
                    {
                        checkright(up, down);
                        g.right_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_right, 1));
                        StartCoroutine(flip2(1, 2, new Vector3(0, 0, -1)));
                        g.V_right.y -= 0.72f;
                        g.right      = up;
                        p.setagian(up, down);
                    }
                    else if (g.right_played > 6)
                    {
                        checkright(up, down);
                        g.right_played++;
                        StartCoroutine(moveToPosition(gameObject.transform, g.V_right, 1));
                        //StartCoroutine(flip2(1, 2, new Vector3(0, 0, -2)));
                        g.V_right.x -= 0.72f;
                        g.right      = up;
                        p.setagian(up, down);
                    }
                }
            }
        }



        //print("cpu "+ p.s +" ,turn "+g.turn_num+": "+ g.V_left + "      " + g.V_right);
    }