【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 character
LevelManager.Instance.Players[0].Freeze();

// sets the main character's max Health to 50
LevelManager.Instance.Players[0].gameObject.MMGetComponentNoAlloc<Health>().MaximumHealth = 50;

// forces the character to dash
LevelManager.Instance.Players[0].gameObject.MMGetComponentNoAlloc<CharacterDash>().StartDash();

Topdown Controller
Character組件作為一個(gè)中心點(diǎn)
Health組件來(lái)處理傷害問(wèn)題
Character Abilities 最重要的來(lái)封裝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. **需要一個(gè)方格管理器 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. 總是會(huì)停在方格上革砸,和其他的移動(dòng)方式不兼容

  • 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. 角色移動(dòng)

  • 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旋轉(zhuǎn)和朝向

  • 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. 可以在控制的時(shí)候修改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. 修改技能設(shè)置

自己寫(xiě)技能可參見(jiàn) 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是個(gè)什么東西
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. 判斷是否需要過(guò)渡
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條件以及目標(biāo)狀態(tài)
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

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末参滴,一起剝皮案震驚了整個(gè)濱河市府阀,隨后出現(xiàn)的幾起案子甘耿,更是在濱河造成了極大的恐慌,老刑警劉巖兽掰,帶你破解...
    沈念sama閱讀 217,657評(píng)論 6 505
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件芭碍,死亡現(xiàn)場(chǎng)離奇詭異,居然都是意外死亡孽尽,警方通過(guò)查閱死者的電腦和手機(jī)恭金,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,889評(píng)論 3 394
  • 文/潘曉璐 我一進(jìn)店門(mén)陌兑,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)烫映,“玉大人满俗,你說(shuō)我怎么就攤上這事∪芷洌” “怎么了?”我有些...
    開(kāi)封第一講書(shū)人閱讀 164,057評(píng)論 0 354
  • 文/不壞的土叔 我叫張陵,是天一觀的道長(zhǎng)晌砾。 經(jīng)常有香客問(wèn)我,道長(zhǎng)烦磁,這世上最難降的妖魔是什么养匈? 我笑而不...
    開(kāi)封第一講書(shū)人閱讀 58,509評(píng)論 1 293
  • 正文 為了忘掉前任,我火速辦了婚禮都伪,結(jié)果婚禮上呕乎,老公的妹妹穿的比我還像新娘。我一直安慰自己陨晶,他們只是感情好猬仁,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,562評(píng)論 6 392
  • 文/花漫 我一把揭開(kāi)白布。 她就那樣靜靜地躺著先誉,像睡著了一般逐虚。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上谆膳,一...
    開(kāi)封第一講書(shū)人閱讀 51,443評(píng)論 1 302
  • 那天叭爱,我揣著相機(jī)與錄音,去河邊找鬼漱病。 笑死买雾,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的杨帽。 我是一名探鬼主播漓穿,決...
    沈念sama閱讀 40,251評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼注盈!你這毒婦竟也來(lái)了晃危?” 一聲冷哼從身側(cè)響起,我...
    開(kāi)封第一講書(shū)人閱讀 39,129評(píng)論 0 276
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤老客,失蹤者是張志新(化名)和其女友劉穎僚饭,沒(méi)想到半個(gè)月后,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體胧砰,經(jīng)...
    沈念sama閱讀 45,561評(píng)論 1 314
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡鳍鸵,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,779評(píng)論 3 335
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了尉间。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片偿乖。...
    茶點(diǎn)故事閱讀 39,902評(píng)論 1 348
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡击罪,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出贪薪,到底是詐尸還是另有隱情媳禁,我是刑警寧澤,帶...
    沈念sama閱讀 35,621評(píng)論 5 345
  • 正文 年R本政府宣布画切,位于F島的核電站竣稽,受9級(jí)特大地震影響,放射性物質(zhì)發(fā)生泄漏槽唾。R本人自食惡果不足惜丧枪,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,220評(píng)論 3 328
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望庞萍。 院中可真熱鬧拧烦,春花似錦、人聲如沸钝计。這莊子的主人今日做“春日...
    開(kāi)封第一講書(shū)人閱讀 31,838評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)私恬。三九已至债沮,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間本鸣,已是汗流浹背疫衩。 一陣腳步聲響...
    開(kāi)封第一講書(shū)人閱讀 32,971評(píng)論 1 269
  • 我被黑心中介騙來(lái)泰國(guó)打工, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留荣德,地道東北人闷煤。 一個(gè)月前我還...
    沈念sama閱讀 48,025評(píng)論 2 370
  • 正文 我出身青樓,卻偏偏與公主長(zhǎng)得像涮瞻,于是被迫代替她去往敵國(guó)和親鲤拿。 傳聞我的和親對(duì)象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,843評(píng)論 2 354

推薦閱讀更多精彩內(nèi)容