コード例 #1
0
ファイル: KaisenScene.cs プロジェクト: pratikxman/Sengoku2d
    public void getEnemyStsAndMakeInstance(int linkNo, int mapId, float rainMinusRatio, float snowMinusRatio)
    {
        string map     = "emap" + mapId;
        int    busyoId = PlayerPrefs.GetInt(map);

        int activeBusyoLv  = PlayerPrefs.GetInt("activeBusyoLv");
        int activeButaiQty = PlayerPrefs.GetInt("activeButaiQty");
        int activeButaiLv  = PlayerPrefs.GetInt("activeButaiLv");

        StatusGet    sts       = new StatusGet();
        BusyoInfoGet info      = new BusyoInfoGet();
        int          shipId    = info.getShipId(busyoId);
        int          hp        = sts.getHp(busyoId, activeBusyoLv);
        int          atk       = sts.getAtk(busyoId, activeBusyoLv);
        int          dfc       = sts.getDfc(busyoId, activeBusyoLv);
        int          spd       = sts.getSpd(busyoId, activeBusyoLv);
        string       busyoName = sts.getBusyoName(busyoId);
        string       heisyu    = sts.getHeisyu(busyoId);

        int playerBusyoQty = PlayerPrefs.GetInt("jinkeiBusyoQty");

        aveSenpouLv = Mathf.CeilToInt(totalSenpouLv / playerBusyoQty);
        ArrayList senpouArray = sts.getEnemySenpou(busyoId, aveSenpouLv, "");

        //Weather Minus
        if (rainMinusRatio != 0 || snowMinusRatio != 0)
        {
            float tmp = (float)spd * 0.5f;
            if (tmp < 1)
            {
                tmp = 1;
            }
            spd = Mathf.FloorToInt(tmp);
        }

        bool enemyTaisyoFlg = false;

        if (busyoId == enemySoudaisyo)
        {
            enemyTaisyoFlg = true;
        }

        //View Object & pass status to it.
        EnemyInstance inst = new EnemyInstance();

        inst.makeKaisenInstance(mapId, busyoId, shipId, activeButaiLv, heisyu, activeButaiQty, hp, atk, dfc, spd, busyoName, linkNo, enemyTaisyoFlg, senpouArray);
    }
コード例 #2
0
ファイル: Timer.cs プロジェクト: pratikxman/Sengoku2d
    public void enemyEngunInstance(string enemyEngunList, float mntMinusRatio, float seaMinusRatio, float rainMinusRatio, float snowMinusRatio)
    {
        List <string> daimyoEnguniList = new List <string> ();

        char[] delimiterChars  = { ':' };
        char[] delimiterChars2 = { '-' };
        if (enemyEngunList.Contains(":"))
        {
            daimyoEnguniList = new List <string> (enemyEngunList.Split(delimiterChars));
        }
        else
        {
            daimyoEnguniList.Add(enemyEngunList);
        }

        for (int i = 0; i < daimyoEnguniList.Count; i++)
        {
            StatusGet     sts = new StatusGet();
            string        daimyoEngunString = daimyoEnguniList[i];
            List <string> unitEnguniList    = new List <string> ();
            unitEnguniList = new List <string> (daimyoEngunString.Split(delimiterChars2));
            int    busyoId = int.Parse(unitEnguniList[1]);
            string heisyu  = sts.getHeisyu(busyoId);

            if (busyoId != 0)
            {
                int busyoLv  = int.Parse(unitEnguniList[2]);
                int butaiQty = int.Parse(unitEnguniList[3]);
                int butaiLv  = int.Parse(unitEnguniList[4]);

                int    hp        = sts.getHp(busyoId, busyoLv);
                int    atk       = sts.getAtk(busyoId, busyoLv);
                int    dfc       = sts.getDfc(busyoId, busyoLv);
                int    spd       = sts.getSpd(busyoId, busyoLv);
                string busyoName = sts.getBusyoName(busyoId);

                int aveSenpouLv = 0;
                if (Application.loadedLevelName != "kaisen")
                {
                    aveSenpouLv = GameObject.Find("GameScene").GetComponent <GameScene> ().aveSenpouLv;
                }
                else
                {
                    aveSenpouLv = GameObject.Find("GameScene").GetComponent <KaisenScene>().aveSenpouLv;
                }
                ArrayList senpouArray = sts.getEnemySenpou(busyoId, aveSenpouLv, "");


                if (mntMinusRatio != 0)
                {
                    if (heisyu == "KB")
                    {
                        float tmp = (float)spd * mntMinusRatio;
                        if (tmp < 1)
                        {
                            tmp = 1;
                        }
                        spd = Mathf.FloorToInt(tmp);
                    }
                }
                else if (seaMinusRatio != 0)
                {
                    if (heisyu == "TP")
                    {
                        float tmp = (float)dfc * seaMinusRatio;
                        if (tmp < 1)
                        {
                            tmp = 1;
                        }
                        dfc = Mathf.FloorToInt(tmp);
                    }
                    else if (heisyu == "YM")
                    {
                        float tmp = (float)dfc * seaMinusRatio;
                        if (tmp < 1)
                        {
                            tmp = 1;
                        }
                        dfc = Mathf.FloorToInt(tmp);
                    }
                }
                if (rainMinusRatio != 0)
                {
                    if (heisyu == "TP")
                    {
                        float tmp = (float)atk * rainMinusRatio;
                        if (tmp < 1)
                        {
                            tmp = 1;
                        }
                        atk = Mathf.FloorToInt(tmp);
                    }
                    else if (heisyu == "YM")
                    {
                        float tmp = (float)atk * rainMinusRatio;
                        if (tmp < 1)
                        {
                            tmp = 1;
                        }
                        atk = Mathf.FloorToInt(tmp);
                    }
                }
                else if (snowMinusRatio != 0)
                {
                    float tmp = (float)spd * 0.5f;
                    if (tmp < 1)
                    {
                        tmp = 1;
                    }
                    spd = Mathf.FloorToInt(tmp);

                    if (heisyu == "TP")
                    {
                        float tmp2 = (float)atk * snowMinusRatio;
                        if (tmp2 < 1)
                        {
                            tmp2 = 1;
                        }
                        atk = Mathf.FloorToInt(tmp2);
                    }
                    else if (heisyu == "YM")
                    {
                        float tmp2 = (float)atk * snowMinusRatio;
                        if (tmp2 < 1)
                        {
                            tmp2 = 1;
                        }
                        atk = Mathf.FloorToInt(tmp2);
                    }
                    else if (heisyu == "KB")
                    {
                        float tmp2 = (float)dfc * snowMinusRatio;
                        if (tmp2 < 1)
                        {
                            tmp2 = 1;
                        }
                        dfc = Mathf.FloorToInt(tmp2);
                    }
                }

                //View Object & pass status to it.
                EnemyInstance inst    = new EnemyInstance();
                BusyoInfoGet  info    = new BusyoInfoGet();
                string        ch_type = info.getHeisyu(busyoId);
                int           mapId   = 22;

                if (Application.loadedLevelName != "kaisen")
                {
                    inst.makeInstance(mapId, busyoId, butaiLv, ch_type, butaiQty, hp, atk, dfc, spd, busyoName, 0, false, senpouArray, "");
                }
                else
                {
                    BusyoInfoGet busyoScript = new BusyoInfoGet();
                    int          shipId      = busyoScript.getShipId(busyoId);
                    inst.makeKaisenInstance(mapId, busyoId, shipId, butaiLv, ch_type, butaiQty, hp, atk, dfc, spd, busyoName, 0, false, senpouArray);
                }
            }
        }
        Message msg = new Message();

        msg.makeKassenMessage(msg.getMessage(131));
    }