Exemplo n.º 1
0
    public void AttackPlayer(V_Card card, playerTypes who)
    {
        if (who == playerTypes.Player)
        {
            GameObject targetPlayer = GameObject.FindGameObjectWithTag("Player");
            card.cActions.UseToPlayer(targetPlayer);
        }

        if (who == playerTypes.AI)
        {
            GameObject targetPlayer = GameObject.FindGameObjectWithTag("AIPlayer");
            card.cActions.UseToPlayer(targetPlayer);
        }
    }
Exemplo n.º 2
0
    V_GameManager gm;           // For accessing non-static variables in game manager

    // Use this for initialization
    void Start()
    {
        // DontDestroyOnLoad(gameObject); //its always here

        // }
        //if broken revert to an awake function. MAKE SURE TO CALL!!
        //public void EnterGame(){
        // References:
        p  = FindObjectOfType <V_PlayerHandler>();
        gm = FindObjectOfType <V_GameManager> ();
        // Set the player's starting life and energy:
        V_PlayerHandler.health = startingHealth;
        V_PlayerHandler.energy = startingEnergy;
        V_AI.health            = startingHealth;
        V_AI.energy            = startingEnergy;

        sEnergy = startingEnergy;
        iEnergy = increasingEnergy;
        //need to add handlers for multiple new zones
        battleZone    = battleZoneHandler;
        spellZone     = spellZoneHandler;
        handZone      = handZoneHandler;
        gameArea      = gameAreaHandler;
        graveZone     = graveZoneHandler;
        aiBattleZone  = aiBattleZoneHandler;
        aiSpellZone   = aiSpellZoneHandler;
        aiAvatarZone  = aiAvatarHandler;
        aigraveZone   = aigraveZoneHandler;
        avatarZone    = avatarHandler;
        sdamageEffect = damageEffect;
        shealEffect   = healEffect;

        if (drawCostText != null)
        {
            drawCostText.text = drawCost.ToString();
        }

        // Draw the first hand cards:
        playerTurn    = playerTypes.Player;
        p.gm          = this;
        CardGameState = currentState.draw;
        //this is what we need to use to set the health to the size of the deck. we can disable it for now.
        // V_PlayerHandler.health = p.myDeck.Length;
        //p.StartDraw ();//we can disable this for now. if we have effects that only trigger in starting hand we can readd.
        for (int i = 0; i < startinghand; i++)
        {
            p.DrawOneCard();
        }
    }
Exemplo n.º 3
0
    // This is called when a player hits the "End Turn" button:
    public void ChangeTurn(playerTypes type)
    {
        //modify this to create the stages of a turn. this is the recharge step. players can draw up to 2 cards and their energy becomes 5. now its talking about the players turn. we will edit this first.
        warentered = false;
        if (type == playerTypes.AI)
        {
            CardGameState         = currentState.begin;
            allowIncreasingEnergy = true;
            playerTurn            = playerTypes.Player;
            gm.endTurnBTN.SetActive(true);
            gm.DrawBTN.SetActive(true);
            RefreshField();

            //check for begin turn effects here

            CardGameState = currentState.recharge;

            if (allowIncreasingEnergy)
            {
                V_PlayerHandler.energy = refreshedEnergy;
                //V_PlayerHandler.AddEnergy (iEnergy);
            }
            if (handZone.transform.childCount > 7)
            {
                //make players discard down to 7 cards.
            }
            V_GameManager.CardGameState = V_GameManager.currentState.draw;
            //////////////////////////////////////
            //now its talking about the AI turn. lets ignore this for now.
        }
        else if (type == playerTypes.Player)
        {
            CardGameState = currentState.begin;
            CardGameState = currentState.recharge;
            if (allowIncreasingEnergy)
            {
                V_AI.energy = 5;//EffectAddEnergy (iEnergy);
            }
            allowIncreasingEnergy       = true;
            playerTurn                  = playerTypes.AI;
            V_GameManager.CardGameState = V_GameManager.currentState.draw;
            RefreshField();
            //         GameObject[] obj = GameObject.FindGameObjectsWithTag ("AIOwned");
            //foreach (GameObject o in obj) {
            //	o.GetComponent<V_CardActions> ().isUsed = false;
            //}
            V_GameManager.CardGameState = V_GameManager.currentState.action;
        }
    }
Exemplo n.º 4
0
 // This is called when a player hits the "End Turn" button:
 public static void ChangeTurn(playerTypes type)
 {
     if (type == playerTypes.AI)
     {
         if (allowIncreasingEnergy)
         {
             V_PlayerHandler.AddEnergy(iEnergy);
         }
         // Draw 1 free card if Hand Zone is'nt full:
         if (handZone.transform.childCount < 4)
         {
             V_PlayerHandler player = GameObject.FindGameObjectWithTag("PlayerHandler").GetComponent <V_PlayerHandler> ();
             player.DrawOneCard();
         }
         //
         allowIncreasingEnergy = true;
         playerTurn            = playerTypes.Us;
         V_GameManager gm = GameObject.FindGameObjectWithTag("GameController").GetComponent <V_GameManager> ();
         gm.endTurnBTN.SetActive(true);
         gm.DrawBTN.SetActive(true);
         GameObject[] obj = GameObject.FindGameObjectsWithTag("PlayerOwned");
         foreach (GameObject o in obj)
         {
             o.GetComponent <V_CardActions> ().isUsed = false;
         }
     }
     else if (type == playerTypes.Us)
     {
         if (allowIncreasingEnergy)
         {
             V_AI.EffectAddEnergy(iEnergy);
         }
         allowIncreasingEnergy = true;
         playerTurn            = playerTypes.AI;
         GameObject[] obj = GameObject.FindGameObjectsWithTag("AIOwned");
         foreach (GameObject o in obj)
         {
             o.GetComponent <V_CardActions> ().isUsed = false;
         }
     }
     turn++;
 }