Exemple #1
0
    /// <summary>
    /// 戦闘開始処理
    /// </summary>
    private void StartUP()
    {
        Texture2D texture_Enemy;

        //敵の情報を取得
        XDocument xdoc = XDocument.Load(GetXMLPath.GetXMLPath_EnemyData());

        var query = (from x in xdoc.Descendants("Enemy")
                     select x).Single();

        string EnemyName = query.Element("EnemyName").Value;

        //味方側の処理
        XDocument xdoc2 = XDocument.Load(GetXmlTextAsset.PlayerDataTextAsset().text);

        var query2 = (from x in xdoc2.Descendants("Player")
                      select x).Single();

        //味方戦闘用パラメータをセット
        query2.Element("PlayerAttackValue_OnBattle").Value   = query2.Element("PlayerAttackValue").Value;
        query2.Element("PlayerDiffenceValue_OnBattle").Value = query2.Element("PlayerDiffenceValue").Value;
        query2.Element("PlayerSpeedValue_OnBattle").Value    = query2.Element("PlayerSpeedValue").Value;
        xdoc2.Save(GetXMLPath.GetXMLPath_PlayerData());

        //各種ウィンドウに値反映
        GameManager.CharaName_StatusWindow.text = query2.Element("PlayerName").Value;
        GameManager.HPValue_StatusWindow.text   = query2.Element("PlayerNowHP").Value;
        GameManager.ENValue_StatusWindow.text   = query2.Element("PlayerNowEN").Value;

        //味方の画像を入れる
        Texture2D texture_Player_BattleImage1 = Resources.Load("Player_BattleImage") as Texture2D;

        GameManager.CharaImage_StatusWindow.sprite = Sprite.Create(texture_Player_BattleImage1,
                                                                   new Rect(0, 0, texture_Player_BattleImage1.width, texture_Player_BattleImage1.height),
                                                                   Vector2.zero);

        //Bulletを描写
        Texture2D texture_BulletIcon         = Resources.Load("BulletIcon") as Texture2D;
        Texture2D texture_BulletIcon_NoImage = Resources.Load("NoImage") as Texture2D;

        GameManager.Bullet1.sprite = Sprite.Create(texture_BulletIcon,
                                                   new Rect(0, 0, texture_BulletIcon.width, texture_BulletIcon.height),
                                                   Vector2.zero);
        GameManager.Bullet2.sprite = Sprite.Create(texture_BulletIcon,
                                                   new Rect(0, 0, texture_BulletIcon.width, texture_BulletIcon.height),
                                                   Vector2.zero);
        GameManager.Bullet3.sprite = Sprite.Create(texture_BulletIcon,
                                                   new Rect(0, 0, texture_BulletIcon.width, texture_BulletIcon.height),
                                                   Vector2.zero);
        GameManager.Bullet4.sprite = Sprite.Create(texture_BulletIcon_NoImage,
                                                   new Rect(0, 0, texture_BulletIcon.width, texture_BulletIcon.height),
                                                   Vector2.zero);
        GameManager.Bullet5.sprite = Sprite.Create(texture_BulletIcon_NoImage,
                                                   new Rect(0, 0, texture_BulletIcon.width, texture_BulletIcon.height),
                                                   Vector2.zero);

        //敵を描写
        texture_Enemy = Resources.Load(EnemyName) as Texture2D;
        GameManager.EnemyImage.sprite = Sprite.Create(texture_Enemy,
                                                      new Rect(0, 0, texture_Enemy.width, texture_Enemy.height),
                                                      Vector2.zero);
        GameManager.Text_MainWindow.text = EnemyName + GetEncountText.EncountText(EnemyName);

        StartCoroutine(GameManager.WaitTime_2());
        GameManager.Text_MainWindow.text = "";
    }
Exemple #2
0
    /// <summary>
    /// 戦闘開始処理
    /// </summary>
    private void StartUP()
    {
        Texture2D texture_Enemy1;
        Texture2D texture_Enemy2;
        Texture2D texture_Enemy3;

        //敵の情報を取得
        XDocument xdoc = XDocument.Load(GetXmlPath.BattleEnemyDataSheetPath());

        var query = from x in xdoc.Descendants("Enemy")
                    where x.Element("EnemyName").Value != ""
                    select x;
        List <string> CountList = new List <string>();

        foreach (var item in query)
        {
            CountList.Add(item.Element("EnemyName").Value);
        }

        string EnemyName1;
        string EnemyName2;
        string EnemyName3;

        switch (CountList.Count)
        {
        case 1:
            EnemyName1 = CountList[0];
            break;

        case 2:
            EnemyName1 = CountList[0];
            EnemyName2 = CountList[1];
            break;

        case 3:
            EnemyName1 = CountList[0];
            EnemyName2 = CountList[1];
            EnemyName3 = CountList[2];
            break;

        default:
            break;
        }

        //味方側の処理
        XDocument xdoc2 = XDocument.Load(GetXmlPath.PlayerDataPath());

        var query2 = (from x in xdoc2.Descendants("Player")
                      select x).Single();

        //戦闘用パラメータをセット
        query2.Element("PlayerAttackValue_OnBattle").Value   = query2.Element("PlayerAttackValue").Value;
        query2.Element("PlayerDiffenceValue_OnBattle").Value = query2.Element("PlayerDiffenceValue").Value;
        query2.Element("PlayerSpeedValue_OnBattle").Value    = query2.Element("PlayerSpeedValue").Value;
        xdoc2.Save(GetXmlPath.PlayerDataPath());

        //各種ウィンドウに値反映
        CharaName_StatusWindow.text = query2.Element("PlayerName").Value;
        HPValue_StatusWindow.text   = query2.Element("PlayerNowHP").Value;
        ENValue_StatusWindow.text   = query2.Element("PlayerNowEN").Value;

        //味方の画像を入れる
        Texture2D texture_Player_BattleImage1 = Resources.Load("Player_BattleImage1") as Texture2D;

        CharaImage_StatusWindow.sprite = Sprite.Create(texture_Player_BattleImage1,
                                                       new Rect(0, 0, texture_Player_BattleImage1.width, texture_Player_BattleImage1.height),
                                                       Vector2.zero);

        //Bulletを描写
        Texture2D texture_BulletIcon         = Resources.Load("BulletIcon") as Texture2D;
        Texture2D texture_BulletIcon_NoImage = Resources.Load("NoImage") as Texture2D;

        Bullet1.sprite = Sprite.Create(texture_BulletIcon,
                                       new Rect(0, 0, texture_BulletIcon.width, texture_BulletIcon.height),
                                       Vector2.zero);
        Bullet2.sprite = Sprite.Create(texture_BulletIcon,
                                       new Rect(0, 0, texture_BulletIcon.width, texture_BulletIcon.height),
                                       Vector2.zero);
        Bullet3.sprite = Sprite.Create(texture_BulletIcon,
                                       new Rect(0, 0, texture_BulletIcon.width, texture_BulletIcon.height),
                                       Vector2.zero);
        Bullet4.sprite = Sprite.Create(texture_BulletIcon_NoImage,
                                       new Rect(0, 0, texture_BulletIcon.width, texture_BulletIcon.height),
                                       Vector2.zero);
        Bullet5.sprite = Sprite.Create(texture_BulletIcon_NoImage,
                                       new Rect(0, 0, texture_BulletIcon.width, texture_BulletIcon.height),
                                       Vector2.zero);

        //敵を描写
        switch (CountList.Count)
        {
        case 1:
            texture_Enemy1     = Resources.Load(CountList[0]) as Texture2D;
            EnemyImage1.sprite = Sprite.Create(texture_Enemy1,
                                               new Rect(0, 0, texture_Enemy1.width, texture_Enemy1.height),
                                               Vector2.zero);
            Text_MainWindow.text = CountList[0] + GetEncountText.EncountText(CountList[0]);      //敵単体時のみ特別メッセージ
            break;

        case 2:     //位置調整必須 widthとheightを変更
            texture_Enemy1     = Resources.Load(CountList[0]) as Texture2D;
            EnemyImage1.sprite = Sprite.Create(texture_Enemy1,
                                               new Rect(0, 0, texture_Enemy1.width, texture_Enemy1.height),
                                               Vector2.zero);
            texture_Enemy2     = Resources.Load(CountList[1]) as Texture2D;
            EnemyImage2.sprite = Sprite.Create(texture_Enemy2,
                                               new Rect(0, 0, texture_Enemy2.width, texture_Enemy2.height),
                                               Vector2.zero);
            Text_MainWindow.text = CountList[0] + "たちが\n襲いかかってきた!";
            break;

        case 3:
            texture_Enemy1     = Resources.Load(CountList[0]) as Texture2D;
            EnemyImage1.sprite = Sprite.Create(texture_Enemy1,
                                               new Rect(0, 0, texture_Enemy1.width, texture_Enemy1.height),
                                               Vector2.zero);
            texture_Enemy2     = Resources.Load(CountList[1]) as Texture2D;
            EnemyImage2.sprite = Sprite.Create(texture_Enemy2,
                                               new Rect(0, 0, texture_Enemy2.width, texture_Enemy2.height),
                                               Vector2.zero);
            texture_Enemy3     = Resources.Load(CountList[2]) as Texture2D;
            EnemyImage2.sprite = Sprite.Create(texture_Enemy2,
                                               new Rect(0, 0, texture_Enemy3.width, texture_Enemy3.height),
                                               Vector2.zero);
            Text_MainWindow.text = CountList[0] + "たちが\n襲いかかってきた!";
            break;

        default:
            break;
        }

        StartCoroutine(WaitTime_2());
        Text_MainWindow.text = "";
    }