//============================================================== //敵がプレイヤーに攻撃する public void AttackToPlayer() { int damage = parameterManager.enemiesParameters[Index].AttackPower; //ダメージ値 string playerName = parameterManager.playerParameters.Name; //名前 string enemyName = parameterManager.enemiesParameters[Index].Name; string tmpApplyText = textBox.ColorText(enemyName) + "の攻撃!"; //テキストボックスに表示させるテキスト //サウンドエフェクト soundManagerSE.TriggerSE(1); //ダメージの適用 parameterManager.playerParameters.Damage(damage); tmpApplyText += "\n" + textBox.ColorText(playerName) + "に" + textBox.ColorText("" + damage) + "のダメージ!"; manager.CreateApplyingHPText(manager.Player, damage, 0); //プレイングバイアス neuralNetworkManager.ApplyPlayingBias(ValueDefinition.PLAYING_BIAS_DAMAGE); //プレイヤーの死亡判定 if (parameterManager.playerParameters.CheckDead()) { tmpApplyText += "\n" + playerName + "は力尽きた・・・"; textBox.Apply(tmpApplyText, true); } else { textBox.Apply(tmpApplyText, false); } }
private void Update() { if (ActQueue.Count == 0) { //敵全員の行動が終わったら if (EnemiesActCount >= GetEnemyNum()) { ActFlagInitialize(); //行動関連のフラグの初期化 } //プレイヤーがしんだら if (IsDeadPlayer) { onceRoutineDeadPlayerInterval++; if (onceRoutineDeadPlayerInterval >= 60) { if (onceRoutineDeadPlayer == false) { onceRoutineDeadPlayer = true; //プレイングバイアス neuralNetworkManager.ApplyPlayingBias(ValueDefinition.PLAYING_BIAS_GAMEOVER); soundManagerBGM.StopMusic(0); actionSaver.ApplyActionToNeuralNetwork(); parameterManager.TransPattern = 3; ActQueue.Add(FadeScene("Result")); } } } } else { onceRoutineDeadPlayerInterval = 0; } //=============================================================== //初期に実行される //フィールドデータが生成されたなら if (IsFieldCreated) { //(プレイヤーが存在しない場合)プレイヤーオブジェクトの作成 if (isCreatePlayer == false) { Player = CreatePlayer(); isCreatePlayer = true; } //(敵がが存在しない場合)敵オブジェクトの作成 if (isCreateEnemies == false) { for (int i = 0; i < GetEnemyNum(); i++) { Enemies.Add(CreateEnemy(i)); } isCreateEnemies = true; } } }
//================================================================= //カーソルの処理 private void Cursor() { if (inputInterval <= 0) { //上にカーソルを移動 if (inputManager.InputGetter("up")) { cursorPoint--; if (cursorPoint <= -1) { cursorPoint = 1; } inputInterval++; } //下にカーソルを移動 if (inputManager.InputGetter("down")) { cursorPoint++; if (cursorPoint >= 2) { cursorPoint = 0; } inputInterval++; } //カーソル位置に応じた処理 switch (cursorPoint) { case 0: cursor.GetComponent <RectTransform>().localPosition = new Vector3(-110, 40, 0); if (inputManager.InputGetter("b1")) { //プレイングバイアス neuralNetworkManager.ApplyPlayingBias(ValueDefinition.PLAYING_BIAS_NEXT_FLOOR); //ニューラルネットワークに行動を入力として適用する actionSaver.ApplyActionToNeuralNetwork(); parameterManager.TransPattern = 2; manager.ActQueue.Add(manager.FadeScene("GameMain")); } break; case 1: cursor.GetComponent <RectTransform>().localPosition = new Vector3(-110, -40, 0); //メニューを閉じる if (inputManager.InputGetter("b1")) { manager.IsOperateOptionMenu = false; frame.SetActive(false); } break; default: break; } } //メニューを閉じる if (inputManager.InputGetter("b3")) { manager.IsOperateOptionMenu = false; frame.SetActive(false); } if (inputInterval >= 1) { inputInterval++; if (inputInterval >= ValueDefinition.INPUT_INTERVAL_CHECK_STAIR_DIALOG) { inputInterval = 0; } } }
//■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ //エフェクト生成 //_id -> エフェクトの種類 public void CreateEffect(int _id) { GameObject obj = null; int distance = 5 + 1; switch (_id) { case 0: //回復表示(薬草) manager.CreateApplyingHPText(this.gameObject, 50, 1); obj = Instantiate(Resources.Load("Prefabs/ItemEffect/RecoverEffect1")) as GameObject; obj.transform.SetParent(this.transform, false); //サウンドエフェクト soundManagerSE.TriggerSE(4); //プレイングバイアス neuralNetworkManager.ApplyPlayingBias(ValueDefinition.PLAYING_BIAS_ITEM_RECOVER_HITPOINT); break; //回復表示(食べ物) case 1: manager.CreateApplyingHPText(this.gameObject, 20, 2); obj = Instantiate(Resources.Load("Prefabs/ItemEffect/RecoverEffect2")) as GameObject; obj.transform.SetParent(this.transform, false); //サウンドエフェクト soundManagerSE.TriggerSE(4); //プレイングバイアス neuralNetworkManager.ApplyPlayingBias(ValueDefinition.PLAYING_BIAS_ITEM_RECOVER_ONAKAPOINT); break; //石を投げる case 2: obj = Instantiate(Resources.Load("Prefabs/ItemEffect/Stone")) as GameObject; //サウンドエフェクト soundManagerSE.TriggerSE(3); //敵がプレイヤーの正面にいるなら if (IsExistEnemyToForward(distance) != -1) { Enemy tmp = manager.Enemies[IsExistEnemyToForward(distance)].GetComponent <Enemy>(); StartCoroutine(obj.GetComponent <StoneEffect>().Throw(PosX, PosY, tmp.PosX, tmp.PosY, true)); ApplyDamageToEnemy(int.Parse(tmp.name), ValueDefinition.ITEMS_USED_TEXT[_id], 30); //プレイングバイアス neuralNetworkManager.ApplyPlayingBias(ValueDefinition.PLAYING_BIAS_ITEM_STONE_AIM_ENEMY); } else { textBox.Apply(ValueDefinition.ITEMS_USED_TEXT[_id], false); int toX = 0; int toY = 0; switch (Direction) { case 0: for (int i = 1; i < distance; i++) { if (IsAnotherObject(PosX + i, PosY)) { toX = i - 1; break; } if (i == distance - 1) { toX = i; } } break; case 45: for (int i = 1; i < distance / 2; i++) { if (IsAnotherObject(PosX + i, PosY + i)) { toX = i - 1; toY = i - 1; break; } if (fieldManager.IsRoom(PosX + i, PosY + i) == false) { if (i == 0) { toX = 0; toY = 0; } else { toX = i - 1; toY = i - 1; } break; } if (i == Mathf.CeilToInt(distance / 2) - 1) { toX = i; toY = i; } } break; case 90: for (int i = 1; i < distance; i++) { if (IsAnotherObject(PosX, PosY + i)) { toY = i - 1; break; } if (i == distance - 1) { toY = i; } } break; case 135: for (int i = 1; i < distance / 2; i++) { if (IsAnotherObject(PosX - i, PosY + i)) { toX = -(i - 1); toY = i - 1; break; } if (fieldManager.IsRoom(PosX - i, PosY + i) == false) { if (i == 0) { toX = 0; toY = 0; } else { toX = -(i - 1); toY = i - 1; } break; } if (i == Mathf.CeilToInt(distance / 2) - 1) { toX = -i; toY = i; } } break; case 180: for (int i = 1; i < distance; i++) { if (IsAnotherObject(PosX - i, PosY)) { toX = -(i - 1); break; } if (i == distance - 1) { toX = -i; } } break; case 225: for (int i = 1; i < distance / 2; i++) { if (IsAnotherObject(PosX - i, PosY - i)) { toX = -(i - 1); toY = -(i - 1); break; } if (fieldManager.IsRoom(PosX - i, PosY - i) == false) { if (i == 0) { toX = 0; toY = 0; } else { toX = -(i - 1); toY = -(i - 1); } break; } if (i == Mathf.CeilToInt(distance / 2) - 1) { toX = -i; toY = -i; } } break; case 270: for (int i = 1; i < distance; i++) { if (IsAnotherObject(PosX, PosY - i)) { toY = -(i - 1); break; } if (i == distance - 1) { toY = -i; } } break; case 315: for (int i = 1; i < distance / 2; i++) { if (IsAnotherObject(PosX + i, PosY - i)) { toX = i - 1; toY = -(i - 1); break; } if (fieldManager.IsRoom(PosX + i, PosY - i) == false) { if (i == 0) { toX = 0; toY = 0; } else { toX = i - 1; toY = -(i - 1); } break; } if (i == Mathf.CeilToInt(distance / 2) - 1) { toX = i; toY = -i; } } break; default: break; } StartCoroutine(obj.GetComponent <StoneEffect>().Throw(PosX, PosY, PosX + toX, PosY + toY, false)); } break; //杖 case 3: obj = Instantiate(Resources.Load("Prefabs/ItemEffect/Staff")) as GameObject; obj.transform.position = this.transform.position; //サウンドエフェクト soundManagerSE.TriggerSE(5); //敵がプレイヤーの正面にいるなら敵の位置を変更する if (IsExistEnemyToForward(distance) != -1) { //敵の位置を変更する Enemy tmp = manager.Enemies[IsExistEnemyToForward(distance)].GetComponent <Enemy>(); StartCoroutine(fieldManager.ChangeEnemiesPos(tmp)); //敵の位置にエフェクトを発生させる GameObject obj2 = Instantiate(Resources.Load("Prefabs/ItemEffect/JumpAnotherPos1")) as GameObject; obj2.transform.position = tmp.transform.position; //プレイングバイアス neuralNetworkManager.ApplyPlayingBias(ValueDefinition.PLAYING_BIAS_ITEM_STAFF_AIM_ENEMY); } break; default: Debug.Log("エフェクト生成エラー"); break; } }