Пример #1
0
    public void ChooseChar(CharAvatar go)
    {
        int        index;
        GameObject arrow;

        switch (go.getWhichPlayer())
        {
        case "white":
            index = go.getIndex();
            Destroy(GameObject.Find("whiteArrow")); arrow = Instantiate(arrowPrefab, new Vector3(transform.position.x - 20, transform.position.y, transform.position.z), new Quaternion(0, 0, 0, 0), transform);
            arrow.name = "whiteArrow";

            gameSet.setWhiteCharacter(index);
            gameController.setWhitePicsAndDesc(index);
            break;

        case "black":
            index = go.getIndex();
            Destroy(GameObject.Find("whiteArrow"));
            arrow      = Instantiate(arrowPrefab, new Vector3(transform.position.x - 20, transform.position.y, transform.position.z), new Quaternion(0, 0, 0, 0), transform);
            arrow.name = "whiteArrow";

            gameSet.setWhiteCharacter(index);
            gameController.setWhitePicsAndDesc(index);
            break;
        }
    }
Пример #2
0
    public void Choose()
    {
        if (whichPlayer == "white" && gameSet.getWhitePlays())
        {
            Destroy(GameObject.Find("whiteArrow"));
            GameObject arrow = Instantiate(arrowPrefab, new Vector3(transform.position.x - 20, transform.position.y, transform.position.z), new Quaternion(0, 0, 0, 0), transform);
            arrow.name = "whiteArrow";

            gameSet.setWhiteCharacter(index);
            gameController.setWhitePicsAndDesc(index);
        }
        else if (whichPlayer == "black" && gameSet.getBlackPlays())
        {
            Destroy(GameObject.Find("blackArrow"));
            GameObject arrow = Instantiate(arrowPrefab, new Vector3(transform.position.x + 20, transform.position.y, transform.position.z), new Quaternion(0, 90, 0, 0), transform);
            arrow.name = "blackArrow";

            gameSet.setBlackCharacter(index);
            gameController.setBlackPicsAndDesc(index);
        }
    }