acecase 发表于 2021-3-25 13:05

【Unity插件】Corgi Topdown Engine使用笔记

基本的角色Character


The best wayt to access the player(s) via script is via the LevelManager class,
// this will freeze your main characterLevelManager.Instance.Players.Freeze();// sets the main character's max Health to 50LevelManager.Instance.Players.gameObject.MMGetComponentNoAlloc<Health>().MaximumHealth = 50;// forces the character to dashLevelManager.Instance.Players.gameObject.MMGetComponentNoAlloc<CharacterDash>().StartDash();
Topdown Controller
Character组件作为一个中心点
Health组件来处理伤害问题
Character Abilities 最重要的来封装15种能力 (可选)
Standard Abilities


CharacterButtonActivation : This component allows your character to interact with button powered objects (dialogue zones, switches…). Nothing special to setup here. 按钮交互

CharacterConeOfVision : Projects a cone of vision around the character, that can be used to detect targets, or purely for decorative purposes. 侦查或装饰的光圈cone

CharacterCrouch : Allows for the resizing of the controller (and dedicated animations) when the crouch button is pressed蹲下

CharacterDash2D/3D : This ability allows the character to dash in the specified direction. You can decide on a Dash Mode, specify a curve animation to use to move the character, the dash’s duration, the distance it should cover, and more. 冲刺

CharacterFallDownHoles2D : A 2D only ability, it will make your character fall down “holes”, defined by the hole layer mask you’ll have specified in the TopDownController2D’s inspector. 可跌落

CharacterGridMovement : lets you walk on a grid (meaning your character will always stop its movement perfectly centered on a grid’s cell). This works in both 2D and 3D and will **require that a GridManager be present and properly setup in your scene. **需要一个方格管理器You’ll find examples of that setup in the Minimal2DGrid, Minimal3DGrid and Explodudes demo scenes. Note that this is a different system than the “regular” CharacterMovement, and most movement related abilities (jump, dash) or AI actions won’t work with grid movement. 总是会停在方格上,和其他的移动方式不兼容

CharacterHandleWeapon : Lets your character equip and use a weapon, whether it’s from an inventory or not. 装备和使用武器

CharacterHandleSecondaryWeapon : Same thing, but with one more weapon. 多一把武器

CharacterInventory : Lets your character bind itself to inventories, to be able to equip weapons and more. Note that the engine doesn’t support multiplayer inventories at the moment, but it’s been heavily requested and is coming to a future update. 可以装备和绑定

CharacterJump2D/3D : Will make your character jump when you press the jump button. Note that the 3D version will actually move your character’s controller, while the 2D version will keep it in place, an animation being responsible for the jump illusion. Note that in both cases, your character won’t be considered grounded anymore while jumping. 跳跃

CharacterMovement : Basic, ground based movement. You’ll be able to specify the walk speed, the idle threshold, acceleration and deceleration, footstep particles, and more from its inspector. You can also force free, 2, 4 or 8 directional movement. 角色移动

CharacterOrientation2D/3D : Will rotate or flip your character to have it face the movement’s direction, the weapon’s direction, or both. 带有方向的朝向

CharacterPathfinder3D : A 3D only ability, will let your character find a path on a navmesh. That navmesh will need to be present in the scene before it can be used though. 寻路3D

CharacterPause : Allows the character with this ability (and the player controlling it) to use the pause button to pause the game 可以暂停游戏的能力

CharacterRotation2D : Lets your 2D character change its model’s rotation to match the direction it’s going. 2d旋转和朝向

CharacterRun : Lets your character run at the specified speed when pressing the run button 按住奔跑键奔跑

CharacterSwap : This ability will allow you to swap control over multiple characters in a single scene. For an example of that, please refer to the Minimal2DCharacterSwap demo scene. Note that this ability is dependent on normal character instantiation by the LevelManager.多角色切换控制

CharacterSwitchModel : Lets you switch the appearance of your character for another model. 切换角色的model

CharacterTimeControl : Lets your character change the current timescale to the one specified in the inspector when pressing the Time Control button, for the duration of your choice, lerping it or not. 可以在控制的时候修改timescale

Character Ability Node Swap : This ability lets you specify a new set of abilities, and swap to them at the press of a button.修改技能设置

自己写技能可参见 https://topdown-engine-docs.moremountains.com/character-abilities.html#ability-overview
AI 部分


AIState : A State is a combination of one or more actions, and one or more transitions. An example of a state could be “patrolling until an enemy gets in range”. 不同action地组合
AIAction : Actions are behaviours and describe what your character is doing. Examples include patrolling, shooting, jumping, etc. The engine comes with a lot of predefined actions, and it’s very easy to create your own. 形容aciton是个什么东西
AIDecision : Decisions are components that will be evaluated by transitions, every frame, and will return true or false. Examples include time spent in a state, distance to a target, or object detection within an area. 判断是否需要过渡
AITransition : Transitions are a combination of one or more decisions and destination states whether or not these transitions are true or false. An example of a transition could be “if an enemy gets in range, transition to the Shooting state”. 包括了decisions条件以及目标状态
AIBrain : the AI brain is responsible for going from one state to the other based on the defined transitions. It’s basically just a collection of states, and it’s where you’ll link all the actions, decisions, states and transitions together. 将这些东西链接在一起
装备武器


需要有CharacterHandleWeapon的方法 -
Weapon Attachment
页: [1]
查看完整版本: 【Unity插件】Corgi Topdown Engine使用笔记