Esempio n. 1
0
    // this function get called on select trapped stones
    public void OnSelectTrappedStone()
    {
        OnSelected.OnChosingMove -= gameManager.ChangeColorToCurrentPlayer;
        OnSelected.OnChosingMove += gameManager.ChangeColorToCurrentPlayer;

        currentList = (PlayerType == "Black") ? gameManager.onPlayerBlack : gameManager.onPlayerWhite;
        if (currentList != null)
        {
            // check if player is fount on trapped array accordint to TypePlayer
            if (gameManager.IsPlayerFoundOnTrapped(currentList, this))
            {
                // pass on the array and add OnSelected Component, if not have one.
                foreach (Player p in currentList)
                {
                    if (!p.GetComponent <OnSelected>())
                    {
                        p.transform.gameObject.AddComponent <OnSelected>();
                    }
                }
                // show options for movement
                gameManager.changeLocationsToTrappedStones(PlayerType);
            }
        }
    }