Пример #1
0
    //bio-Terrorist Operations
    public void bioMoveButtonClicked()
    {
        BioTerrorist bioterrorist = game.getBioTerrorist();

        currentPlayer = game.getCurrentPlayer();
        playerToMove  = currentPlayer;
        Debug.Log(playerToMove.getRoleKind());
        City currentCity = currentPlayer.getPlayerPawn().getCity();

        bioDriveButton.gameObject.GetComponent <Button>().interactable = true;
        if (currentPlayer.containsInfectionCard() && (currentPlayer.getRemainingAction() > 0))
        {
            bioDirectFlightButton.gameObject.GetComponent <Button>().interactable = true;
        }

        if (currentPlayer.containsSpecificInfectionCard(currentCity) && (currentPlayer.getRemainingAction() > 0))
        {
            bioCharterFlightButton.gameObject.GetComponent <Button>().interactable = true;
        }
        bioCancelButton.gameObject.GetComponent <Button>().interactable = true;
    }
    // Update is called once per frame
    void Update()
    {
        me            = game.FindPlayer(PhotonNetwork.player);
        currentPlayer = game.getCurrentPlayer();
        currentCity   = currentPlayer.getPlayerPawn().getCity();
        me            = game.FindPlayer(PhotonNetwork.player);
        currentPlayer = game.getCurrentPlayer();

        if (game.getChallenge() == Challenge.BioTerroist || game.getChallenge() == Challenge.BioTerroistAndVirulentStrain)
        {
            bioTerrorist = game.getBioTerrorist();
            bioPawn      = bioTerrorist.getPawn();

            if (me.getRoleKind() == RoleKind.BioTerrorist)
            {
                bioTerroristPanel.gameObject.SetActive(true);
                bioMovePanel.gameObject.SetActive(true);
                me.getPlayerPawn().gameObject.SetActive(true);
            }
            else
            {
                basicOperationPanel.gameObject.SetActive(true);
                movePanel.gameObject.SetActive(true);
                if (bioTerrorist.getIsSpotted())
                {
                    bioPawn.gameObject.SetActive(true);
                    if (currentPlayer == me)
                    {
                        if (!Added)
                        {
                            bioPawn.gameObject.GetComponent <Button> ().onClick.AddListener(() => capture());
                            Added = true;
                        }
                    }
                    else
                    {
                        bioPawn.gameObject.GetComponent <Button>().onClick.RemoveAllListeners();
                        Added = false;
                    }
                }
                else
                {
                    bioPawn.gameObject.SetActive(false);
                }
            }
            if (bioTerrorist.getIsCaptured())
            {
                //Debug.Log("Captured bioterrorist");
                bioPawn.gameObject.SetActive(true);
                bioPawn.transform.GetChild(0).gameObject.SetActive(true);
            }
            else
            {
                bioPawn.transform.GetChild(0).gameObject.SetActive(false);
            }
        }
        else
        {
            basicOperationPanel.gameObject.SetActive(true);
            movePanel.gameObject.SetActive(true);
        }
        if (me.getRoleKind() == RoleKind.BioTerrorist && (me == currentPlayer) && (game.getCurrentPhase() == GamePhase.PlayerTakeTurn))
        {
            BioTerrorist bio = game.getBioTerrorist();
            if (((me.getRemainingAction() > 0) || !(bio.getBioTerroristExtraDriveUsed())) && !bio.getIsCaptured())
            {
                moveButton.GetComponent <Button>().interactable = true;
            }
            else
            {
                moveButton.GetComponent <Button>().interactable = false;
            }
            if (me.getRemainingAction() > 0)
            {
                drawButton.GetComponent <Button>().interactable = true;
                if (!bio.getIsCaptured())
                {
                    infectButton.GetComponent <Button>().interactable = true;
                    if (currentCity.getHasResearch())
                    {
                        foreach (PlayerCard card in currentPlayer.getHand())
                        {
                            if (card.getType() == CardType.InfectionCard)
                            {
                                InfectionCard cityCard = (InfectionCard)card;
                                if (cityCard.getColor() == currentCity.getColor())
                                {
                                    sabotageButton.GetComponent <Button>().interactable = true;
                                }
                            }
                        }
                    }
                    escapeButton.GetComponent <Button>().interactable = false;
                }
                else if (bio.getIsCaptured())
                {
                    infectButton.GetComponent <Button>().interactable   = false;
                    sabotageButton.GetComponent <Button>().interactable = false;
                    if (currentPlayer.containsInfectionCard())
                    {
                        escapeButton.GetComponent <Button>().interactable = true;
                    }
                    else
                    {
                        escapeButton.GetComponent <Button>().interactable = false;
                    }
                }
            }
            else
            {
                drawButton.GetComponent <Button>().interactable     = false;
                infectButton.GetComponent <Button>().interactable   = false;
                sabotageButton.GetComponent <Button>().interactable = false;
                escapeButton.GetComponent <Button>().interactable   = false;
            }
            passButton.GetComponent <Button>().interactable = true;
        }
        else
        {
            resetAll();
        }
    }