示例#1
0
    void Update()
    {
        if (!IsGameOver())
        {     // if there is no CountDown
            if (!ui.CountDown())
            { // checks game over
                IsGameOver();
                if (cardHolder.IsReleaseOver())
                {     // if the release animation is over
                    if (!cardHolder.IsCanceled())
                    { // & attack is not canceled: deal damage
                        int damage = cardHolder.TotalDamage();
                        opponent.UpdateHealth(damage);
                        photonView.RPC("UpdateHealth", PhotonTargets.Others, damage);
                        player.lastDamage = damage;
                        ui.UpdateOpponentHealthBar(opponent.health);
                    }
                    // init cardholder with a card
                    cardHolder.Init();
                    ui.NewTagCloud();
                }

                // if some card is active
                if (cardHolder.IsInputReady())
                {   // listen to input
                    InputListener.Listen(true);
                    if (Input.GetKeyDown("return") && cardHolder.IsReleaseReady())
                    {
                        InputListener.Listen(false);
                        string newTag = InputListener.GetInput();
                        if (player.lastTag == "")
                        {
                            player.lastTag = "nothing_here";
                        }
                        StartCoroutine(QueryManager.QueryDamageDistribution(newTag, player.lastTag, player.lastDamage, OnResponce));
                        ui.RemoveTagCloud();
                        player.lastTag = newTag;
                    }
                }
                else
                {   // Cancel or Release attack
                    cardHolder.HandleAttack();
                }
            }
        }
        else
        {
            gameOver = true;
            if (!disconnected)
            {
                photonView.RPC("GameOver", PhotonTargets.All);
            }
            else
            {
                if (ui.ExitGame() || ui.concede)
                {
                    Application.LoadLevel("MainMenu");
                }
            }
        }
    }
示例#2
0
 private void OnResponce()
 {
     cardHolder.LaunchCard(InputListener.GetInput(), QueryManager.GetDistribution());
     // cardholder is no longer input ready
     Debug.Log("CHARGING ATTACK");
 }