Inheritance: King
Ejemplo n.º 1
0
    static void Main(string[] args)
    {
        IKing  ka = new KingA();
        IKing  kb = new KingB();
        Result ra = ka.Get();
        Result rb = kb.Get();

        if (ra is ResultA)
        {
            Console.WriteLine("A ok!");
        }
        if (rb is ResultB)
        {
            Console.WriteLine("B ok!");
        }
    }
Ejemplo n.º 2
0
 // Update is called once per frame
 void Update()
 {
     coinscollected = PlayerPrefs.GetInt("coinscollected");
     //CHECK UNEQUIP ACTIVE KE TAK
     checkeq = PlayerPrefs.GetInt("checkeq");
     if (checkeq == 1)
     {
         HornedBeeCheck.SetActive(true);
         PrincessRed.SetActive(false);
         DukeEggfly.SetActive(false);
         JesterB.SetActive(false);
         Archer.SetActive(false);
         Queenant.SetActive(false);
         KingB.SetActive(false);
     }
     if (checkeq == 2)
     {
         HornedBeeCheck.SetActive(false);
         PrincessRed.SetActive(true);
         DukeEggfly.SetActive(false);
         JesterB.SetActive(false);
         Archer.SetActive(false);
         Queenant.SetActive(false);
         KingB.SetActive(false);
     }
     if (checkeq == 3)
     {
         HornedBeeCheck.SetActive(false);
         PrincessRed.SetActive(false);
         DukeEggfly.SetActive(true);
         JesterB.SetActive(false);
         Archer.SetActive(false);
         Queenant.SetActive(false);
         KingB.SetActive(false);
     }
     if (checkeq == 4)
     {
         HornedBeeCheck.SetActive(false);
         PrincessRed.SetActive(false);
         DukeEggfly.SetActive(false);
         JesterB.SetActive(true);
         Archer.SetActive(false);
         Queenant.SetActive(false);
         KingB.SetActive(false);
     }
     if (checkeq == 5)
     {
         HornedBeeCheck.SetActive(false);
         PrincessRed.SetActive(false);
         DukeEggfly.SetActive(false);
         JesterB.SetActive(false);
         Archer.SetActive(true);
         Queenant.SetActive(false);
         KingB.SetActive(false);
     }
     if (checkeq == 6)
     {
         HornedBeeCheck.SetActive(false);
         PrincessRed.SetActive(false);
         DukeEggfly.SetActive(false);
         JesterB.SetActive(false);
         Archer.SetActive(false);
         Queenant.SetActive(true);
         KingB.SetActive(false);
     }
     if (checkeq == 7)
     {
         HornedBeeCheck.SetActive(false);
         PrincessRed.SetActive(false);
         DukeEggfly.SetActive(false);
         JesterB.SetActive(false);
         Archer.SetActive(false);
         Queenant.SetActive(false);
         KingB.SetActive(true);
     }
     //CHECK ENEQUIP
 }
Ejemplo n.º 3
0
    public void swith_Player()
    {
        if (currently_White == 1)
        {
            currently_White = 0;

            if (KingB.GetComponent <Pice> ().check_Danger(KingB.GetComponent <Pice> ().position_X, KingB.GetComponent <Pice> ().position_Y, chess_Behaveiour_refference.chess_Table))
            {
                bool can_Move = false;
                for (int i = 0; i <= 7 && can_Move != true; ++i)
                {
                    for (int j = 0; j <= 7 && can_Move != true; ++j)
                    {
                        if (chess_Behaveiour_refference.chess_Table [i] [j] != null && chess_Behaveiour_refference.chess_Table [i] [j].name.Contains("W") == false)
                        {
                            int temp = chess_Behaveiour_refference.chess_Table [i] [j].GetComponent <Pice> ().Select(false);
                            chess_Behaveiour_refference.chess_Table [i] [j].GetComponent <Pice> ().Deselect();
                            if (temp >= 1)
                            {
                                can_Move = true;
                            }
                        }
                    }
                }

                if (can_Move)
                {
                    KingB.GetComponent <Pice> ().Select(true);
                    raycast_Refference.currently_Selected = KingB;
                    raycast_Refference.in_Check           = true;
                }
                else
                {
                    win_Menu_Refference.Win(!((currently_White == 1) ? true : false));
                }
            }
        }
        else
        {
            currently_White = 1;

            if (KingW.GetComponent <Pice> ().check_Danger(KingW.GetComponent <Pice> ().position_X, KingW.GetComponent <Pice> ().position_Y, chess_Behaveiour_refference.chess_Table))
            {
                bool can_Move = false;
                for (int i = 0; i <= 7 && can_Move != true; ++i)
                {
                    for (int j = 0; j <= 7 && can_Move != true; ++j)
                    {
                        if (chess_Behaveiour_refference.chess_Table [i] [j] != null && chess_Behaveiour_refference.chess_Table [i] [j].name.Contains("W") == true)
                        {
                            int temp = chess_Behaveiour_refference.chess_Table [i] [j].GetComponent <Pice> ().Select(false);
                            chess_Behaveiour_refference.chess_Table [i] [j].GetComponent <Pice> ().Deselect();
                            if (temp >= 1)
                            {
                                can_Move = true;
                            }
                        }
                    }
                }

                if (can_Move)
                {
                    KingW.GetComponent <Pice> ().Select(true);
                    raycast_Refference.currently_Selected = KingW;
                    raycast_Refference.in_Check           = true;
                }
                else
                {
                    win_Menu_Refference.Win(!((currently_White == 1) ? true : false));
                }
            }
        }
    }