void Update()
    {
        if (!flag)
        {
            transform.SetParent(GameObject.Find("Canvas").transform);
            turnEndText          = GameObject.Find("TurnEnd").transform.GetChild(0).gameObject;
            transform.localScale = new Vector3(0.435f, 0.435f, 1);
            flag = true;
        }

        if (isLocalPlayer)
        {
            isPlayer = true;
            transform.localPosition = new Vector3(-577f, -300f, 0);
        }
        else
        {
            transform.localPosition = new Vector3(-577f, 300f, 0);
        }

        if (!turnAssignFlag)
        {
            if (isPlayer && isHost)
            {
                int check = getPlayers();
                if (check == 2)
                {
                    Cmdspawn_meditator();
                    assignTurn();
                    turnAssignFlag = true;
                }
            }
        }

        if (isPlayer)
        {
            if (getMeditator())
            {
                scr_meditator inv = med.GetComponent <scr_meditator>();
                myturn = (inv.getTurn() == isHost);
                if (sav_myturn != myturn)
                {
                    sav_myturn = myturn;
                    if (myturn)
                    {
                        inv.createParticle(0, Vector3.zero, -1);
                        if (inv.turnCnt != 0)
                        {
                            gameObject.GetComponent <scr_playerInGame>().drawCard();
                            gameObject.GetComponent <scr_playerIdentity>().CmdgainTerial();
                        }
                    }
                }
            }
            turnEndText.GetComponent <Text>().text = (myturn) ? "턴 종료" : "상대 턴";
        }
    }
Beispiel #2
0
    public void OnPointerEnter(PointerEventData eventData)
    {
        scr_playerIdentity   data  = sav_parent.GetComponent <scr_playerIdentity>();
        scr_playerController data2 = sav_parent.GetComponent <scr_playerController>();
        scr_meditator        med   = GameObject.FindGameObjectWithTag("Meditator").GetComponent <scr_meditator>();

        if (data2.myturn && med.turnCnt != data.sav_turn && data.terial >= 2)
        {
            gameObject.GetComponent <SpriteRenderer>().color = new Color(1f, 1f, 1f, 1f);
            onMouse = true;
        }
    }
    public void CmdforAllSpell(bool hosts, string id, int cost)
    {
        bool used = true;

        switch (id)
        {
        case "#vitality":
            foreach (GameObject cur in GameObject.FindGameObjectsWithTag("Unit"))
            {
                scr_unit data = cur.GetComponent <scr_unit>();
                if (data.hosts == hosts && data.card_tag.Contains("Earth"))
                {
                    data.CmdgetSelfStatus(0, 2);
                }
            }
            break;

        case "#luminous_grail":
            CmdGainStatusExtended(hosts, 0, 3, 3);
            break;

        case "#dark_token":
            RpcGaincard(hosts, "daki");
            RpcGaincard(hosts, "daki");
            break;

        case "#blood_storm":
            int temp_cnt = 0;
            foreach (GameObject cur in GameObject.FindGameObjectsWithTag("Unit"))
            {
                scr_unit data = cur.GetComponent <scr_unit>();
                if (data.hosts != hosts)
                {
                    temp_cnt++;
                }
            }
            if (temp_cnt >= 4)
            {
                foreach (GameObject cur in GameObject.FindGameObjectsWithTag("Unit"))
                {
                    scr_unit data = cur.GetComponent <scr_unit>();
                    data.CmdDamage(cur, 3);
                }
            }
            else
            {
                foreach (GameObject cur in GameObject.FindGameObjectsWithTag("Unit"))
                {
                    scr_unit data = cur.GetComponent <scr_unit>();
                    data.CmdDamage(cur, 1);
                }
            }
            break;

        case "#volcano":
            CmdSetEnvironment("volcano");
            break;

        case "#dimension_summon":
            ArrayList temp_table = new ArrayList();
            foreach (string cardId in DB_card.collectible)
            {
                if (!cardId.Contains("#"))
                {
                    temp_table.Add(cardId);
                }
            }
            int drawIndex = Random.Range(0, temp_table.Count);
            CmdGainCard(hosts, (string)temp_table[drawIndex]);
            break;

        case "#tales_river":
            CmdSetEnvironment("tales_1");
            break;

        case "#salvage":
            RpcSelectCard(hosts, id);
            break;

        case "#evolve:SaintResia":
            foreach (GameObject cur in GameObject.FindGameObjectsWithTag("Unit"))
            {
                scr_unit curData = cur.GetComponent <scr_unit>();
                if (curData.hosts == hosts && curData.id == "Resia")
                {
                    curData.CmdCamouflage("Angel_resia");
                }
            }
            break;

        case "#evolve:DarkResia":
            foreach (GameObject cur in GameObject.FindGameObjectsWithTag("Unit"))
            {
                scr_unit curData = cur.GetComponent <scr_unit>();
                if (curData.hosts == hosts && curData.id == "Resia")
                {
                    curData.CmdCamouflage("Dark_resia");
                }
            }
            break;

        case "#nas_breath":
            RpcGaincard(hosts, "nas");
            CmdGainStatus(hosts, 0, 4);
            break;

        case "#assembly":
            RpcSelectCard(hosts, id);
            break;

        case "#initial_shine":
            RpcGaincard(hosts, "draw");
            break;

        case "#dangerous_contact":
            scr_meditator med         = GameObject.FindGameObjectWithTag("Meditator").GetComponent <scr_meditator>();
            int           sav_handCnt = (hosts)? med.serverHandcnt : med.clientHandcnt;
            for (int i = 0; i < 3; i++)
            {
                RpcGaincardExtended(hosts, "draw", "NotDarkRemove");
            }
            if (sav_handCnt != -1)
            {
                if (hosts)
                {
                    if (sav_handCnt == med.serverHandcnt)
                    {
                        RpcGaincardExtended(hosts, "draw", "RemoveAll");
                    }
                }
                else
                {
                    if (sav_handCnt == med.clientHandcnt)
                    {
                        RpcGaincardExtended(hosts, "draw", "RemoveAll");
                    }
                }
            }
            break;

        case "#doll_gathering":
            for (int i = 0; i < 3; i++)
            {
                RpcGaincardExtended(hosts, "doll", "IFINDECK");
            }
            break;

        case "#doll_regression":
            for (int i = 0; i < 3; i++)
            {
                RpcGaincardExtended(hosts, "doll", "TOMBTOHAND");
            }
            RpcGaincard(hosts, "draw");
            break;

        case "#doll_sacrifice":
            foreach (GameObject cur in GameObject.FindGameObjectsWithTag("Unit"))
            {
                scr_unit curData = cur.GetComponent <scr_unit>();
                if (curData.hosts == hosts && (curData.id == "doll" || curData.id == "tetra"))
                {
                    curData.CmdgetSelfStatus(1, 1);
                }
            }
            break;

        case "#wisdom_eye":
            RpcGaincard(hosts, "draw");
            RpcGaincard(hosts, "draw");
            break;

        case "#heal_leaf":
            CmdGainStatus(hosts, 0, 8);
            break;

        case "#earthquake":
            foreach (GameObject cur in GameObject.FindGameObjectsWithTag("Unit"))
            {
                scr_unit data = cur.GetComponent <scr_unit>();
                if (!data.card_tag.Contains("Earth"))
                {
                    data.CmdDamage(cur, 2);
                }
            }
            break;

        case "#luminous_badge":
            CmdSetEnvironment("luminous_badge");
            break;

        case "#Archmage_rune":
            CmduseTerial(cost);
            CmdSetEnvironment("archmage_rune");
            break;

        case "#union_roar":
            CmdSelectCard(hosts, id);
            break;

        case "#ren_wakeup":
            foreach (GameObject cur in GameObject.FindGameObjectsWithTag("Unit"))
            {
                cur.GetComponent <scr_unit>().CmdDamage(cur, 5);
            }
            break;

        case "#halfmoon_strike":
            foreach (GameObject cur in GameObject.FindGameObjectsWithTag("Unit"))
            {
                scr_unit curData = cur.GetComponent <scr_unit>();
                if (curData.hosts != hosts)
                {
                    curData.CmdDamage(cur, 6);
                }
            }
            RpcGaincard(hosts, "draw");
            RpcGaincard(hosts, "draw");
            break;

        case "#latien_prelude":
            RpcGaincard(hosts, "draw");
            RpcGaincard(hosts, "draw");
            break;

        case "#latien_choir":
            foreach (GameObject cur in GameObject.FindGameObjectsWithTag("Unit"))
            {
                scr_unit curData = cur.GetComponent <scr_unit>();
                if (curData.hosts == hosts)
                {
                    curData.CmdgetSelfStatus(2, 2);
                }
            }
            break;

        case "#latien_fantasia":
            RpcSelectCard(hosts, id);
            break;

        case "#latien_lyrics":
            foreach (GameObject cur in GameObject.FindGameObjectsWithTag("Unit"))
            {
                scr_unit curData = cur.GetComponent <scr_unit>();
                if (curData.hosts != hosts)
                {
                    curData.CmdDamage(cur, 3);
                }
            }
            break;

        default:
            break;
        }
        CmduseTerial(cost);
        if (used)
        {
            RpcUseSpell(hosts, id);
        }
    }