コード例 #1
0
 public void perma_weaken()                // enemy targeted spell
 {
     if (spell != castable_spells.nothing) //spell already selected
     {
         Debug.Log("a spell is already selected!");
     }
     else
     {
         int mana_cost = 100;
         if (isPlayer1Turn && player_1_mana >= mana_cost)
         {
             spell          = castable_spells.weaken;
             player_1_mana -= mana_cost;
         }
         if (!isPlayer1Turn && player_2_mana >= mana_cost)
         {
             spell          = castable_spells.weaken;
             player_2_mana -= mana_cost;
         }
         Debug.Log("weaken selected" + player_1_mana + " " + player_2_mana);
         //update mana texts.
         text_1.text = "Player 1 Mana : " + player_1_mana.ToString();
         text_2.text = "Player 2 Mana : " + player_2_mana.ToString();
     }
 }
コード例 #2
0
 public void change_color()                // ally team targeted spell
 {
     if (spell != castable_spells.nothing) //spell already selected
     {
         Debug.Log("a spell is already selected!");
     }
     else
     {
         int mana_cost = 10;
         if (isPlayer1Turn && player_1_mana >= mana_cost)
         {
             spell          = castable_spells.change_color;
             player_1_mana -= mana_cost;
         }
         if (!isPlayer1Turn && player_2_mana >= mana_cost)
         {
             spell          = castable_spells.change_color;
             player_2_mana -= mana_cost;
         }
         Debug.Log("change color selected" + player_1_mana + " " + player_2_mana);
         //update mana texts.
         text_1.text = "Player 1 Mana : " + player_1_mana.ToString();
         text_2.text = "Player 2 Mana : " + player_2_mana.ToString();
     }
 }