Ejemplo n.º 1
0
    void OnMouseDown()
    {
        if (InGame == true && PlayerManager.GetInst().Players[PlayerManager.GetInst().CurTurnIdx].act != ACT.STUN)
        {
            if (CostManager.GetInst().cur_cost_num >= cost)
            {
                if (On_active == true)
                {
                    PlayerBase pb = PlayerManager.GetInst().Players[PlayerManager.GetInst().CurTurnIdx];
                    Manager.GetInst().MoveCamPosToTile(pb.CurHex);
                    PlayerManager.GetInst().HilightSummons();

                    act = ACT.SUMMONES;
                    CostManager.GetInst().CostDecrease(cost);
                    On_active = false;
                }
            }
        }
        else
        {
            if (PlayerManager.GetInst().Players[PlayerManager.GetInst().CurTurnIdx].act != ACT.STUN)
            {
                CardLoadManager.GetInst().OnCard(summon_id);
            }
        }
    }
Ejemplo n.º 2
0
    void OnMouseDown()
    {
        if (InGame == true && PlayerManager.GetInst().Players[PlayerManager.GetInst().CurTurnIdx].act != ACT.STUN)
        {
            if (CostManager.GetInst().cur_cost_num >= cost)
            {
                if (On_active == true)
                {
                    if (magic_id == 2 || magic_id == 6)
                    {
                        magic.GetInst().type = "water";
                    }
                    else if (magic_id == 3)
                    {
                        magic.GetInst().type = "wall";
                        Debug.Log("fire");
                    }
                    else if (magic_id == 4)
                    {
                        magic.GetInst().type = "wind";
                    }
                    else if (magic_id == 1 || magic_id == 7)
                    {
                        magic.GetInst().type = "fire";
                    }
                    else
                    {
                        magic.GetInst().type = "buff";
                    }

                    magic.GetInst().curmagic_id = magic_id;
                    PlayerBase pb = PlayerManager.GetInst().Players[PlayerManager.GetInst().CurTurnIdx];
                    Manager.GetInst().MoveCamPosToTile(pb.CurHex);
                    PlayerManager.GetInst().Players[PlayerManager.GetInst().CurTurnIdx].act = ACT.MAGIC;
                    CostManager.GetInst().Curcostnum = cost;
                    Debug.Log(CostManager.GetInst().Curcostnum);
                    if (magic_id == 3)
                    {
                        MapManager.GetInst().HilightAttackRange(pb.CurHex, 2);
                    }
                    else
                    {
                        MapManager.GetInst().HilightAttackRange(pb.CurHex, 4);
                    }
                    On_click = true;
                }
            }
        }
        else
        {
            Debug.Log("Dww");
            if (PlayerManager.GetInst().Players[PlayerManager.GetInst().CurTurnIdx].act != ACT.STUN)
            {
                CardLoadManager.GetInst().OnCard(magic_id);
            }
        }
    }
Ejemplo n.º 3
0
 // Use this for initialization
 void Awake()
 {
     inst = this;
     //SetCardSize();
     inst.Cards[0] = (GameObject)Resources.Load("Prefabs/card/emptycard");
     inst.Cards[1] = (GameObject)Resources.Load("Prefabs/card/fire");
     inst.Cards[2] = (GameObject)Resources.Load("Prefabs/card/water");
     inst.Cards[3] = (GameObject)Resources.Load("Prefabs/card/wall");
     inst.Cards[4] = (GameObject)Resources.Load("Prefabs/card/summon2");
     inst.Cards[5] = (GameObject)Resources.Load("Prefabs/card/bunny");
     inst.Cards[6] = (GameObject)Resources.Load("Prefabs/card/croco");
     butnum        = 0;
 }
Ejemplo n.º 4
0
    public void SaveCardData()
    {
        XmlDocument xmlFile = new XmlDocument();

        xmlFile.AppendChild(xmlFile.CreateXmlDeclaration("1.0", "utf-8", "yes"));
        XmlNode rootNode = xmlFile.CreateNode(XmlNodeType.Element, "MapInfo", string.Empty);

        xmlFile.AppendChild(rootNode);

        CardLoadManager cm = CardLoadManager.GetInst();

        int        MapSizeX = cm.MapSizeX;
        int        MapSizeY = cm.MapSizeY;
        XmlElement size     = xmlFile.CreateElement("MapSize");

        size.InnerText = MapSizeX + " " + MapSizeY;
        rootNode.AppendChild(size);
        for (int x = 0; x <= MapSizeX; x++)
        {
            for (int y = 0; y <= MapSizeY; y++)
            {
                XmlNode hexNode = xmlFile.CreateNode(XmlNodeType.Element, "card", string.Empty);
                rootNode.AppendChild(hexNode);

                XmlElement  mapPos = xmlFile.CreateElement("CardPos");
                CardUseBase card   = cm.cardUse[x][y];
                mapPos.InnerText = card.X + " " + card.Y + " " + card.card_id;
                hexNode.AppendChild(mapPos);
            }
        }

        Debug.Log("saveed");
        if (Application.platform == RuntimePlatform.Android)
        {
            TextAsset textAsset = Resources.Load("XML/" + "cardtest") as TextAsset;
            xmlFile.Save(textAsset.text);
        }
        else
        {
            xmlFile.Save("Assets/StreamingAssets/cardtest.xml");
        }
    }