/// <summary> /// ターンの切り替え処理 /// </summary> /// <param name="player"></param> void TurnChange(Enums.ARMY player) { switch (player) { case Enums.ARMY.ALLY: this.turnPlayer = player; StartPhase = MyStartPhase; StandbyPhase = MyStandbyPhase; FoucusPhase = MyFoucusPhase; MovePhase = MyMovePhase; BattleStandbyPhase = MyBattleStandbyPhase; BattlePhase = MyBattlePhase; ResultPhase = MyResultPhase; EndPhase = MyEndPhase; break; case Enums.ARMY.ENEMY: this.turnPlayer = player; StartPhase = EnemyStartPhase; StandbyPhase = EnemyStandbyPhase; FoucusPhase = EnemyFoucusPhase; MovePhase = EnemyMovePhase; BattleStandbyPhase = EnemyBattleStandbyPhase; BattlePhase = EnemyBattlePhase; ResultPhase = EnemyResultPhase; EndPhase = EnemyEndPhase; break; } }
/// <summary> /// 指定された軍の未行動ユニットがいるかどうかのチェック /// </summary> /// <returns>The get.</returns> /// <param name="army">Army.</param> //public static GameObject GetRandomUnBehaviorUnit(Enums.ARMY army) //{ // List<GameObject> unit = new List<GameObject>(); // for (int y = 0; y < MapManager.GetFieldData().height; y++) // for (int x = 0; x < MapManager.GetFieldData().width; x++) // if (mapUnitObj[y, x] != null && // mapUnitObj[y, x].gameObject.GetComponent<UnitInfo>().aRMY == army && // !mapUnitObj[y, x].gameObject.GetComponent<UnitInfo>().isMoving()) // units.Add(mapUnitObj[y, x]); // return unit; //} /// <summary> /// 指定された軍のユニットを全て未行動にする /// </summary> /// <returns>The get.</returns> /// <param name="army">Army.</param> public void UnBehaviorUnitAll(Enums.ARMY army) { for (int y = 0; y < fieldHeight; y++) { for (int x = 0; x < fieldWidth; x++) { if (mapUnitObj[y, x] != null && mapUnitObj[y, x].gameObject.GetComponent <UnitInfo>().aRMY == army) { mapUnitObj[y, x].GetComponent <UnitInfo>().Moving(false); mapUnitObj[y, x].GetComponent <EffectController>().GrayScale(false); } } } }
/// <summary> /// 指定された軍のユニットリストを返す /// </summary> /// <returns>The get.</returns> /// <param name="army">Army.</param> public List <GameObject> GetUnitList(Enums.ARMY army) { List <GameObject> units = new List <GameObject>(); for (int y = 0; y < fieldHeight; y++) { for (int x = 0; x < fieldWidth; x++) { if (mapUnitObj[y, x] != null && mapUnitObj[y, x].gameObject.GetComponent <UnitInfo>().aRMY == army) { units.Add(mapUnitObj[y, x]); } } } return(units); }
/// <summary> /// 指定された軍の未行動ユニットがいるかどうかチェックし、ランダムの1体を返す /// </summary> /// <returns>The un behavior unit.</returns> /// <param name="army">Army.</param> public GameObject GetUnBehaviorRandomUnit(Enums.ARMY army) { List <GameObject> units = new List <GameObject>(); for (int y = 0; y < fieldHeight; y++) { for (int x = 0; x < fieldWidth; x++) { if (mapUnitObj[y, x] != null && mapUnitObj[y, x].gameObject.GetComponent <UnitInfo>().aRMY == army && !mapUnitObj[y, x].gameObject.GetComponent <UnitInfo>().isMoving()) { units.Add(mapUnitObj[y, x]); } } } return((units.Count != 0) ? units[Random.Range(0, units.Count - 1)] : null); }