Tic Tac Toe game development for Unity. Use for game logic, AI implementation, MVVM architecture, and UI development specific to this project.
Unity 6 での Tic Tac Toe(三目並べ)AI 対戦ゲーム開発のためのスキル定義。
このスキルは以下の作業時にトリガーされる:
Assets/TicTacToe/
├── Scenes/
│ └── TicTacToeScene.unity
├── Prefabs/UI/
│ ├── BoardPanel.prefab
│ ├── CellButton.prefab
│ ├── ResultPanel.prefab
│ └── TurnIndicator.prefab
├── Scripts/
│ ├── Core/ # Domain Layer
│ │ ├── Domain/ # Entities, Value Objects
│ │ ├── Repositories/ # Data Containers
│ │ ├── Services/ # Facades (Transaction Boundary)
│ │ └── Strategies/ # AI Algorithms
│ ├── Presentation/ # MVVM Layer
│ │ ├── Board/ # BoardView, BoardViewModel
│ │ ├── Cell/ # CellView, CellViewModel
│ │ ├── Result/ # ResultView, ResultViewModel
│ │ ├── TurnIndicator/ # TurnIndicatorView, TurnIndicatorViewModel
│ │ └── Mediators/ # GameMediator
│ ├── Infrastructure/ # DI, Factories
│ │ ├── Installers/
│ │ └── Factories/
│ └── EntryPoints/
├── Tests/
│ ├── EditMode/
│ └── PlayMode/
├── Audio/SE/
├── Art/Sprites/
└── Animations/
namespace TicTacToe.Core.Domain { }
namespace TicTacToe.Core.Repositories { }
namespace TicTacToe.Core.Services { }
namespace TicTacToe.Core.Strategies { }
namespace TicTacToe.Presentation.Board { }
namespace TicTacToe.Presentation.Cell { }
namespace TicTacToe.Presentation.Mediators { }
namespace TicTacToe.Infrastructure.Installers { }
// CellState.cs
public enum CellState { Empty, X, O }
// PlayerType.cs
public enum PlayerType { Human, AI }
// BoardPosition.cs
public readonly struct BoardPosition
{
public int Row { get; }
public int Column { get; }
}
// GameService.cs - Facade / Transaction Boundary
public class GameService
{
private readonly BoardRepository _boardRepository;
private readonly IAIStrategy _aiStrategy;
public IObservable<GameResult> OnGameEnd { get; }
public IObservable<PlayerType> OnTurnChanged { get; }
public void PlaceMark(BoardPosition position) { }
public void StartNewGame() { }
}
// ViewModel
public class CellViewModel : IDisposable
{
public IReadOnlyReactiveProperty<CellState> State { get; }
public IObservable<Unit> OnClicked { get; }
}
// View
public class CellView : MonoBehaviour
{
[Inject] private CellViewModel _viewModel;
[SerializeField] private Button _button;
[SerializeField] private Image _markImage;
}
public interface IAIStrategy
{
BoardPosition DecideMove(IReadOnlyList<CellState> board, CellState aiMark);
}
public class RandomAIStrategy : IAIStrategy { }
// Future: MinimaxAIStrategy, etc.
Assets/TicTacToe/Editor/WebGLBuildHelper.cs でビルド自動化:
TicTacToe/WebGL/1. Setup Build Settings → シーン設定
TicTacToe/WebGL/2. Configure WebGL Player Settings → プレイヤー設定
TicTacToe/WebGL/3. Switch to WebGL Platform → プラットフォーム切替
TicTacToe/WebGL/4. Build WebGL → ビルド実行
# 1. worktree作成(gh-pagesブランチ用)
git worktree add ../UnityTest-gh-pages gh-pages
# 2. ビルドファイルをコピー
cd ../UnityTest-gh-pages
rm -rf Build TemplateData index.html
cp -r ../UnityTest/Build/WebGL/* .
# 3. コミット & プッシュ
git add -A
git commit -m "Deploy WebGL build"
git push origin gh-pages
# 4. worktree削除
cd ../UnityTest
git worktree remove ../UnityTest-gh-pages
https://yuemori.github.io/UnityMCPTest/
| 問題 | 原因 | 解決策 |
|---|---|---|
| AI turns not progressing | Task.Delay() WebGL 非対応 |
Observable.Timer() (R3) 使用 |
| Brotli decode error | GitHub Pages Content-Encoding 未設定 |
圧縮形式 Disabled を使用 |
System.Threading.Tasksの使用を避け、R3 Observable を使用