Ejemplo n.º 1
0
 public void Summon(int pos, bool this_myEnermy, bool F, bool B, bool L, bool R, string summon_index)
 {
     Debug.Log(chess_map.Check_Pos(pos + 1));
     if (chess_map.Check_Pos(pos + 1) == true && R == true)
     {
         GameObject min = chess_map.chess_map[pos + 1];
         gm.What_Card_Select = summon_index;
         gm.pos = min;
         gm.Create_minions(0, true);
     }
     if (chess_map.Check_Pos(pos - 1) == true && L == true)
     {
         GameObject min = chess_map.chess_map[pos - 1];
         gm.What_Card_Select = summon_index;
         gm.pos = min;
         gm.Create_minions(0, true);
     }
     if (chess_map.Check_Pos(pos + 5) == true && F == true)
     {
         GameObject min = chess_map.chess_map[pos + 5];
         gm.What_Card_Select = summon_index;
         gm.pos = min;
         gm.Create_minions(0, true);
     }
     if (chess_map.Check_Pos(pos - 5) == true && B == true)
     {
         GameObject min = chess_map.chess_map[pos - 5];
         gm.What_Card_Select = summon_index;
         gm.pos = min;
         gm.Create_minions(0, true);
     }
 }
Ejemplo n.º 2
0
 public void Use_card(int pos)
 {
     if (Hand.Count > 0)
     {
         gm.What_Card_Select = Hand[pos];
         gm.pos = this.pos[Random.Range(0, 10)];
         if (Deck_List_swap[0] == "001")
         {
             if (gm.Create_minions(card_Status[0].Mana, false) == true)
             {
                 Hand.RemoveAt(pos);
             }
         }
         else if (Deck_List_swap[0] == "002")
         {
             if (gm.Create_minions(card_Status[1].Mana, false) == true)
             {
                 Hand.RemoveAt(pos);
             }
         }
         else if (Deck_List_swap[0] == "003")
         {
             if (gm.Create_minions(card_Status[2].Mana, false) == true)
             {
                 Hand.RemoveAt(pos);
             }
         }
         else if (Deck_List_swap[0] == "004")
         {
             if (gm.Create_minions(card_Status[2].Mana, false) == true)
             {
                 Hand.RemoveAt(pos);
             }
         }
         else if (Deck_List_swap[0] == "005")
         {
             if (gm.Create_minions(card_Status[2].Mana, false) == true)
             {
                 Hand.RemoveAt(pos);
             }
         }
     }
 }
Ejemplo n.º 3
0
    // Update is called once per frame
    void Update()
    {
        float dis_f  = Vector2.Distance(this.transform.position, pos1.transform.position);
        float dis_f2 = Vector2.Distance(this.transform.position, pos2.transform.position);

        if (dis_f2 > 1 && Input.GetMouseButton(0))
        {
            sprite_ren.GetComponent <SpriteRenderer>().enabled = false;
            col.GetComponent <PolygonCollider2D>().enabled     = false;
            Mana_t.GetComponent <Text>().enabled    = false;
            Hp_t.GetComponent <Text>().enabled      = false;
            ability_t.GetComponent <Text>().enabled = false;
        }
        else if ((dis_f < 2) || (dis_f2 < 2))
        {
            sprite_ren.GetComponent <SpriteRenderer>().enabled = true;
            col.GetComponent <PolygonCollider2D>().enabled     = true;
            Mana_t.GetComponent <Text>().enabled    = true;
            Hp_t.GetComponent <Text>().enabled      = true;
            ability_t.GetComponent <Text>().enabled = true;
        }
        if (Input.GetMouseButton(0) && mouse_on_card == true)
        {
            mousePosition      = Input.mousePosition;
            mousePosition      = Camera.main.ScreenToWorldPoint(mousePosition);
            transform.position = Vector2.Lerp(transform.position, mousePosition, moveSpeed);
        }
        if (Input.GetMouseButtonUp(0) && mouse_on_card == true)
        {
            gm.What_Card_Select = card_index;
            if (gm.Create_minions(card_Status.Mana, true) == true)
            {
                deck.Use_card(Hand_pos);
                Destroy(this.gameObject);
            }
            this.gameObject.transform.position = pos1.transform.position;
            mouse_on_card = false;
        }
        if (mouse_on_card == false)
        {
            Move1();
        }
    }