Closed liupu9 closed 1 year ago
注 1: Celeste GamePlay 核心代码玩家控制开源, https://github.com/liupu9/Celeste/blob/master/Source/Player/Player.cs
注 2: 代码块详情
注 3: Monocle 框架提交记录. 没有任何修改的版本. https://github.com/liupu9/MonocleEngine/commit/9777be26119b21c870bb3c4c17a8a940218d8bd4
注 4: 后面的几个状态中文名明显是不太准确的, 如果有更好的翻译, 请在这里回复. :)
注 5: 提到了核心的状态机逻辑. 相关代码:
StateMachine = new StateMachine(23);
StateMachine.SetCallbacks(StNormal, NormalUpdate, null, NormalBegin, NormalEnd);
StateMachine.SetCallbacks(StClimb, ClimbUpdate, null, ClimbBegin, ClimbEnd);
StateMachine.SetCallbacks(StDash, DashUpdate, DashCoroutine, DashBegin, DashEnd);
StateMachine.SetCallbacks(StSwim, SwimUpdate, null, SwimBegin, null);
StateMachine.SetCallbacks(StBoost, BoostUpdate, BoostCoroutine, BoostBegin, BoostEnd);
StateMachine.SetCallbacks(StRedDash, RedDashUpdate, RedDashCoroutine, RedDashBegin, RedDashEnd);
StateMachine.SetCallbacks(StHitSquash, HitSquashUpdate, null, HitSquashBegin, null);
StateMachine.SetCallbacks(StLaunch, LaunchUpdate, null, LaunchBegin, null);
StateMachine.SetCallbacks(StPickup, null, PickupCoroutine, null, null);
StateMachine.SetCallbacks(StDreamDash, DreamDashUpdate, null, DreamDashBegin, DreamDashEnd);
StateMachine.SetCallbacks(StSummitLaunch, SummitLaunchUpdate, null, SummitLaunchBegin, null);
StateMachine.SetCallbacks(StDummy, DummyUpdate, null, DummyBegin, null);
StateMachine.SetCallbacks(StIntroWalk, null, IntroWalkCoroutine, null, null);
StateMachine.SetCallbacks(StIntroJump, null, IntroJumpCoroutine, null, null);
StateMachine.SetCallbacks(StIntroRespawn, null, null, IntroRespawnBegin, IntroRespawnEnd);
StateMachine.SetCallbacks(StIntroWakeUp, null, IntroWakeUpCoroutine, null, null);
StateMachine.SetCallbacks(StTempleFall, TempleFallUpdate, TempleFallCoroutine);
StateMachine.SetCallbacks(StReflectionFall, ReflectionFallUpdate, ReflectionFallCoroutine, ReflectionFallBegin, ReflectionFallEnd);
StateMachine.SetCallbacks(StBirdDashTutorial, BirdDashTutorialUpdate, BirdDashTutorialCoroutine, BirdDashTutorialBegin, null);
StateMachine.SetCallbacks(StFrozen, FrozenUpdate, null, null, null);
StateMachine.SetCallbacks(StStarFly, StarFlyUpdate, StarFlyCoroutine, StarFlyBegin, StarFlyEnd);
StateMachine.SetCallbacks(StCassetteFly, CassetteFlyUpdate, CassetteFlyCoroutine, CassetteFlyBegin, CassetteFlyEnd);
StateMachine.SetCallbacks(StAttract, AttractUpdate, null, AttractBegin, AttractEnd);
Add(StateMachine);
在学习了 2D-Platform-Controller 这个开源工程, 为其增加了 700+行注释之后, 对其功能也有了初步的了解. 在这个基础上, 我开始对原版 Celeste Player.cs 源文件进行代码正向注释. 期望在注经的过程中, 记录自己的进步与感悟.