まず、別のクラスの変数にアクセスするにはどうすればよいですか?
-値の参照元として機能する一般的なクラスが必要な場合は、クラスのインスタンスまたは静的クラスのいずれかを使用できますが、どちらも同じように適しています。
このクラスのインスタンスはデータベースであるため必要ないため、インスタンス変数ではなく、クラスの変数を正しく取得したいと思います。
-C ++で行うようにポインターの取得を参照する場合、それについて心配する必要はありません。新しいキーワードを使用しない限り、別のオブジェクトにイコライズされたすべてのオブジェクトがポインターになります。
scene_battleはプレイヤーと敵を呼び出します。プレイヤーと敵は私のデータベースからデータを取得します。基本的には、プレーヤークラスのインスタンスを繰り返すだけで、ゲームパーティーに基づいたIDが付けられます。
-私は以前にターンベースのゲームプレイを実装しましたが、これが私がそれを行った方法です、それは完全に最良の実装ではないことを覚えておいてください。
BattleManager
Members:
-BattleScenario (this contains all the meta data for your battle scenario, teams, map location, any modifiers that are related to a battle)
-Teams (this is a list of Team classes wich have players)
-TeamSequence(this is a list of team wich will be populated from Teams and will control the flow of the battle)
Functions:
-StartBattle
-EndBattle
-GiveTeamTurn (this function gets the TeamSequence and calls ActTurn on the Class Team and removes the team from the TeamSequence list)
-RepopulateTeamSequence(when the TeamSequence is empty this is called to repopulate the TeamSequence)
Team
Members:
-Players (this is a list of players)
Functions:
-ActTurn (this function calls a player that is still able to act during the turn, and tells him to act, this is where you prompt the user for actions or use your AI)
これは大きな線であり、実装しなければならないことをここに示していないものがたくさんあります。また、多くのコールバックがトリガーされることに注意してください。たとえば、プレーヤーが演技を終了し、チームにコールバックして、このターンは完了したことを伝え、そのチームは、完了するまでチームの別のメンバーに対してActTurnを呼び出す必要があります。チームのすべてのプレイヤーがこのターンに完了すると、バトルマネージャーへのコールバックをトリガーするチームにも同じことが言えます。
これがお役に立てば幸いです、GL!