/// <summary> /// 自分のターン 通常攻撃 /// </summary> private void MyTurn_NormalAttack() { int intBullet = int.Parse(OperatePlayerData.GetPlayerData("PlayerBullet")); string strBullet = Convert.ToString(intBullet - 1); OperatePlayerData.SetPlayerData(strBullet, "PlayerBullet"); var query_Player = (from x in GameManager.xdoc_PlayerData.Descendants("Player") select x).Single(); var query_Enemy = (from x in GameManager.xdoc_BattleSheet.Descendants("Enemy") where x.Element("BattleNo").Value == GameManager.TargetFlg select x).Single(); int PlayerAttackValue = int.Parse(query_Player.Element("PlayerAttackValue_OnBattle").Value); int EnemyDiffenceValue = int.Parse(query_Enemy.Element("EnemyDiffenceValue").Value); GameManager.Text_MainWindow.text = OperatePlayerData.GetPlayerData("PlayerName") + "の攻撃!"; StartCoroutine(GameManager.WaitTime_1()); int Damage = CirculateParameter.DamageCirculate(PlayerAttackValue, EnemyDiffenceValue); GameManager.Text_MainWindow.text = GameManager.Text_MainWindow.text + "\n" + query_Enemy.Element("EnemyName").Value + "に" + Damage + "のダメージ!"; StartCoroutine(GameManager.WaitTime_1()); //攻撃結果ジャッジ if (ComparerParameter.JudgeDamageResult_Single_Player(Damage) == true) { ManageBattle.DeadEnemy_Single(GameManager.TargetFlg); } }
/// <summary> /// スキル「リロード」使用時 /// </summary> private void MyTurn_Reload() { OperatePlayerData.SetPlayerData("5", "PlayerBullet"); 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, new Rect(0, 0, texture_BulletIcon.width, texture_BulletIcon.height), Vector2.zero); GameManager.Bullet5.sprite = Sprite.Create(texture_BulletIcon, new Rect(0, 0, texture_BulletIcon.width, texture_BulletIcon.height), Vector2.zero); GameManager.Text_MainWindow.text = OperatePlayerData.GetPlayerData("PlayerName") + "はリロードした!\n残弾数が回復した!"; StartCoroutine(GameManager.WaitTime_1()); }
/// <summary> /// 敵→プレイヤーの単体攻撃の結果を判定。倒したかどうか。trueで負ける。 /// </summary> /// <param name="Damage"></param> /// <returns></returns> public static bool JudgeDamageResult_Single_Enemy(int Damage) { bool result = false; int PlayerNowHP = int.Parse(OperatePlayerData.GetPlayerData(GetXMLQueryKey_PlayerData.PlayerNowHP())); if (Damage == PlayerNowHP) { OperatePlayerData.SetPlayerData("0", GetXMLQueryKey_PlayerData.PlayerNowHP()); GameManager.HPValue_StatusWindow.text = "0"; result = true; } else if (Damage > PlayerNowHP) { OperatePlayerData.SetPlayerData("0", GetXMLQueryKey_PlayerData.PlayerNowHP()); GameManager.HPValue_StatusWindow.text = "0"; result = true; } else if (Damage < PlayerNowHP) { OperatePlayerData.SetPlayerData(Convert.ToString(PlayerNowHP - Damage), GetXMLQueryKey_PlayerData.PlayerNowHP()); GameManager.HPValue_StatusWindow.text = Convert.ToString(PlayerNowHP - Damage); result = false; } return(result); }
/// <summary> /// 自分のターン パワーショット /// </summary> private void MyTurn_PowerShot() { int intBullet = int.Parse(OperatePlayerData.GetPlayerData(GetXMLQueryKey_PlayerData.PlayerBullet())); string strBullet = Convert.ToString(intBullet - 2); OperatePlayerData.SetPlayerData(strBullet, GetXMLQueryKey_PlayerData.PlayerBullet()); var query_Player = (from x in BattleStaticValiable.xdoc.Descendants("Player") select x).Single(); var query_Enemy = (from x in BattleStaticValiable.xdoc2.Descendants("Enemy") where x.Element("BattleNo").Value == GameManager.TargetFlg select x).Single(); int PlayerAttackValue = int.Parse(query_Player.Element("PlayerAttackValue_OnBattle").Value) * int.Parse(OperatePlayerSkill.GetPlayerSkillData(GetXMLQueryKey_PlayerSkill.PlayerSkill_DamagePercent(int.Parse(GameManager.SkillNoFlg)), int.Parse(GameManager.SkillNoFlg))); int EnemyDiffenceValue = int.Parse(query_Enemy.Element("EnemyDiffenceValue").Value); GameManager.Text_MainWindow.text = OperatePlayerData.GetPlayerData(GetXMLQueryKey_PlayerData.PlayerName()) + "はパワーショットを放った!"; int Damage = CirculateParameter.DamageCirculate(PlayerAttackValue, EnemyDiffenceValue); GameManager.Text_MainWindow.text = GameManager.Text_MainWindow.text + "\n" + query_Enemy.Element("EnemyName").Value + "に" + Damage + "のダメージ!"; StartCoroutine(GameManager.WaitTime_1()); //攻撃結果ジャッジ if (ComparerParameter.JudgeDamageResult_Single_Player(Damage) == true) { ManageBattle.DeadEnemy_Single(GameManager.TargetFlg); } }
/// <summary> /// レベルアップ時のパラメータ変動 /// </summary> public static void LevelUp() { var AttackPlus = UnityEngine.Random.Range(2, 5); string SetAttackPoint = Convert.ToString(int.Parse(OperatePlayerData.GetPlayerData(GetXMLQueryKey_PlayerData.PlayerAttackValue()) + AttackPlus)); OperatePlayerData.SetPlayerData(SetAttackPoint, OperatePlayerData.GetPlayerData(GetXMLQueryKey_PlayerData.PlayerAttackValue())); var DiffencePlus = UnityEngine.Random.Range(2, 5); string SetDiffencePoint = Convert.ToString(int.Parse(OperatePlayerData.GetPlayerData(GetXMLQueryKey_PlayerData.PlayerDiffenceValue()) + DiffencePlus)); OperatePlayerData.SetPlayerData(SetDiffencePoint, OperatePlayerData.GetPlayerData(GetXMLQueryKey_PlayerData.PlayerDiffenceValue())); var SpeedPlus = UnityEngine.Random.Range(1, 5); string SetSpeedPoint = Convert.ToString(int.Parse(OperatePlayerData.GetPlayerData(GetXMLQueryKey_PlayerData.PlayerSpeedValue()) + SpeedPlus)); OperatePlayerData.SetPlayerData(SetSpeedPoint, OperatePlayerData.GetPlayerData(GetXMLQueryKey_PlayerData.PlayerSpeedValue())); var HPPlus = UnityEngine.Random.Range(3, 7); string SetHPPoint = Convert.ToString(int.Parse(OperatePlayerData.GetPlayerData(GetXMLQueryKey_PlayerData.PlayerMaxHP()) + HPPlus)); OperatePlayerData.SetPlayerData(SetHPPoint, OperatePlayerData.GetPlayerData(GetXMLQueryKey_PlayerData.PlayerMaxHP())); }
public static void Setting() { Texture2D texture_BulletIcon = Resources.Load("BulletIcon") as Texture2D; Texture2D texture_BulletIcon_NoImage = Resources.Load("NoImage") as Texture2D; //バレットアイコン初期化 GameManager.Bullet1.sprite = Sprite.Create(texture_BulletIcon_NoImage, new Rect(0, 0, texture_BulletIcon.width, texture_BulletIcon.height), Vector2.zero); GameManager.Bullet2.sprite = Sprite.Create(texture_BulletIcon_NoImage, new Rect(0, 0, texture_BulletIcon.width, texture_BulletIcon.height), Vector2.zero); GameManager.Bullet3.sprite = Sprite.Create(texture_BulletIcon_NoImage, 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); //残り弾数を問い合わせて、値によって処理変更 switch (int.Parse(OperatePlayerData.GetPlayerData(GetXMLQueryKey_PlayerData.PlayerBullet()))) { case 0: OperatePlayerData.SetPlayerData("1", GetXMLQueryKey_PlayerData.PlayerBullet()); GameManager.Bullet1.sprite = Sprite.Create(texture_BulletIcon, new Rect(0, 0, texture_BulletIcon.width, texture_BulletIcon.height), Vector2.zero); break; case 1: OperatePlayerData.SetPlayerData("2", GetXMLQueryKey_PlayerData.PlayerBullet()); 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); break; case 2: OperatePlayerData.SetPlayerData("3", GetXMLQueryKey_PlayerData.PlayerBullet()); 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); break; case 3: OperatePlayerData.SetPlayerData("4", GetXMLQueryKey_PlayerData.PlayerBullet()); 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, new Rect(0, 0, texture_BulletIcon.width, texture_BulletIcon.height), Vector2.zero); break; case 4: OperatePlayerData.SetPlayerData("5", GetXMLQueryKey_PlayerData.PlayerBullet()); 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, 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); break; case 5: 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, 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); break; } GameManager.Text_MainWindow.text = ""; VisibleUIManage.ManageStart_EndBattleStartClass(); }
/// <summary> /// 勝利判定 /// </summary> public static void CheckWin() { var query_win = from x in BattleStaticValiable.xdoc2.Descendants("Enemy") select x; int EnemyHPSUM = 0; foreach (var item in query_win) { EnemyHPSUM = EnemyHPSUM + int.Parse(item.Element("EnemyHP").Value); } //結果がゼロの時、勝利処理 if (EnemyHPSUM == 0) { GameManager.Text_MainWindow.text = OperatePlayerData.GetPlayerData("PlayerName") + "は戦いに勝利した!"; MonoBehaviour mono = new MonoBehaviour(); mono.StartCoroutine(GameManager.WaitTime_1()); //経験値の計算 int Experience = 0; foreach (var item in query_win) { Experience = Experience + int.Parse(item.Element("EnemyExperience").Value); } GameManager.Text_MainWindow.text = OperatePlayerData.GetPlayerData("PlayerName") + "は" + Experience + "の経験値を手に入れた。"; //経験値を合算して反映 int ExperienceSUM = int.Parse(OperatePlayerData.GetPlayerData(GetXMLQueryKey_PlayerData.PlayerExperience()) + Experience); OperatePlayerData.SetPlayerData(Convert.ToString(ExperienceSUM), OperatePlayerData.GetPlayerData(GetXMLQueryKey_PlayerData.PlayerExperience())); //経験値量によってレベルアップさせる switch (Experience) { case 20: OperatePlayerData.SetPlayerData("2", OperatePlayerData.GetPlayerData(GetXMLQueryKey_PlayerData.PlayerLevel())); LevelUp(); GameManager.Text_MainWindow.text = OperatePlayerData.GetPlayerData("PlayerName") + "はレベルアップした!"; mono.StartCoroutine(GameManager.WaitTime_1()); SceneManager.LoadScene("現在のマップ"); break; case 70: OperatePlayerData.SetPlayerData("3", OperatePlayerData.GetPlayerData(GetXMLQueryKey_PlayerData.PlayerLevel())); GameManager.Text_MainWindow.text = OperatePlayerData.GetPlayerData("PlayerName") + "はレベルアップした!"; mono.StartCoroutine(GameManager.WaitTime_1()); SceneManager.LoadScene("現在のマップ"); break; } } else { //そうじゃないときはなにもしない } }