「UnityGameDeveloper。Professional」コースの将来の学生を、「シューティングゲームの敵の高度な人工知能」に関する公開ウェビナーに招待します。
前書き
多くのプロジェクトに取り組んできた何年にもわたって、Unityでゲームプロジェクトを構築するための明確なアプローチを開発しました。これは、特に拡張性と保守性が高いことが証明されています。
長い間、自分の考えを一般に適した形式に変換して書き留めたいと思っていました。
この記事は、2017年のGDCトーク(「Unityで迅速にUIを作成するためのデータバインディングアーキテクチャ」)の更新バージョンです。
免責事項:これらは、私の経験と開発の見通しを反映した、私が開発した実用的な推奨事項にすぎず、すべての問題に対する普遍的な解決策ではなく、すべてのプロジェクトまたはチームにとって唯一の正しいアプローチではないことを理解する必要があります。
:
, . , -, , . . , , , .
(inversion of control)
(MPI)
/ / (MVC)
(Unit testing)
, :
ClassA ServiceA/ServiceB. ClassA .
(DI — Dependency Injection) — . :
(Builder) ClassA, . ClassA , , , , .
Zenject/Extenject. . (reflection-baking), .
--
— . -- (Model-View-Controller — MVC), Unity, :
Monobehaviour- Unity (View), , , Unity. . [SerializeField] drag’n’drop Unity. , .
- . , Unity. , .
, , - . — , .
, (Message Passing). .
, , - . : . .
(notification messages), / (events):
:
struct MessageType {}
bus.Subscribe<MessageType>(()=>Debug.Log("Msg received"));
bus.Fire<MessageType>();, (Signals) — MVC. — , .
, UniRx, , , , . , , , .
() .
Unity NUnit NSubstitute .
:
var level = Substitute.For<ILevel>();
var buildings = Substitute.For<IBuildings>();
// test subject:
var build = new BuildController(null,buildings,level);
// smoke test
Assert.AreEqual(0, build.GetCurrentBuildCount());
// assert that `GetCurrent` was exactly called once
level.ReceivedWithAnyArgs(1).GetCurrent(); . , NSubstitute, , .
- 0:
var level = Substitute.For<ILevel>();
var bus = _container.Resolve<SignalBus>();
var buildCommandSent = false;
bus.Subscribe<BuildingBuild>(() => buildCommandSent = true);
// test subject
var build = new BuildController(bus,new BuildingsModel(),level);
// test call
build.Build(0);
Assert.AreEqual(1, build.GetCurrentBuildCount());
// assert signals was fired
Assert.IsTrue(buildCommandSent); , GetCurrentBuildCount 0. , — , .
"-, , Zenject?" ( )
, , SignalBus , NSubstitute -— , .
, .
. :
, Unity -, Unity , Unity . , Unity ( playmode ).
, , , , , :
,
SDK