Пример #1
0
    public void OnClick()
    {
        AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource>();
        audioSources[0].Play();

        GameObject canvas = null;

        if (Application.loadedLevelName == "busyo" || Application.loadedLevelName == "mainStage" || Application.loadedLevelName == "touyou" || Application.loadedLevelName == "zukan" || Application.loadedLevelName == "tutorialTouyou" || Application.loadedLevelName == "hyojyo" || Application.loadedLevelName == "tutorialHyojyo" || Application.loadedLevelName == "pvp")
        {
            canvas = GameObject.Find("Panel").gameObject;
        }

        string text = "";

        if (!serihuFlg)
        {
            Entity_icon_exp_mst iconExpMst = Resources.Load("Data/icon_exp_mst") as Entity_icon_exp_mst;
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                text = iconExpMst.param[IconId - 1].expEng;
            }
            else
            {
                text = iconExpMst.param[IconId - 1].exp;
            }
        }
        else
        {
            Entity_serihu_mst serihuMst = Resources.Load("Data/serihu_mst") as Entity_serihu_mst;
            string            busyoId   = GameObject.Find("GameScene").GetComponent <NowOnBusyo>().OnBusyo;
            int rdmId = UnityEngine.Random.Range(0, 2);
            if (rdmId == 0)
            {
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    text = serihuMst.param[int.Parse(busyoId) - 1].touyouMsgEng;
                }
                else
                {
                    text = serihuMst.param[int.Parse(busyoId) - 1].touyouMsg;
                }
            }
            else
            {
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    text = serihuMst.param[int.Parse(busyoId) - 1].senpouMsgEng;
                }
                else
                {
                    text = serihuMst.param[int.Parse(busyoId) - 1].senpouMsg;
                }
            }
        }

        Message msg = new Message();

        msg.makeIconExpMessage(text, canvas);
    }
Пример #2
0
    public void makeInstance(int mapId, int busyoId, int lv, string ch_type, int ch_num, int hp, int atk, int dfc, int spd, string busyoName, int linkNo, bool taisyo, ArrayList senpouArray, string kahouList)
    {
        /*Roujyo Start*/
        bool       shiroFlg    = false;
        bool       torideFlg   = false;
        GameObject buildingObj = null;
        bool       pvpFlg      = GameObject.Find("GameScene").GetComponent <GameScene>().pvpFlg;

        if (!pvpFlg)
        {
            string eSRMap = "eSRMap" + mapId.ToString();
            shiroFlg = PlayerPrefs.GetBool(eSRMap);
            PlayerPrefs.DeleteKey(eSRMap);

            if (!shiroFlg)
            {
                string eTRMap = "eTRMap" + mapId.ToString();
                torideFlg = PlayerPrefs.GetBool(eTRMap);
                PlayerPrefs.DeleteKey(eTRMap);
            }

            if (shiroFlg)
            {
                string objPath = "Prefabs/Kassen/eShiro";
                buildingObj = Instantiate(Resources.Load(objPath)) as GameObject;
                buildingObj.transform.localScale = new Vector2(2, 1.5f);
                setEnemyObjectOnMap(mapId, buildingObj);
                buildingObj.name = "shiro";

                string stageName = PlayerPrefs.GetString("activeStageName");
                buildingObj.transform.FindChild("BusyoDtlEnemy").transform.FindChild("NameLabel").GetComponent <TextMesh> ().text = stageName;

                //HP
                int    powerType = PlayerPrefs.GetInt("activePowerType");
                string Type      = "";
                if (powerType == 1)
                {
                    Type = "s";
                }
                else if (powerType == 2)
                {
                    Type = "m";
                }
                else if (powerType == 3)
                {
                    Type = "l";
                }
                string imagePath = "Prefabs/Naisei/Shiro/Sprite/shiro_" + Type;
                buildingObj.GetComponent <SpriteRenderer> ().sprite =
                    Resources.Load(imagePath, typeof(Sprite)) as Sprite;
            }
            else
            {
                if (torideFlg)
                {
                    string objPath = "Prefabs/Kassen/eToride";
                    buildingObj = Instantiate(Resources.Load(objPath)) as GameObject;
                    buildingObj.transform.localScale = new Vector2(3, 3);
                    setEnemyObjectOnMap(mapId, buildingObj);
                    buildingObj.name = "toride";

                    //HP
                    int    powerType = PlayerPrefs.GetInt("activePowerType");
                    string Type      = "";
                    if (powerType == 1)
                    {
                        Type = "s";
                    }
                    else if (powerType == 2)
                    {
                        Type = "m";
                    }
                    else if (powerType == 3)
                    {
                        Type = "l";
                    }

                    string imagePath = "Prefabs/Kassen/kassenTrd_" + Type;
                    buildingObj.GetComponent <SpriteRenderer> ().sprite =
                        Resources.Load(imagePath, typeof(Sprite)) as Sprite;
                }
            }
        }
        /*Roujyo End*/


        string     path   = "Prefabs/Player/" + busyoId;
        GameObject prefab = Instantiate(Resources.Load(path)) as GameObject;

        prefab.name = busyoId.ToString();

        /**Player to Enemy**/
        Vector3 scale = prefab.transform.localScale;
        float   x     = prefab.transform.localScale.x;

        scale.x = scale.x * -1;
        prefab.transform.localScale = scale;
        Destroy(prefab.GetComponent <PlayerHP>());
        prefab.AddComponent <EnemyHP>();
        Destroy(prefab.GetComponent <Kunkou>());
        Destroy(prefab.GetComponent <UnitMover>());
        if (prefab.GetComponent <PlayerAttack>())
        {
            Destroy(prefab.GetComponent <PlayerAttack>());
            prefab.AddComponent <EnemyAttack>();
            prefab.AddComponent <Homing>();
        }
        else
        {
            prefab.AddComponent <HomingLong>();
            if (ch_type == "YM")
            {
                prefab.GetComponent <AttackLong>().bullet = Resources.Load("Prefabs/Enemy/EnemyArrow") as GameObject;
            }
            else
            {
                prefab.GetComponent <AttackLong>().bullet = Resources.Load("Prefabs/Enemy/EnemyBullet") as GameObject;
            }
        }
        prefab.tag   = "Enemy";
        prefab.layer = LayerMask.NameToLayer("Enemy");
        /**Player to Enemy End**/



        //Senpou Script Parametor
        StatusGet senpouScript = new StatusGet();
        bool      onlySeaFlg   = senpouScript.getSenpouOnlySeaFlg((int)senpouArray[0]);

        if (!onlySeaFlg)
        {
            prefab.GetComponent <SenpouController>().senpouId     = (int)senpouArray[0];
            prefab.GetComponent <SenpouController>().senpouTyp    = senpouArray[1].ToString();
            prefab.GetComponent <SenpouController>().senpouName   = senpouArray[2].ToString();
            prefab.GetComponent <SenpouController>().senpouEach   = (float)senpouArray[4];
            prefab.GetComponent <SenpouController>().senpouRatio  = (float)senpouArray[5];
            prefab.GetComponent <SenpouController>().senpouTerm   = (float)senpouArray[6];
            prefab.GetComponent <SenpouController>().senpouStatus = (int)senpouArray[7];
            prefab.GetComponent <SenpouController>().senpouLv     = (int)senpouArray[8];
            //Serihu
            Entity_serihu_mst serihuMst = Resources.Load("Data/serihu_mst") as Entity_serihu_mst;
            string            serihu    = "";
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                serihu = serihuMst.param[busyoId - 1].senpouMsgEng;
            }
            else
            {
                serihu = serihuMst.param[busyoId - 1].senpouMsg;
            }
            prefab.GetComponent <SenpouController>().senpouSerihu = serihu;
        }
        else
        {
            Destroy(prefab.GetComponent <SenpouController>());
        }

        //Busyo Detail Info [Name & HP Bar]
        string dtlPath = "";

        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            dtlPath = "Prefabs/BusyoDtl/BusyoDtlEnemyEng";
        }
        else
        {
            dtlPath = "Prefabs/BusyoDtl/BusyoDtlEnemy";
        }
        GameObject dtl = Instantiate(Resources.Load(dtlPath)) as GameObject;

        dtl.transform.SetParent(prefab.transform);
        dtl.transform.localPosition = new Vector3(0, 1.3f, -1);
        dtl.transform.localScale    = new Vector3(-1.3f, 1.3f, 0);
        dtl.name = "BusyoDtlEnemy";

        //Name
        GameObject nameLabel = dtl.transform.FindChild("NameLabel").gameObject;

        nameLabel.GetComponent <TextMesh> ().text = busyoName;


        //Location by map id
        if (mapId == 1)
        {
            prefab.transform.position = new Vector2(5, 16);
            prefab.GetComponent <LineLocation>().nowLine = 1;
        }
        else if (mapId == 2)
        {
            prefab.transform.position = new Vector2(20, 16);
            prefab.GetComponent <LineLocation>().nowLine = 1;
        }
        else if (mapId == 3)
        {
            prefab.transform.position = new Vector2(35, 16);
            prefab.GetComponent <LineLocation>().nowLine = 1;
        }
        else if (mapId == 4)
        {
            prefab.transform.position = new Vector2(50, 16);
            prefab.GetComponent <LineLocation>().nowLine = 1;
        }
        else if (mapId == 5)
        {
            prefab.transform.position = new Vector2(65, 16);
            prefab.GetComponent <LineLocation>().nowLine = 1;
        }
        else if (mapId == 6)
        {
            prefab.transform.position = new Vector2(5, 8);
            prefab.GetComponent <LineLocation>().nowLine = 2;
        }
        else if (mapId == 7)
        {
            prefab.transform.position = new Vector2(20, 8);
            prefab.GetComponent <LineLocation>().nowLine = 2;
        }
        else if (mapId == 8)
        {
            prefab.transform.position = new Vector2(35, 8);
            prefab.GetComponent <LineLocation>().nowLine = 2;
        }
        else if (mapId == 9)
        {
            prefab.transform.position = new Vector2(50, 8);
            prefab.GetComponent <LineLocation>().nowLine = 2;
        }
        else if (mapId == 10)
        {
            prefab.transform.position = new Vector2(65, 8);
            prefab.GetComponent <LineLocation>().nowLine = 2;
        }
        else if (mapId == 11)
        {
            prefab.transform.position = new Vector2(5, 0);
            prefab.GetComponent <LineLocation>().nowLine = 3;
        }
        else if (mapId == 12)
        {
            prefab.transform.position = new Vector2(20, 0);
            prefab.GetComponent <LineLocation>().nowLine = 3;
        }
        else if (mapId == 13)
        {
            prefab.transform.position = new Vector2(35, 0);
            prefab.GetComponent <LineLocation>().nowLine = 3;
        }
        else if (mapId == 14)
        {
            prefab.transform.position = new Vector2(50, 0);
            prefab.GetComponent <LineLocation>().nowLine = 3;
        }
        else if (mapId == 15)
        {
            prefab.transform.position = new Vector2(65, 0);
            prefab.GetComponent <LineLocation>().nowLine = 3;
        }
        else if (mapId == 16)
        {
            prefab.transform.position = new Vector2(5, -8);
            prefab.GetComponent <LineLocation>().nowLine = 4;
        }
        else if (mapId == 17)
        {
            prefab.transform.position = new Vector2(20, -8);
            prefab.GetComponent <LineLocation>().nowLine = 4;
        }
        else if (mapId == 18)
        {
            prefab.transform.position = new Vector2(35, -8);
            prefab.GetComponent <LineLocation>().nowLine = 4;
        }
        else if (mapId == 19)
        {
            prefab.transform.position = new Vector2(50, -8);
            prefab.GetComponent <LineLocation>().nowLine = 4;
        }
        else if (mapId == 20)
        {
            prefab.transform.position = new Vector2(65, -8);
            prefab.GetComponent <LineLocation>().nowLine = 4;
        }
        else if (mapId == 21)
        {
            prefab.transform.position = new Vector2(5, -16);
            prefab.GetComponent <LineLocation>().nowLine = 5;
        }
        else if (mapId == 22)
        {
            prefab.transform.position = new Vector2(20, -16);
            prefab.GetComponent <LineLocation>().nowLine = 5;
        }
        else if (mapId == 23)
        {
            prefab.transform.position = new Vector2(35, -16);
            prefab.GetComponent <LineLocation>().nowLine = 5;
        }
        else if (mapId == 24)
        {
            prefab.transform.position = new Vector2(50, -16);
            prefab.GetComponent <LineLocation>().nowLine = 5;
        }
        else if (mapId == 25)
        {
            prefab.transform.position = new Vector2(65, -16);
            prefab.GetComponent <LineLocation>().nowLine = 5;
        }



        //Link Adjustment
        float linkAdjst = (float)linkNo / 10;

        hp  = hp * 100;
        atk = atk * 10;
        dfc = dfc * 10;
        if (linkNo != 0)
        {
            float adjstHp = hp * linkAdjst;
            hp = hp + (int)adjstHp;
            float adjstDfc = dfc * linkAdjst;
            dfc = dfc + (int)adjstDfc;
        }

        /*Kahou Adjustment*/
        string[] KahouStatusArray;
        float    spdWithKahou = (float)spd;

        if (pvpFlg)
        {
            KahouStatusGet KahouStatusGet = new KahouStatusGet();
            KahouStatusArray = KahouStatusGet.getPvPKahouForStatus(kahouList, hp, atk, dfc, spd);
            hp           = hp + int.Parse(KahouStatusArray[1]);
            atk          = atk + int.Parse(KahouStatusArray[0]);
            dfc          = dfc + int.Parse(KahouStatusArray[2]);
            spdWithKahou = ((float)spd + float.Parse(KahouStatusArray[3]));
        }

        //HP Bar
        GameObject minHpBar = dtl.transform.FindChild("MinHpBar").gameObject;

        minHpBar.GetComponent <BusyoHPBar>().initLife = hp;
        prefab.GetComponent <EnemyHP>().life          = hp;

        //adjust spd
        float adjSpd = spdWithKahou / 10;

        if (prefab.GetComponent <EnemyAttack> ())
        {
            if (linkNo != 0)
            {
                float adjstAtk = atk * linkAdjst;
                atk = atk + (int)adjstAtk;
            }
            prefab.GetComponent <EnemyAttack> ().attack = atk;
            if (adjSpd <= 0)
            {
                adjSpd = 1;
            }
            prefab.GetComponent <Homing> ().speed  = adjSpd;
            prefab.GetComponent <Homing>().leftFlg = true;
        }
        else
        {
            if (ch_type == "YM")
            {
                atk = atk * 3;
            }
            else if (ch_type == "TP")
            {
                atk = atk * 5;
            }
            if (linkNo != 0)
            {
                float adjstAtk = atk * linkAdjst;
                atk = atk + (int)adjstAtk;
            }

            prefab.GetComponent <AttackLong> ().attack = atk;
            if (adjSpd <= 0)
            {
                adjSpd = 1;
            }
            prefab.GetComponent <HomingLong> ().speed  = adjSpd;
            prefab.GetComponent <HomingLong>().leftFlg = true;
        }
        prefab.GetComponent <EnemyHP> ().dfc = dfc;

        if (taisyo)
        {
            prefab.GetComponent <EnemyHP> ().taisyo = true;
        }

        //SE
        AudioController audio = new AudioController();

        audio.addComponentMoveAttack(prefab, ch_type);


        //Child Instantiate
        //set child object
        string    ch_path = "Prefabs/Enemy/" + ch_type;
        float     y1      = 3.0f;
        float     y2      = 3.0f;
        float     y3      = 3.0f;
        float     y4      = 3.0f;
        StatusGet sts     = new StatusGet();

        for (int i = 1; i <= ch_num; i++)
        {
            //Make Relationship
            GameObject ch_prefab = Instantiate(Resources.Load(ch_path)) as GameObject;
            ch_prefab.transform.SetParent(prefab.transform);
            ch_prefab.name = "Child" + i.ToString();

            //Sashimono Making
            string sashimono_path = "Prefabs/Sashimono/" + busyoId;
            //string sashimono_path = "Prefabs/Sashimono/1";
            GameObject sashimono = Instantiate(Resources.Load(sashimono_path)) as GameObject;
            sashimono.transform.SetParent(ch_prefab.transform);


            //reverse Horizonal
            sashimono.transform.localScale       = new Vector2(0.3f, 0.3f);
            sashimono.transform.localEulerAngles = new Vector3(sashimono.transform.localEulerAngles.x, sashimono.transform.localEulerAngles.y, 10);

            if (ch_type == "YR")
            {
                sashimono.transform.localPosition = new Vector2(-1, 0.6f);
                //Location
                if (i < 6)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x + 3, prefab.transform.position.y + y1);
                    y1 = y1 - 1.5f;
                }
                else if (5 < i && i < 11)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x + 6, prefab.transform.position.y + y2);
                    y2 = y2 - 1.5f;
                }
                else if (10 < i && i < 16)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x + 9, prefab.transform.position.y + y3);
                    y3 = y3 - 1.5f;
                }
                else if (15 < i && i < 21)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x + 12, prefab.transform.position.y + y4);
                    y4 = y4 - 1.5f;
                }
            }
            else if (ch_type == "KB")
            {
                sashimono.transform.localPosition = new Vector2(-0.5f, 1);
                //Location
                if (i < 6)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x + 4, prefab.transform.position.y + y1);
                    y1 = y1 - 1.5f;
                }
                else if (5 < i && i < 11)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x + 7, prefab.transform.position.y + y2);
                    y2 = y2 - 1.5f;
                }
                else if (10 < i && i < 16)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x + 10, prefab.transform.position.y + y3);
                    y3 = y3 - 1.5f;
                }
                else if (15 < i && i < 21)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x + 13, prefab.transform.position.y + y4);
                    y4 = y4 - 1.5f;
                }
            }
            else if (ch_type == "TP")
            {
                sashimono.transform.localPosition = new Vector2(-0.8f, 0.5f);
                //Location
                if (i < 6)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x + 4, prefab.transform.position.y + y1);
                    y1 = y1 - 1.5f;
                }
                else if (5 < i && i < 11)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x + 7, prefab.transform.position.y + y2);
                    y2 = y2 - 1.5f;
                }
                else if (10 < i && i < 16)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x + 10, prefab.transform.position.y + y3);
                    y3 = y3 - 1.5f;
                }
                else if (15 < i && i < 21)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x + 13, prefab.transform.position.y + y4);
                    y4 = y4 - 1.5f;
                }
            }
            else if (ch_type == "YM")
            {
                sashimono.transform.localPosition = new Vector2(-0.8f, 0.5f);
                //Location
                if (i < 6)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x + 4, prefab.transform.position.y + y1);
                    y1 = y1 - 1.5f;
                }
                else if (5 < i && i < 11)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x + 7, prefab.transform.position.y + y2);
                    y2 = y2 - 1.5f;
                }
                else if (10 < i && i < 16)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x + 10, prefab.transform.position.y + y3);
                    y3 = y3 - 1.5f;
                }
                else if (15 < i && i < 21)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x + 13, prefab.transform.position.y + y4);
                    y4 = y4 - 1.5f;
                }
            }

            int ch_status = getChildStatus(lv, ch_type, linkNo);

            //Round up because of Link adjustment might be under 0
            int atkDfc = Mathf.CeilToInt(sts.getChAtkDfc(ch_status, hp));

            if (i == 1)
            {
                //Child Qty
                prefab.GetComponent <EnemyHP>().childQty = ch_num;

                //Child Unit HP
                prefab.GetComponent <EnemyHP>().childHP = ch_status;

                //Attack
                if (ch_type == "YM")
                {
                    prefab.GetComponent <AttackLong> ().childAttack = atkDfc * 3;
                    prefab.GetComponent <Heisyu> ().atk             = atkDfc * 3;
                }
                else if (ch_type == "TP")
                {
                    prefab.GetComponent <AttackLong> ().childAttack = atkDfc * 5;
                    prefab.GetComponent <Heisyu> ().atk             = atkDfc * 5;
                }
                else
                {
                    prefab.GetComponent <EnemyAttack> ().attack = prefab.GetComponent <EnemyAttack> ().attack + (ch_num * atkDfc);
                    prefab.GetComponent <Heisyu> ().atk         = atkDfc;
                }

                //Dfc
                prefab.GetComponent <EnemyHP> ().dfc = prefab.GetComponent <EnemyHP> ().dfc + (ch_num * atkDfc);
                prefab.GetComponent <Heisyu> ().dfc  = atkDfc;
            }
        }

        //Busyo Config in Shiro or Toride
        if (shiroFlg || torideFlg)
        {
            //Choose AI Type
            int baseAtk = sts.getBaseAtk(busyoId);
            int baseDfc = sts.getBaseDfc(busyoId);
            int AIType  = getAIType(baseAtk, baseDfc, taisyo);

            buildingObj.GetComponent <ShiroSearch> ().busyoObjList.Add(prefab);
            if (ch_type == "YM" || ch_type == "TP")
            {
                prefab.GetComponent <HomingLong> ().backShiroObj = buildingObj;
                prefab.GetComponent <HomingLong> ().enabled      = false;
            }
            else
            {
                prefab.GetComponent <Homing> ().backShiroObj = buildingObj;
                prefab.GetComponent <Homing> ().enabled      = false;

                //YR & KB
                if (shiroFlg && AIType == 3)
                {
                    AIType = 1;
                }
            }

            //Size
            buildingObj.GetComponent <ShiroSearch> ().busyoObjSize.Add(prefab.transform.localScale);
            prefab.transform.localScale = new Vector2(0, 0);

            //AI
            buildingObj.GetComponent <ShiroSearch> ().AITypeList.Add(AIType);

            //HP
            List <float> randomList = new List <float>()
            {
                1.5f, 2.0f, 2.5f, 3.0f, 3.5f, 4.0f, 4.5f, 5.0f
            };
            int   rdm         = UnityEngine.Random.Range(0, randomList.Count);
            float randomValue = randomList [rdm];
            buildingObj.transform.FindChild("BusyoDtlEnemy").transform.FindChild("MinHpBar").GetComponent <BusyoHPBar>().initLife = (float)hp * randomValue;
            buildingObj.GetComponent <EnemyHP>().life = (float)hp * randomValue;
        }
    }
Пример #3
0
    public void makeKaisenInstance(int mapId, int busyoId, int shipId, int lv, string ch_type, int ch_num, int hp, int atk, int dfc, int spd, string busyoName, int linkNo, bool taisyo, ArrayList senpouArray)
    {
        string     path   = "Prefabs/Kaisen/" + shipId;
        GameObject prefab = Instantiate(Resources.Load(path)) as GameObject;

        prefab.name  = busyoId.ToString();
        prefab.tag   = "Enemy";
        prefab.layer = LayerMask.NameToLayer("Enemy");
        Destroy(prefab.GetComponent <PlayerHP>());
        Destroy(prefab.GetComponent <PlayerAttack>());
        prefab.AddComponent <EnemyHP> ();
        prefab.AddComponent <EnemyAttack>();

        //Senpou Script Parametor
        StatusGet senpouScript = new StatusGet();
        bool      shipFlg      = senpouScript.getSenpouShipFlg((int)senpouArray[0]);

        if (shipFlg)
        {
            prefab.GetComponent <SenpouController>().senpouId     = (int)senpouArray[0];
            prefab.GetComponent <SenpouController>().senpouTyp    = senpouArray[1].ToString();
            prefab.GetComponent <SenpouController>().senpouName   = senpouArray[2].ToString();
            prefab.GetComponent <SenpouController>().senpouEach   = (float)senpouArray[4];
            prefab.GetComponent <SenpouController>().senpouRatio  = (float)senpouArray[5];
            prefab.GetComponent <SenpouController>().senpouTerm   = (float)senpouArray[6];
            prefab.GetComponent <SenpouController>().senpouStatus = (int)senpouArray[7];
            prefab.GetComponent <SenpouController>().senpouLv     = (int)senpouArray[8];
            //Serihu
            Entity_serihu_mst serihuMst = Resources.Load("Data/serihu_mst") as Entity_serihu_mst;
            string            serihu    = "";
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                serihu = serihuMst.param[busyoId - 1].senpouMsgEng;
            }
            else
            {
                serihu = serihuMst.param[busyoId - 1].senpouMsg;
            }
            prefab.GetComponent <SenpouController>().senpouSerihu = serihu;
        }
        else
        {
            Destroy(prefab.GetComponent <SenpouController>());
        }

        //Script Adjust
        Destroy(prefab.GetComponent <UnitMover>());
        prefab.AddComponent <Homing>();



        //Busyo Detail Info [Name & HP Bar]
        string dtlPath = "";

        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            dtlPath = "Prefabs/BusyoDtl/BusyoDtlEnemyEng";
        }
        else
        {
            dtlPath = "Prefabs/BusyoDtl/BusyoDtlEnemy";
        }
        GameObject dtl = Instantiate(Resources.Load(dtlPath)) as GameObject;

        dtl.transform.SetParent(prefab.transform);
        dtl.transform.localPosition = new Vector3(0, 1, -1);
        dtl.transform.localScale    = new Vector3(1, 1, 0);
        dtl.name = "BusyoDtlEnemy";

        //Name
        GameObject nameLabel = dtl.transform.FindChild("NameLabel").gameObject;

        nameLabel.GetComponent <TextMesh>().text = busyoName;
        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            nameLabel.GetComponent <TextMesh>().fontSize = 40;
        }
        //Location by map id
        if (mapId == 1)
        {
            prefab.transform.position = new Vector2(5, 16);
        }
        else if (mapId == 2)
        {
            prefab.transform.position = new Vector2(20, 16);
        }
        else if (mapId == 3)
        {
            prefab.transform.position = new Vector2(35, 16);
        }
        else if (mapId == 4)
        {
            prefab.transform.position = new Vector2(50, 16);
        }
        else if (mapId == 5)
        {
            prefab.transform.position = new Vector2(65, 16);
        }
        else if (mapId == 6)
        {
            prefab.transform.position = new Vector2(5, 8);
        }
        else if (mapId == 7)
        {
            prefab.transform.position = new Vector2(20, 8);
        }
        else if (mapId == 8)
        {
            prefab.transform.position = new Vector2(35, 8);
        }
        else if (mapId == 9)
        {
            prefab.transform.position = new Vector2(50, 8);
        }
        else if (mapId == 10)
        {
            prefab.transform.position = new Vector2(65, 8);
        }
        else if (mapId == 11)
        {
            prefab.transform.position = new Vector2(5, 0);
        }
        else if (mapId == 12)
        {
            prefab.transform.position = new Vector2(20, 0);
        }
        else if (mapId == 13)
        {
            prefab.transform.position = new Vector2(35, 0);
        }
        else if (mapId == 14)
        {
            prefab.transform.position = new Vector2(50, 0);
        }
        else if (mapId == 15)
        {
            prefab.transform.position = new Vector2(65, 0);
        }
        else if (mapId == 16)
        {
            prefab.transform.position = new Vector2(5, -8);
        }
        else if (mapId == 17)
        {
            prefab.transform.position = new Vector2(20, -8);
        }
        else if (mapId == 18)
        {
            prefab.transform.position = new Vector2(35, -8);
        }
        else if (mapId == 19)
        {
            prefab.transform.position = new Vector2(50, -8);
        }
        else if (mapId == 20)
        {
            prefab.transform.position = new Vector2(65, -8);
        }
        else if (mapId == 21)
        {
            prefab.transform.position = new Vector2(5, -16);
        }
        else if (mapId == 22)
        {
            prefab.transform.position = new Vector2(20, -16);
        }
        else if (mapId == 23)
        {
            prefab.transform.position = new Vector2(35, -16);
        }
        else if (mapId == 24)
        {
            prefab.transform.position = new Vector2(50, -16);
        }
        else if (mapId == 25)
        {
            prefab.transform.position = new Vector2(65, -16);
        }

        //Link Adjustment
        float linkAdjst = (float)linkNo / 10;

        hp  = hp * 100;
        dfc = dfc * 10;

        if (linkNo != 0)
        {
            float adjstHp = hp * linkAdjst;
            hp = hp + (int)adjstHp;
            float adjstDfc = dfc * linkAdjst;
            dfc = dfc + (int)adjstDfc;
        }

        //Adjust
        float adjSpd = (float)spd / 10;

        if (adjSpd <= 0)
        {
            adjSpd = 1;
        }

        if (shipId == 1)
        {
            hp     = hp * 2;
            dfc    = dfc * 2;
            adjSpd = Mathf.FloorToInt((float)adjSpd * 0.5f);
        }
        else if (shipId == 2)
        {
            hp     = Mathf.FloorToInt((float)hp * 1.5f);
            dfc    = Mathf.FloorToInt((float)dfc * 1.5f);
            adjSpd = Mathf.FloorToInt((float)adjSpd * 0.6f);
        }
        else if (shipId == 3)
        {
            adjSpd = Mathf.FloorToInt((float)adjSpd * 0.8f);
        }
        atk = atk * 10;
        if (linkNo != 0)
        {
            float adjstAtk = atk * linkAdjst;
            atk = atk + (int)adjstAtk;
        }
        if (adjSpd <= 0)
        {
            adjSpd = 1;
        }
        GameObject minHpBar = dtl.transform.FindChild("MinHpBar").gameObject;

        minHpBar.GetComponent <BusyoHPBar>().initLife = hp;
        prefab.GetComponent <EnemyHP>().life          = hp;
        prefab.GetComponent <EnemyAttack>().attack    = atk;
        prefab.GetComponent <Homing>().speed          = adjSpd;
        prefab.GetComponent <EnemyHP>().dfc           = dfc;

        if (taisyo)
        {
            prefab.GetComponent <EnemyHP>().taisyo = true;
        }

        //SE
        AudioController audio = new AudioController();

        audio.addComponentMoveAttack(prefab, "SHP");

        //Child Instantiate
        //set child object
        string    ch_path = "Prefabs/Kaisen/3";
        StatusGet sts     = new StatusGet();

        for (int i = 1; i <= ch_num; i++)
        {
            //Make Relationship
            GameObject ch_prefab = Instantiate(Resources.Load(ch_path)) as GameObject;
            ch_prefab.transform.SetParent(prefab.transform);
            ch_prefab.name = "Child" + i.ToString();
            ch_prefab.transform.localScale = new Vector2(0.7f, 0.7f);
            ch_prefab.GetComponent <SpriteRenderer>().sortingOrder = 3;
            ch_prefab.tag = "EnemyChild";

            Destroy(ch_prefab.GetComponent <Rigidbody2D>());
            Destroy(ch_prefab.GetComponent <UnitMover>());
            Destroy(ch_prefab.GetComponent <Kunkou>());
            Destroy(ch_prefab.GetComponent <PolygonCollider2D>());
            Destroy(ch_prefab.GetComponent <PlayerAttack>());
            Destroy(ch_prefab.GetComponent <PlayerHP>());
            Destroy(ch_prefab.GetComponent <SenpouController>());

            //Location
            if (i == 1)
            {
                ch_prefab.transform.localPosition = new Vector2(1.8f, 0);
            }
            else if (i == 2)
            {
                ch_prefab.transform.localPosition = new Vector2(1.8f, 0.5f);
            }
            else if (i == 3)
            {
                ch_prefab.transform.localPosition = new Vector2(1.8f, -0.5f);
            }
            else if (i == 4)
            {
                ch_prefab.transform.localPosition = new Vector2(1.8f, 1.0f);
            }
            else if (i == 5)
            {
                ch_prefab.transform.localPosition = new Vector2(1.8f, -1.0f);
            }
            else if (i == 6)
            {
                ch_prefab.transform.localPosition = new Vector2(0, 0.5f);
            }
            else if (i == 7)
            {
                ch_prefab.transform.localPosition = new Vector2(0, -0.5f);
            }
            else if (i == 8)
            {
                ch_prefab.transform.localPosition = new Vector2(0, 1.0f);
            }
            else if (i == 9)
            {
                ch_prefab.transform.localPosition = new Vector2(0, -1.0f);
            }
            else if (i == 10)
            {
                ch_prefab.transform.localPosition = new Vector2(-1.8f, 0);
            }
            else if (i == 11)
            {
                ch_prefab.transform.localPosition = new Vector2(-1.8f, 0.5f);
            }
            else if (i == 12)
            {
                ch_prefab.transform.localPosition = new Vector2(-1.8f, -0.5f);
            }
            else if (i == 13)
            {
                ch_prefab.transform.localPosition = new Vector2(-1.8f, 1.0f);
            }
            else if (i == 14)
            {
                ch_prefab.transform.localPosition = new Vector2(-1.8f, -1.0f);
            }
            else if (i == 15)
            {
                ch_prefab.transform.localPosition = new Vector2(1.8f, 1.5f);
            }
            else if (i == 16)
            {
                ch_prefab.transform.localPosition = new Vector2(1.8f, -1.5f);
            }
            else if (i == 17)
            {
                ch_prefab.transform.localPosition = new Vector2(0, 1.5f);
            }
            else if (i == 18)
            {
                ch_prefab.transform.localPosition = new Vector2(0, -1.5f);
            }
            else if (i == 19)
            {
                ch_prefab.transform.localPosition = new Vector2(-1.8f, 1.5f);
            }
            else if (i == 20)
            {
                ch_prefab.transform.localPosition = new Vector2(-1.8f, -1.5f);
            }


            int ch_status = getChildStatus(lv, ch_type, linkNo);

            //Round up because of Link adjustment might be under 0
            int atkDfc = Mathf.CeilToInt(sts.getChAtkDfc(ch_status, hp));

            if (i == 1)
            {
                //Child Qty
                prefab.GetComponent <EnemyHP>().childQty = ch_num;

                //Child Unit HP
                prefab.GetComponent <EnemyHP>().childHP = ch_status;

                //Attack
                prefab.GetComponent <EnemyAttack>().attack = prefab.GetComponent <EnemyAttack>().attack + (ch_num * atkDfc);

                //Dfc
                prefab.GetComponent <EnemyHP>().dfc = prefab.GetComponent <EnemyHP>().dfc + (ch_num * atkDfc);
            }
        }
    }
Пример #4
0
    public void makeMessage(string Text, int busyoId, string type)
    {
        Message msg = new Message();

        string     msgPath    = "Prefabs/Common/MessageBusyo";
        GameObject messageObj = Instantiate(Resources.Load(msgPath)) as GameObject;

        messageObj.transform.SetParent(GameObject.Find("Panel").transform);
        messageObj.transform.FindChild("MessageBusyo").transform.GetComponent <Text> ().text = Text;
        messageObj.name = "MessageBusyo";
        messageObj.transform.localScale = new Vector2(1, 1);
        RectTransform messageTransform = messageObj.GetComponent <RectTransform> ();

        messageTransform.anchoredPosition3D = new Vector3(0, 0, 0);

        //Busyo View
        string     busyoPath = "Prefabs/Player/Unit/BusyoUnit";
        GameObject Busyo     = Instantiate(Resources.Load(busyoPath)) as GameObject;

        Busyo.name = busyoId.ToString();
        Busyo.transform.SetParent(messageObj.transform);
        Busyo.transform.localScale = new Vector2(4, 4);
        Busyo.GetComponent <DragHandler>().enabled = false;
        RectTransform busyo_transform = Busyo.GetComponent <RectTransform>();

        busyo_transform.anchoredPosition3D = new Vector3(200, 200, 0);
        busyo_transform.sizeDelta          = new Vector2(70, 70);
        foreach (Transform n in Busyo.transform)
        {
            GameObject.Destroy(n.gameObject);
        }
        messageObj.GetComponent <FadeOutBusyo> ().busyoImage = Busyo.GetComponent <Image> ();

        //Serihu
        string     serihuPath = "Prefabs/Common/Serihu";
        GameObject Serihu     = Instantiate(Resources.Load(serihuPath)) as GameObject;

        Serihu.transform.SetParent(Busyo.transform);
        Serihu.transform.localScale = new Vector2(0.2f, 0.2f);
        RectTransform Serihu_transform = Serihu.GetComponent <RectTransform>();

        Serihu_transform.anchoredPosition3D = new Vector3(100, 0, 0);
        Serihu.name = "Serihu";

        string serihu        = "";
        int    myDaimyoBusyo = PlayerPrefs.GetInt("myDaimyoBusyo");

        if (myDaimyoBusyo == busyoId)
        {
            Entity_serihu_mst serihuMst = Resources.Load("Data/serihu_mst") as Entity_serihu_mst;
            if (type == "tsuihou")
            {
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    serihu = serihuMst.param[busyoId - 1].tsuihouMsgEng;
                }
                else
                {
                    serihu = serihuMst.param[busyoId - 1].tsuihouMsg;
                }
            }
            else if (type == "touyou")
            {
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    serihu = serihuMst.param[busyoId - 1].touyouMsgEng;
                }
                else
                {
                    serihu = serihuMst.param[busyoId - 1].touyouMsg;
                }
            }
            else if (type == "ninmei")
            {
                serihu = msg.getMessage(89);
            }
        }
        else
        {
            //Serihu Contents
            Entity_serihu_mst serihuMst = Resources.Load("Data/serihu_mst") as Entity_serihu_mst;

            if (type == "tsuihou")
            {
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    serihu = serihuMst.param [busyoId - 1].tsuihouMsgEng;
                }
                else
                {
                    serihu = serihuMst.param[busyoId - 1].tsuihouMsg;
                }
            }
            else if (type == "touyou")
            {
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    serihu = serihuMst.param [busyoId - 1].touyouMsgEng;
                }
                else
                {
                    serihu = serihuMst.param[busyoId - 1].touyouMsg;
                }
            }
            else if (type == "ninmei")
            {
                serihu = msg.getMessage(90);
            }
        }
        Serihu.transform.FindChild("BusyoSerihu").GetComponent <Text>().text = serihu;
    }
Пример #5
0
    public void makeKaisenInstance(int busyoId, int shipId, int mapId, int hp, int atk, int dfc, int spd, ArrayList senpouArray, string busyoName, int soudaisyo, int boubi, bool engunFlg, int engunButaiQty, int engunButaiSts)
    {
        /*Parent Instantiate*/
        string     path   = "Prefabs/Kaisen/" + shipId;
        GameObject prefab = Instantiate(Resources.Load(path)) as GameObject;

        prefab.name = busyoId.ToString();

        //Senpou Script Parametor
        StatusGet senpouScript = new StatusGet();
        bool      shipFlg      = senpouScript.getSenpouShipFlg((int)senpouArray[0]);

        if (shipFlg)
        {
            prefab.GetComponent <SenpouController>().senpouId     = (int)senpouArray[0];
            prefab.GetComponent <SenpouController>().senpouTyp    = senpouArray[1].ToString();
            prefab.GetComponent <SenpouController>().senpouName   = senpouArray[2].ToString();
            prefab.GetComponent <SenpouController>().senpouEach   = (float)senpouArray[4];
            prefab.GetComponent <SenpouController>().senpouRatio  = (float)senpouArray[5];
            prefab.GetComponent <SenpouController>().senpouTerm   = (float)senpouArray[6];
            prefab.GetComponent <SenpouController>().senpouStatus = (int)senpouArray[7];
            prefab.GetComponent <SenpouController>().senpouLv     = (int)senpouArray[8];
            //Serihu
            Entity_serihu_mst serihuMst = Resources.Load("Data/serihu_mst") as Entity_serihu_mst;
            string            serihu    = "";
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                serihu = serihuMst.param[busyoId - 1].senpouMsgEng;
            }
            else
            {
                serihu = serihuMst.param[busyoId - 1].senpouMsg;
            }
            prefab.GetComponent <SenpouController>().senpouSerihu = serihu;
        }
        else
        {
            Destroy(prefab.GetComponent <SenpouController>());
        }



        /*Player Status Setting*/
        //parametor setting
        int adjHp  = hp * 100;
        int adjAtk = atk * 10;
        int adjDfc = dfc * 10;

        //Kahou Adjustment
        float addAtkByKanni = 0;
        float addHpByKanni  = 0;
        float addDfcByKanni = 0;

        //Jyosyu Adjustment
        float addJyosyuHei = 0;

        string[] KahouStatusArray = null;
        if (!engunFlg)
        {
            KahouStatusGet kahouSts = new KahouStatusGet();
            KahouStatusArray = kahouSts.getKahouForStatus(busyoId.ToString(), adjHp, adjAtk, adjDfc, spd);
            //Kanni Adjustment
            string kanniTmp = "kanni" + busyoId;

            if (PlayerPrefs.HasKey(kanniTmp))
            {
                int kanniId = PlayerPrefs.GetInt(kanniTmp);
                if (kanniId != 0)
                {
                    Kanni kanni = new Kanni();

                    //Status
                    string kanniTarget = kanni.getEffectTarget(kanniId);
                    int    effect      = kanni.getEffect(kanniId);
                    if (kanniTarget == "atk")
                    {
                        addAtkByKanni = ((float)adjAtk * (float)effect) / 100;
                    }
                    else if (kanniTarget == "hp")
                    {
                        addHpByKanni = ((float)adjHp * (float)effect) / 100;
                    }
                    else if (kanniTarget == "dfc")
                    {
                        addDfcByKanni = ((float)adjDfc * (float)effect) / 100;
                    }
                }
            }
            JyosyuHeiryoku jyosyuHei = new JyosyuHeiryoku();
            addJyosyuHei = (float)jyosyuHei.GetJyosyuHeiryoku(busyoId.ToString());
        }

        //Busyo Detail Info [Name & HP Bar]
        string dtlPath = "";

        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            dtlPath = "Prefabs/BusyoDtl/BusyoDtlPlayerEng";
        }
        else
        {
            dtlPath = "Prefabs/BusyoDtl/BusyoDtlPlayer";
        }
        GameObject dtl = Instantiate(Resources.Load(dtlPath)) as GameObject;

        dtl.transform.SetParent(prefab.transform);
        dtl.transform.localPosition = new Vector3(0, 1, -1);
        dtl.transform.localScale    = new Vector3(1, 1, 0);
        dtl.name = "BusyoDtlPlayer";
        //Name
        GameObject nameLabel = dtl.transform.FindChild("NameLabel").gameObject;

        nameLabel.GetComponent <TextMesh>().text = busyoName;
        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            nameLabel.GetComponent <TextMesh>().fontSize = 40;
        }
        //Location by map id
        if (mapId == 1)
        {
            prefab.transform.position = new Vector2(-65, 16);
        }
        else if (mapId == 2)
        {
            prefab.transform.position = new Vector2(-50, 16);
        }
        else if (mapId == 3)
        {
            prefab.transform.position = new Vector2(-35, 16);
        }
        else if (mapId == 4)
        {
            prefab.transform.position = new Vector2(-20, 16);
        }
        else if (mapId == 5)
        {
            prefab.transform.position = new Vector2(-5, 16);
        }
        else if (mapId == 6)
        {
            prefab.transform.position = new Vector2(-65, 8);
        }
        else if (mapId == 7)
        {
            prefab.transform.position = new Vector2(-50, 8);
        }
        else if (mapId == 8)
        {
            prefab.transform.position = new Vector2(-35, 8);
        }
        else if (mapId == 9)
        {
            prefab.transform.position = new Vector2(-20, 8);
        }
        else if (mapId == 10)
        {
            prefab.transform.position = new Vector2(-5, 8);
        }
        else if (mapId == 11)
        {
            prefab.transform.position = new Vector2(-65, 0);
        }
        else if (mapId == 12)
        {
            prefab.transform.position = new Vector2(-50, 0);
        }
        else if (mapId == 13)
        {
            prefab.transform.position = new Vector2(-35, 0);
        }
        else if (mapId == 14)
        {
            prefab.transform.position = new Vector2(-20, 0);
        }
        else if (mapId == 15)
        {
            prefab.transform.position = new Vector2(-5, 0);
        }
        else if (mapId == 16)
        {
            prefab.transform.position = new Vector2(-65, -8);
        }
        else if (mapId == 17)
        {
            prefab.transform.position = new Vector2(-50, -8);
        }
        else if (mapId == 18)
        {
            prefab.transform.position = new Vector2(-35, -8);
        }
        else if (mapId == 19)
        {
            prefab.transform.position = new Vector2(-20, -8);
        }
        else if (mapId == 20)
        {
            prefab.transform.position = new Vector2(-5, -8);
        }
        else if (mapId == 21)
        {
            prefab.transform.position = new Vector2(-65, -16);
        }
        else if (mapId == 22)
        {
            prefab.transform.position = new Vector2(-50, -16);
        }
        else if (mapId == 23)
        {
            prefab.transform.position = new Vector2(-45, -16);
        }
        else if (mapId == 24)
        {
            prefab.transform.position = new Vector2(-20, -16);
        }
        else if (mapId == 25)
        {
            prefab.transform.position = new Vector2(-5, -16);
        }

        //Add Senryoku
        if (!engunFlg)
        {
            string key = "addSenryokuSlot" + mapId;
            if (PlayerPrefs.HasKey(key))
            {
                string        atkDfc          = PlayerPrefs.GetString(key);
                List <string> atkDfcList      = new List <string>();
                char[]        delimiterChars2 = { ',' };
                atkDfcList = new List <string>(atkDfc.Split(delimiterChars2));
                adjAtk     = adjAtk + int.Parse(atkDfcList[0]);
                adjDfc     = adjDfc + int.Parse(atkDfcList[1]);
            }
        }

        //Adjust Status & Set
        int   adjHpWithKahou  = 0;
        float adjAtkWithKahou = 0;
        float adjDfcWithKahou = 0;
        float adjSpd          = 0;

        if (!engunFlg)
        {
            adjHpWithKahou  = adjHp + int.Parse(KahouStatusArray[1]) + Mathf.FloorToInt(addHpByKanni);
            adjAtkWithKahou = (float)adjAtk + int.Parse(KahouStatusArray[0]) + Mathf.FloorToInt(addAtkByKanni);
            adjDfcWithKahou = (float)adjDfc + int.Parse(KahouStatusArray[2]) + Mathf.FloorToInt(addDfcByKanni) + boubi;
            adjSpd          = ((float)spd + float.Parse(KahouStatusArray[3])) / 10;
        }
        else
        {
            adjHpWithKahou  = adjHp;
            adjAtkWithKahou = (float)adjAtk;
            adjDfcWithKahou = (float)adjDfc;
            adjSpd          = (float)spd / 10;
        }

        if (shipId == 1)
        {
            adjHpWithKahou  = adjHpWithKahou * 2;
            adjDfcWithKahou = adjDfcWithKahou * 2;
            adjSpd          = Mathf.FloorToInt((float)adjSpd * 0.5f);
        }
        else if (shipId == 2)
        {
            adjHpWithKahou  = Mathf.FloorToInt((float)adjHpWithKahou * 1.5f);
            adjDfcWithKahou = Mathf.FloorToInt((float)adjDfcWithKahou * 1.5f);
            adjSpd          = Mathf.FloorToInt((float)adjSpd * 0.6f);
        }
        else if (shipId == 3)
        {
            adjSpd = Mathf.FloorToInt((float)adjSpd * 0.8f);
        }
        if (adjSpd <= 0)
        {
            adjSpd = 1;
        }
        GameObject minHpBar = dtl.transform.FindChild("MinHpBar").gameObject;

        minHpBar.GetComponent <BusyoHPBar>().initLife = adjHpWithKahou;
        prefab.GetComponent <PlayerHP>().life         = adjHpWithKahou + addJyosyuHei;
        prefab.GetComponent <PlayerAttack>().attack   = adjAtkWithKahou;
        prefab.GetComponent <UnitMover>().speed       = adjSpd;
        prefab.GetComponent <UnitMover>().heisyu      = "SHP";
        prefab.GetComponent <PlayerHP>().dfc          = adjDfcWithKahou;


        //Soudaisyo
        if (!engunFlg)
        {
            if (busyoId == soudaisyo)
            {
                prefab.GetComponent <PlayerHP>().taisyo = true;
            }
        }

        //SE
        AudioController audio = new AudioController();

        audio.addComponentMoveAttack(prefab, "SHP");


        /*Child Instantiate*/
        //set child object
        int   ch_num    = 0;
        int   ch_lv     = 0;
        float ch_status = 0;

        if (!engunFlg)
        {
            string heiId   = "hei" + busyoId.ToString();
            string chParam = PlayerPrefs.GetString(heiId, "0");
            if (chParam == "0")
            {
                StatusGet statusScript  = new StatusGet();
                string    chParamHeisyu = statusScript.getHeisyu(busyoId);
                chParam = chParamHeisyu + ":1:1:1";
                PlayerPrefs.SetString(heiId, chParam);
                PlayerPrefs.Flush();
            }

            char[]   delimiterChars = { ':' };
            string[] ch_list        = chParam.Split(delimiterChars);
            ch_num    = int.Parse(ch_list[1]);
            ch_lv     = int.Parse(ch_list[2]);
            ch_status = float.Parse(ch_list[3]);
        }
        else
        {
            ch_num    = engunButaiQty;
            ch_status = engunButaiSts;
        }
        ch_status = ch_status * 10;

        string ch_path = "Prefabs/Kaisen/3";

        for (int i = 1; i <= ch_num; i++)
        {
            //Make Relationship
            GameObject ch_prefab = Instantiate(Resources.Load(ch_path)) as GameObject;
            ch_prefab.transform.SetParent(prefab.transform);
            ch_prefab.name = "Child" + i.ToString();
            ch_prefab.transform.localScale = new Vector2(0.7f, 0.7f);
            ch_prefab.GetComponent <SpriteRenderer>().sortingOrder = 3;
            ch_prefab.tag = "PlayerChild";

            Destroy(ch_prefab.GetComponent <Rigidbody2D>());
            Destroy(ch_prefab.GetComponent <UnitMover>());
            Destroy(ch_prefab.GetComponent <Kunkou>());
            Destroy(ch_prefab.GetComponent <PolygonCollider2D>());
            Destroy(ch_prefab.GetComponent <PlayerHP>());
            Destroy(ch_prefab.GetComponent <PlayerAttack>());
            Destroy(ch_prefab.GetComponent <SenpouController>());

            //Location
            if (i == 1)
            {
                ch_prefab.transform.localPosition = new Vector2(1.8f, 0);
            }
            else if (i == 2)
            {
                ch_prefab.transform.localPosition = new Vector2(1.8f, 0.5f);
            }
            else if (i == 3)
            {
                ch_prefab.transform.localPosition = new Vector2(1.8f, -0.5f);
            }
            else if (i == 4)
            {
                ch_prefab.transform.localPosition = new Vector2(1.8f, 1.0f);
            }
            else if (i == 5)
            {
                ch_prefab.transform.localPosition = new Vector2(1.8f, -1.0f);
            }
            else if (i == 6)
            {
                ch_prefab.transform.localPosition = new Vector2(0, 0.5f);
            }
            else if (i == 7)
            {
                ch_prefab.transform.localPosition = new Vector2(0, -0.5f);
            }
            else if (i == 8)
            {
                ch_prefab.transform.localPosition = new Vector2(0, 1.0f);
            }
            else if (i == 9)
            {
                ch_prefab.transform.localPosition = new Vector2(0, -1.0f);
            }
            else if (i == 10)
            {
                ch_prefab.transform.localPosition = new Vector2(-1.8f, 0);
            }
            else if (i == 11)
            {
                ch_prefab.transform.localPosition = new Vector2(-1.8f, 0.5f);
            }
            else if (i == 12)
            {
                ch_prefab.transform.localPosition = new Vector2(-1.8f, -0.5f);
            }
            else if (i == 13)
            {
                ch_prefab.transform.localPosition = new Vector2(-1.8f, 1.0f);
            }
            else if (i == 14)
            {
                ch_prefab.transform.localPosition = new Vector2(-1.8f, -1.0f);
            }
            else if (i == 15)
            {
                ch_prefab.transform.localPosition = new Vector2(1.8f, 1.5f);
            }
            else if (i == 16)
            {
                ch_prefab.transform.localPosition = new Vector2(1.8f, -1.5f);
            }
            else if (i == 17)
            {
                ch_prefab.transform.localPosition = new Vector2(0, 1.5f);
            }
            else if (i == 18)
            {
                ch_prefab.transform.localPosition = new Vector2(0, -1.5f);
            }
            else if (i == 19)
            {
                ch_prefab.transform.localPosition = new Vector2(-1.8f, 1.5f);
            }
            else if (i == 20)
            {
                ch_prefab.transform.localPosition = new Vector2(-1.8f, -1.5f);
            }


            StatusGet sts    = new StatusGet();
            int       atkDfc = (int)sts.getChAtkDfc((int)ch_status, adjHpWithKahou);

            if (i == 1)
            {
                //Child Qty
                prefab.GetComponent <PlayerHP>().childQty = ch_num;

                //Child Unit HP
                prefab.GetComponent <PlayerHP>().childHP = (int)ch_status;

                //Attack
                prefab.GetComponent <PlayerAttack>().attack = prefab.GetComponent <PlayerAttack>().attack + (ch_num * atkDfc);

                //Dfc
                prefab.GetComponent <PlayerHP>().dfc = prefab.GetComponent <PlayerHP>().dfc + (ch_num * atkDfc);
            }
        }
    }
Пример #6
0
    public void makeInstance(int busyoId, int mapId, int hp, int atk, int dfc, int spd, ArrayList senpouArray, string busyoName, int soudaisyo, int boubi)
    {
        /*Parent Instantiate*/
        string     path   = "Prefabs/Player/" + busyoId;
        GameObject prefab = Instantiate(Resources.Load(path)) as GameObject;

        prefab.name = busyoId.ToString();

        //Senpou Script Parametor
        StatusGet senpouScript = new StatusGet();
        bool      onlySeaFlg   = senpouScript.getSenpouOnlySeaFlg((int)senpouArray[0]);

        if (!onlySeaFlg)
        {
            prefab.GetComponent <SenpouController>().senpouId     = (int)senpouArray[0];
            prefab.GetComponent <SenpouController>().senpouTyp    = senpouArray[1].ToString();
            prefab.GetComponent <SenpouController>().senpouName   = senpouArray[2].ToString();
            prefab.GetComponent <SenpouController>().senpouEach   = (float)senpouArray[4];
            prefab.GetComponent <SenpouController>().senpouRatio  = (float)senpouArray[5];
            prefab.GetComponent <SenpouController>().senpouTerm   = (float)senpouArray[6];
            prefab.GetComponent <SenpouController>().senpouStatus = (int)senpouArray[7];
            prefab.GetComponent <SenpouController>().senpouLv     = (int)senpouArray[8];

            //Serihu
            Entity_serihu_mst serihuMst = Resources.Load("Data/serihu_mst") as Entity_serihu_mst;
            string            serihu    = "";
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                serihu = serihuMst.param[busyoId - 1].senpouMsgEng;
            }
            else
            {
                serihu = serihuMst.param[busyoId - 1].senpouMsg;
            }
            prefab.GetComponent <SenpouController>().senpouSerihu = serihu;
        }
        else
        {
            Destroy(prefab.GetComponent <SenpouController>());
        }



        /*Player Status Setting*/
        //parametor setting
        int adjHp  = hp * 100;
        int adjAtk = atk * 10;
        int adjDfc = dfc * 10;

        //heisyu
        BusyoInfoGet info   = new BusyoInfoGet();
        string       heisyu = info.getHeisyu(busyoId);

        JyosyuHeiryoku jyosyuHei    = new JyosyuHeiryoku();
        float          addJyosyuHei = (float)jyosyuHei.GetJyosyuHeiryoku(busyoId.ToString());

        //Kahou Adjustment
        KahouStatusGet kahouSts = new KahouStatusGet();

        string[] KahouStatusArray = kahouSts.getKahouForStatus(busyoId.ToString(), adjHp, adjAtk, adjDfc, spd);

        //Kanni Adjustment
        string kanniTmp      = "kanni" + busyoId;
        float  addAtkByKanni = 0;
        float  addHpByKanni  = 0;
        float  addDfcByKanni = 0;

        if (PlayerPrefs.HasKey(kanniTmp))
        {
            int kanniId = PlayerPrefs.GetInt(kanniTmp);
            if (kanniId != 0)
            {
                Kanni kanni = new Kanni();

                //Status
                string kanniTarget = kanni.getEffectTarget(kanniId);
                int    effect      = kanni.getEffect(kanniId);
                if (kanniTarget == "atk")
                {
                    addAtkByKanni = ((float)adjAtk * (float)effect) / 100;
                }
                else if (kanniTarget == "hp")
                {
                    addHpByKanni = ((float)adjHp * (float)effect) / 100;
                }
                else if (kanniTarget == "dfc")
                {
                    addDfcByKanni = ((float)adjDfc * (float)effect) / 100;
                }
            }
        }


        //Busyo Detail Info [Name & HP Bar]
        string dtlPath = "";

        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            dtlPath = "Prefabs/BusyoDtl/BusyoDtlPlayerEng";
        }
        else
        {
            dtlPath = "Prefabs/BusyoDtl/BusyoDtlPlayer";
        }
        GameObject dtl = Instantiate(Resources.Load(dtlPath)) as GameObject;

        dtl.transform.SetParent(prefab.transform);
        dtl.transform.localPosition = new Vector3(0, 1.3f, -1);
        dtl.transform.localScale    = new Vector3(1.3f, 1.3f, 0);
        dtl.name = "BusyoDtlPlayer";

        //Name
        GameObject nameLabel = dtl.transform.FindChild("NameLabel").gameObject;

        nameLabel.GetComponent <TextMesh> ().text = busyoName;


        //Location by map id
        if (mapId == 1)
        {
            prefab.transform.position = new Vector2(-65, 16);
            prefab.GetComponent <LineLocation>().nowLine = 1;
        }
        else if (mapId == 2)
        {
            prefab.transform.position = new Vector2(-50, 16);
            prefab.GetComponent <LineLocation>().nowLine = 1;
        }
        else if (mapId == 3)
        {
            prefab.transform.position = new Vector2(-35, 16);
            prefab.GetComponent <LineLocation>().nowLine = 1;
        }
        else if (mapId == 4)
        {
            prefab.transform.position = new Vector2(-20, 16);
            prefab.GetComponent <LineLocation>().nowLine = 1;
        }
        else if (mapId == 5)
        {
            prefab.transform.position = new Vector2(-5, 16);
            prefab.GetComponent <LineLocation>().nowLine = 1;
        }
        else if (mapId == 6)
        {
            prefab.transform.position = new Vector2(-65, 8);
            prefab.GetComponent <LineLocation>().nowLine = 2;
        }
        else if (mapId == 7)
        {
            prefab.transform.position = new Vector2(-50, 8);
            prefab.GetComponent <LineLocation>().nowLine = 2;
        }
        else if (mapId == 8)
        {
            prefab.transform.position = new Vector2(-35, 8);
            prefab.GetComponent <LineLocation>().nowLine = 2;
        }
        else if (mapId == 9)
        {
            prefab.transform.position = new Vector2(-20, 8);
            prefab.GetComponent <LineLocation>().nowLine = 2;
        }
        else if (mapId == 10)
        {
            prefab.transform.position = new Vector2(-5, 8);
            prefab.GetComponent <LineLocation>().nowLine = 2;
        }
        else if (mapId == 11)
        {
            prefab.transform.position = new Vector2(-65, 0);
            prefab.GetComponent <LineLocation>().nowLine = 3;
        }
        else if (mapId == 12)
        {
            prefab.transform.position = new Vector2(-50, 0);
            prefab.GetComponent <LineLocation>().nowLine = 3;
        }
        else if (mapId == 13)
        {
            prefab.transform.position = new Vector2(-35, 0);
            prefab.GetComponent <LineLocation>().nowLine = 3;
        }
        else if (mapId == 14)
        {
            prefab.transform.position = new Vector2(-20, 0);
            prefab.GetComponent <LineLocation>().nowLine = 3;
        }
        else if (mapId == 15)
        {
            prefab.transform.position = new Vector2(-5, 0);
            prefab.GetComponent <LineLocation>().nowLine = 3;
        }
        else if (mapId == 16)
        {
            prefab.transform.position = new Vector2(-65, -8);
            prefab.GetComponent <LineLocation>().nowLine = 4;
        }
        else if (mapId == 17)
        {
            prefab.transform.position = new Vector2(-50, -8);
            prefab.GetComponent <LineLocation>().nowLine = 4;
        }
        else if (mapId == 18)
        {
            prefab.transform.position = new Vector2(-35, -8);
            prefab.GetComponent <LineLocation>().nowLine = 4;
        }
        else if (mapId == 19)
        {
            prefab.transform.position = new Vector2(-20, -8);
            prefab.GetComponent <LineLocation>().nowLine = 4;
        }
        else if (mapId == 20)
        {
            prefab.transform.position = new Vector2(-5, -8);
            prefab.GetComponent <LineLocation>().nowLine = 4;
        }
        else if (mapId == 21)
        {
            prefab.transform.position = new Vector2(-65, -16);
            prefab.GetComponent <LineLocation>().nowLine = 5;
        }
        else if (mapId == 22)
        {
            prefab.transform.position = new Vector2(-50, -16);
            prefab.GetComponent <LineLocation>().nowLine = 5;
        }
        else if (mapId == 23)
        {
            prefab.transform.position = new Vector2(-45, -16);
            prefab.GetComponent <LineLocation>().nowLine = 5;
        }
        else if (mapId == 24)
        {
            prefab.transform.position = new Vector2(-20, -16);
            prefab.GetComponent <LineLocation>().nowLine = 5;
        }
        else if (mapId == 25)
        {
            prefab.transform.position = new Vector2(-5, -16);
            prefab.GetComponent <LineLocation>().nowLine = 5;
        }

        //Add Senryoku
        string key = "addSenryokuSlot" + mapId;

        if (PlayerPrefs.HasKey(key))
        {
            string        atkDfc          = PlayerPrefs.GetString(key);
            List <string> atkDfcList      = new List <string> ();
            char[]        delimiterChars2 = { ',' };
            atkDfcList = new List <string> (atkDfc.Split(delimiterChars2));
            adjAtk     = adjAtk + int.Parse(atkDfcList [0]);
            adjDfc     = adjDfc + int.Parse(atkDfcList [1]);
        }


        //HP Status
        int        adjHpWithKahou = adjHp + int.Parse(KahouStatusArray[1]) + Mathf.FloorToInt(addHpByKanni);
        GameObject minHpBar       = dtl.transform.FindChild("MinHpBar").gameObject;

        minHpBar.GetComponent <BusyoHPBar>().initLife = adjHpWithKahou;
        prefab.GetComponent <PlayerHP> ().life        = adjHpWithKahou + addJyosyuHei;


        //spd adjust
        float adjSpd = ((float)spd + float.Parse(KahouStatusArray[3])) / 10;

        prefab.GetComponent <UnitMover> ().heisyu = heisyu;
        if (prefab.GetComponent <PlayerAttack> ())
        {
            prefab.GetComponent <PlayerAttack> ().attack = adjAtk + int.Parse(KahouStatusArray[0]) + Mathf.FloorToInt(addAtkByKanni);
            prefab.GetComponent <UnitMover>().speed      = adjSpd;
        }
        else
        {
            if (heisyu == "TP")
            {
                prefab.GetComponent <AttackLong> ().attack = 5 * (adjAtk + int.Parse(KahouStatusArray [0]) + Mathf.FloorToInt(addAtkByKanni));
            }
            else if (heisyu == "YM")
            {
                prefab.GetComponent <AttackLong> ().attack = 3 * (adjAtk + int.Parse(KahouStatusArray [0]) + Mathf.FloorToInt(addAtkByKanni));
            }
            prefab.GetComponent <UnitMover> ().speed = adjSpd;
        }

        prefab.GetComponent <PlayerHP>().dfc = adjDfc + int.Parse(KahouStatusArray[2]) + Mathf.FloorToInt(addDfcByKanni) + boubi;



        //Soudaisyo
        if (busyoId == soudaisyo)
        {
            prefab.GetComponent <PlayerHP> ().taisyo = true;
        }

        //SE
        AudioController audio = new AudioController();

        audio.addComponentMoveAttack(prefab, heisyu);


        /*Child Instantiate*/
        //set child object
        string heiId           = "hei" + busyoId.ToString();
        string chParam         = "";
        bool   tutorialDoneFlg = PlayerPrefs.GetBool("tutorialDoneFlg");

        if (!tutorialDoneFlg || Application.loadedLevelName != "tutorialKassen")
        {
            chParam = PlayerPrefs.GetString(heiId, "0");
        }
        else
        {
            //retry tutorial
            if (busyoId == 19)
            {
                chParam = "TP:2:1:1";
            }
            else
            {
                StatusGet statusScript  = new StatusGet();
                string    chParamHeisyu = statusScript.getHeisyu(busyoId);
                chParam = chParamHeisyu + ":1:1:1";
            }
        }

        if (chParam == "0")
        {
            StatusGet statusScript  = new StatusGet();
            string    chParamHeisyu = statusScript.getHeisyu(busyoId);
            chParam = chParamHeisyu + ":1:1:1";
            PlayerPrefs.SetString(heiId, chParam);
            PlayerPrefs.Flush();
        }


        char[]   delimiterChars = { ':' };
        string[] ch_list        = chParam.Split(delimiterChars);

        string ch_type   = ch_list[0];
        int    ch_num    = int.Parse(ch_list[1]);
        int    ch_lv     = int.Parse(ch_list[2]);
        float  ch_status = float.Parse(ch_list[3]);

        ch_status = ch_status * 10;

        string ch_path = "Prefabs/Player/" + ch_type;

        float y1 = 3.0f;
        float y2 = 3.0f;
        float y3 = 3.0f;
        float y4 = 3.0f;

        for (int i = 1; i <= ch_num; i++)
        {
            //Make Relationship
            GameObject ch_prefab = Instantiate(Resources.Load(ch_path)) as GameObject;
            ch_prefab.transform.parent = prefab.transform;
            ch_prefab.name             = "Child" + i.ToString();

            //Sashimono Making
            string     sashimono_path = "Prefabs/Sashimono/" + busyoId;
            GameObject sashimono      = Instantiate(Resources.Load(sashimono_path)) as GameObject;
            sashimono.transform.parent     = ch_prefab.transform;
            sashimono.transform.localScale = new Vector2(0.3f, 0.3f);


            if (ch_type == "YR")
            {
                sashimono.transform.localPosition = new Vector2(-1, 0.6f);
                //Location
                if (i < 6)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 3, prefab.transform.position.y + y1);
                    y1 = y1 - 1.5f;
                }
                else if (5 < i && i < 11)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 6, prefab.transform.position.y + y2);
                    y2 = y2 - 1.5f;
                }
                else if (10 < i && i < 16)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 9, prefab.transform.position.y + y3);
                    y3 = y3 - 1.5f;
                }
                else if (15 < i && i < 21)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 12, prefab.transform.position.y + y4);
                    y4 = y4 - 1.5f;
                }
            }
            else if (ch_type == "KB")
            {
                sashimono.transform.localPosition = new Vector2(-0.5f, 1);
                //Location
                if (i < 6)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 4, prefab.transform.position.y + y1);
                    y1 = y1 - 1.5f;
                }
                else if (5 < i && i < 11)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 7, prefab.transform.position.y + y2);
                    y2 = y2 - 1.5f;
                }
                else if (10 < i && i < 16)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 10, prefab.transform.position.y + y3);
                    y3 = y3 - 1.5f;
                }
                else if (15 < i && i < 21)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 13, prefab.transform.position.y + y4);
                    y4 = y4 - 1.5f;
                }
            }
            else if (ch_type == "TP")
            {
                sashimono.transform.localPosition = new Vector2(-0.8f, 0.5f);
                //Location
                if (i < 6)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 4, prefab.transform.position.y + y1);
                    y1 = y1 - 1.5f;
                }
                else if (5 < i && i < 11)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 7, prefab.transform.position.y + y2);
                    y2 = y2 - 1.5f;
                }
                else if (10 < i && i < 16)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 10, prefab.transform.position.y + y3);
                    y3 = y3 - 1.5f;
                }
                else if (15 < i && i < 21)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 13, prefab.transform.position.y + y4);
                    y4 = y4 - 1.5f;
                }
            }
            else if (ch_type == "YM")
            {
                sashimono.transform.localPosition = new Vector2(-0.8f, 0.5f);
                //Location
                if (i < 6)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 4, prefab.transform.position.y + y1);
                    y1 = y1 - 1.5f;
                }
                else if (5 < i && i < 11)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 7, prefab.transform.position.y + y2);
                    y2 = y2 - 1.5f;
                }
                else if (10 < i && i < 16)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 10, prefab.transform.position.y + y3);
                    y3 = y3 - 1.5f;
                }
                else if (15 < i && i < 21)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 13, prefab.transform.position.y + y4);
                    y4 = y4 - 1.5f;
                }
            }



            StatusGet sts    = new StatusGet();
            int       atkDfc = (int)sts.getChAtkDfc((int)ch_status, adjHpWithKahou);

            if (i == 1)
            {
                //Child Qty
                prefab.GetComponent <PlayerHP>().childQty = ch_num;

                //Child Unit HP
                float addTotalHei = ch_status;
                prefab.GetComponent <PlayerHP>().childHP = (int)addTotalHei;

                //Attack
                if (ch_type == "YM")
                {
                    prefab.GetComponent <AttackLong> ().childAttack = atkDfc * 3;
                    prefab.GetComponent <Heisyu> ().atk             = atkDfc * 3;
                }
                else if (ch_type == "TP")
                {
                    prefab.GetComponent <AttackLong> ().childAttack = atkDfc * 5;
                    prefab.GetComponent <Heisyu> ().atk             = atkDfc * 5;
                }
                else
                {
                    prefab.GetComponent <PlayerAttack> ().attack = prefab.GetComponent <PlayerAttack> ().attack + (ch_num * atkDfc);
                    prefab.GetComponent <Heisyu> ().atk          = atkDfc;
                }

                //Dfc
                prefab.GetComponent <PlayerHP> ().dfc = prefab.GetComponent <PlayerHP> ().dfc + (ch_num * atkDfc);
                prefab.GetComponent <Heisyu> ().dfc   = atkDfc;
            }
        }
    }
Пример #7
0
    /*make engun instance*/
    public void makeEngunInstance(int busyoId, int hp, int atk, int dfc, int spd, ArrayList senpouArray, string busyoName, int ch_num, int ch_lv)
    {
        /*Parent Instantiate*/
        string     path   = "Prefabs/Player/" + busyoId;
        GameObject prefab = Instantiate(Resources.Load(path)) as GameObject;

        prefab.name = busyoId.ToString();

        //Senpou Script Parametor
        StatusGet senpouScript = new StatusGet();
        bool      onlySeaFlg   = senpouScript.getSenpouOnlySeaFlg((int)senpouArray[0]);

        if (!onlySeaFlg)
        {
            prefab.GetComponent <SenpouController>().senpouId     = (int)senpouArray[0];
            prefab.GetComponent <SenpouController>().senpouTyp    = senpouArray[1].ToString();
            prefab.GetComponent <SenpouController>().senpouName   = senpouArray[2].ToString();
            prefab.GetComponent <SenpouController>().senpouEach   = (float)senpouArray[4];
            prefab.GetComponent <SenpouController>().senpouRatio  = (float)senpouArray[5];
            prefab.GetComponent <SenpouController>().senpouTerm   = (float)senpouArray[6];
            prefab.GetComponent <SenpouController>().senpouStatus = (int)senpouArray[7];
            prefab.GetComponent <SenpouController>().senpouLv     = (int)senpouArray[8];

            //Serihu
            Entity_serihu_mst serihuMst = Resources.Load("Data/serihu_mst") as Entity_serihu_mst;
            string            serihu    = "";
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                serihu = serihuMst.param[busyoId - 1].senpouMsgEng;
            }
            else
            {
                serihu = serihuMst.param[busyoId - 1].senpouMsg;
            }
            prefab.GetComponent <SenpouController>().senpouSerihu = serihu;
        }
        else
        {
            Destroy(prefab.GetComponent <SenpouController>());
        }

        //Engun Flg
        prefab.GetComponent <Kunkou> ().engunFlg = true;



        /*Player Status Setting*/
        //parametor setting
        int adjHp  = hp * 100;
        int adjAtk = atk * 10;
        int adjDfc = dfc * 10;

        //Busyo Detail Info [Name & HP Bar]
        string dtlPath = "";

        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            dtlPath = "Prefabs/BusyoDtl/BusyoDtlPlayerEng";
        }
        else
        {
            dtlPath = "Prefabs/BusyoDtl/BusyoDtlPlayer";
        }
        GameObject dtl = Instantiate(Resources.Load(dtlPath)) as GameObject;

        dtl.transform.SetParent(prefab.transform);
        dtl.transform.localPosition = new Vector3(0, 1.3f, -1);
        dtl.transform.localScale    = new Vector3(1.3f, 1.3f, 0);
        dtl.name = "BusyoDtlPlayer";
        //Name
        GameObject nameLabel = dtl.transform.FindChild("NameLabel").gameObject;

        nameLabel.GetComponent <TextMesh> ().text = busyoName;

        //HP Bar
        GameObject minHpBar = dtl.transform.FindChild("MinHpBar").gameObject;

        minHpBar.GetComponent <BusyoHPBar>().initLife = adjHp;

        //Location by map id
        prefab.transform.position = new Vector2(-20, -16);
        prefab.GetComponent <LineLocation>().nowLine = 5;

        //heisyu
        BusyoInfoGet info    = new BusyoInfoGet();
        string       ch_type = info.getHeisyu(busyoId);

        prefab.GetComponent <PlayerHP> ().life = adjHp;

        //adjust spd
        float adjSpd = (float)spd / 10;


        if (prefab.GetComponent <PlayerAttack> ())
        {
            prefab.GetComponent <PlayerAttack> ().attack = adjAtk;
            prefab.GetComponent <UnitMover> ().speed     = adjSpd;
        }
        else
        {
            if (ch_type == "TP")
            {
                prefab.GetComponent <AttackLong> ().attack = 5 * adjAtk;
            }
            else if (ch_type == "YM")
            {
                prefab.GetComponent <AttackLong> ().attack = 3 * adjAtk;
            }
            prefab.GetComponent <UnitMover> ().speed = adjSpd;
        }
        prefab.GetComponent <PlayerHP>().dfc     = adjDfc;
        prefab.GetComponent <UnitMover>().heisyu = ch_type;

        //SE
        AudioController audio = new AudioController();

        audio.addComponentMoveAttack(prefab, ch_type);



        /*Child Instantiate*/
        //set child object
        Entity_lvch_mst lvMst     = Resources.Load("Data/lvch_mst") as Entity_lvch_mst;
        int             startline = 0;

        if (ch_type == "KB")
        {
            startline = 0;
        }
        else if (ch_type == "YR")
        {
            startline = 1;
        }
        else if (ch_type == "TP")
        {
            startline = 2;
        }
        else if (ch_type == "YM")
        {
            startline = 3;
        }
        object    stslst = lvMst.param[startline];
        Type      t      = stslst.GetType();
        String    param  = "lv" + ch_lv.ToString();
        FieldInfo f      = t.GetField(param);
        int       sts    = (int)f.GetValue(stslst);

        float ch_status = (float)sts;

        ch_status = ch_status * 10;

        string ch_path = "Prefabs/Player/" + ch_type;

        float y1 = 3.0f;
        float y2 = 3.0f;
        float y3 = 3.0f;
        float y4 = 3.0f;

        for (int i = 1; i <= ch_num; i++)
        {
            //Make Relationship
            GameObject ch_prefab = Instantiate(Resources.Load(ch_path)) as GameObject;
            ch_prefab.transform.parent = prefab.transform;
            ch_prefab.name             = "Child" + i.ToString();

            //Sashimono Making
            string     sashimono_path = "Prefabs/Sashimono/" + busyoId;
            GameObject sashimono      = Instantiate(Resources.Load(sashimono_path)) as GameObject;
            sashimono.transform.parent     = ch_prefab.transform;
            sashimono.transform.localScale = new Vector2(0.3f, 0.3f);


            if (ch_type == "YR")
            {
                sashimono.transform.localPosition = new Vector2(-1, 0.6f);
                //Location
                if (i < 6)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 3, prefab.transform.position.y + y1);
                    y1 = y1 - 1.5f;
                }
                else if (5 < i && i < 11)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 6, prefab.transform.position.y + y2);
                    y2 = y2 - 1.5f;
                }
                else if (10 < i && i < 16)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 9, prefab.transform.position.y + y3);
                    y3 = y3 - 1.5f;
                }
                else if (15 < i && i < 21)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 12, prefab.transform.position.y + y4);
                    y4 = y4 - 1.5f;
                }
            }
            else if (ch_type == "KB")
            {
                sashimono.transform.localPosition = new Vector2(-0.5f, 1);
                //Location
                if (i < 6)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 4, prefab.transform.position.y + y1);
                    y1 = y1 - 1.5f;
                }
                else if (5 < i && i < 11)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 7, prefab.transform.position.y + y2);
                    y2 = y2 - 1.5f;
                }
                else if (10 < i && i < 16)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 10, prefab.transform.position.y + y3);
                    y3 = y3 - 1.5f;
                }
                else if (15 < i && i < 21)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 13, prefab.transform.position.y + y4);
                    y4 = y4 - 1.5f;
                }
            }
            else if (ch_type == "TP")
            {
                sashimono.transform.localPosition = new Vector2(-0.8f, 0.5f);
                //Location
                if (i < 6)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 4, prefab.transform.position.y + y1);
                    y1 = y1 - 1.5f;
                }
                else if (5 < i && i < 11)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 7, prefab.transform.position.y + y2);
                    y2 = y2 - 1.5f;
                }
                else if (10 < i && i < 16)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 10, prefab.transform.position.y + y3);
                    y3 = y3 - 1.5f;
                }
                else if (15 < i && i < 21)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 13, prefab.transform.position.y + y4);
                    y4 = y4 - 1.5f;
                }
            }
            else if (ch_type == "YM")
            {
                sashimono.transform.localPosition = new Vector2(-0.8f, 0.5f);
                //Location
                if (i < 6)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 4, prefab.transform.position.y + y1);
                    y1 = y1 - 1.5f;
                }
                else if (5 < i && i < 11)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 7, prefab.transform.position.y + y2);
                    y2 = y2 - 1.5f;
                }
                else if (10 < i && i < 16)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 10, prefab.transform.position.y + y3);
                    y3 = y3 - 1.5f;
                }
                else if (15 < i && i < 21)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 13, prefab.transform.position.y + y4);
                    y4 = y4 - 1.5f;
                }
            }

            //Status
            if (i == 1)
            {
                //Child Qty
                prefab.GetComponent <PlayerHP>().childQty = ch_num;

                //Child Unit HP
                prefab.GetComponent <PlayerHP>().childHP = (int)ch_status;

                StatusGet stsScript = new StatusGet();
                int       atkDfc    = (int)stsScript.getChAtkDfc((int)ch_status, adjHp);

                //Attack
                if (ch_type == "YM")
                {
                    prefab.GetComponent <AttackLong> ().childAttack = atkDfc * 3;
                }
                else if (ch_type == "TP")
                {
                    prefab.GetComponent <AttackLong> ().childAttack = atkDfc * 5;
                }
                else
                {
                    prefab.GetComponent <PlayerAttack> ().attack = prefab.GetComponent <PlayerAttack> ().attack + (ch_num * atkDfc);
                }

                //Dfc
                prefab.GetComponent <PlayerHP> ().dfc = prefab.GetComponent <PlayerHP> ().dfc + (ch_num * atkDfc);
            }
        }
    }