PlayerControllerDemo.cs 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048
  1. using System;
  2. using System.Collections.Generic;
  3. using CIS;
  4. using DG.Tweening;
  5. using MonsterLove.StateMachine;
  6. using Spine;
  7. using UnityEngine;
  8. using Xft;
  9. public class PlayerControllerDemo : MonsterLove.StateMachine.StateMachineBehaviour, IBlowable, ILevelItem, IInputEventHandler, IPhysicsEventHandler, IPlayerController
  10. {
  11. public static PlayerControllerDemo Instance
  12. {
  13. get
  14. {
  15. if (PlayerControllerDemo._instance == null)
  16. {
  17. PlayerControllerDemo._instance = UnityEngine.Object.FindObjectOfType<PlayerControllerDemo>();
  18. }
  19. return PlayerControllerDemo._instance;
  20. }
  21. }
  22. public PlayerControllerDemo.ActionState currState
  23. {
  24. get
  25. {
  26. if (this.inited)
  27. {
  28. return (PlayerControllerDemo.ActionState)base.GetState();
  29. }
  30. return PlayerControllerDemo.ActionState.stand;
  31. }
  32. }
  33. public Vector2 Vel
  34. {
  35. get
  36. {
  37. return this.vel;
  38. }
  39. }
  40. public Vector2 Accel
  41. {
  42. get
  43. {
  44. return this.accel;
  45. }
  46. }
  47. public void _OnWindEnter(IBlowee localWind)
  48. {
  49. if (this.restting)
  50. {
  51. return;
  52. }
  53. this.bloweeStack.Add(localWind);
  54. this.accel = Vector2.zero;
  55. base.ChangeState(PlayerControllerDemo.ActionState.passiveAirWithWind, null);
  56. }
  57. public void _OnWindExit(IBlowee localWind)
  58. {
  59. if (this.restting)
  60. {
  61. return;
  62. }
  63. if (this.bloweeStack.Contains(localWind))
  64. {
  65. this.bloweeStack.Remove(localWind);
  66. }
  67. }
  68. public Bounds GetBounds()
  69. {
  70. return base.GetComponent<CircleCollider2D>().bounds;
  71. }
  72. public void KeyDown(KeyCode key)
  73. {
  74. if (SingletonMonoBehaviourClass<GameLogicMgr>.instance.IsPause())
  75. {
  76. return;
  77. }
  78. this.CheckInputDown(key);
  79. }
  80. public void KeyUp(KeyCode key)
  81. {
  82. if (SingletonMonoBehaviourClass<GameLogicMgr>.instance.IsPause())
  83. {
  84. return;
  85. }
  86. this.CheckInputUp(key);
  87. }
  88. public void OnReset()
  89. {
  90. if (this.invisible)
  91. {
  92. return;
  93. }
  94. this.restting = true;
  95. base.GetComponent<BoxCollider2D>().enabled = false;
  96. this.deathCount++;
  97. this.EndCheckAttack();
  98. this.blockInput = true;
  99. this.ResetInput();
  100. base.PauseStateMachine(true);
  101. this.animator.Play("Fall");
  102. base.ChangeState(PlayerControllerDemo.ActionState.passiveAir, null);
  103. this.accel = Vector2.zero;
  104. this.vel = Vector2.zero;
  105. this.inputDir = Vector2.zero;
  106. this.guid = Guid.NewGuid().ToString();
  107. Skeleton skeleton = base.GetComponent<SkeletonAnimator>().skeleton;
  108. DOTween.To(delegate(float x)
  109. {
  110. skeleton.a = x;
  111. }, skeleton.a, 0f, this.death2GhostClip.length * 0.5f);
  112. this.deathAnimator.transform.position = new Vector2(this.myTrans.position.x, this.myTrans.position.y + 75f);
  113. this.deathAnimator.Play("death2GhostPure");
  114. this.bloweeStack.Clear();
  115. Sequence s = DOTween.Sequence();
  116. s.AppendInterval(this.death2GhostClip.length);
  117. s.AppendCallback(delegate
  118. {
  119. this.deathAnimator.Play("death2Ghost");
  120. Vector2 b = this.myTrans.position;
  121. Vector2 vector = this.respawnPoint - b;
  122. float z = Mathf.Atan2(vector.y, vector.x) * 57.29578f;
  123. this.deathAnimator.transform.rotation = Quaternion.Euler(0f, 0f, z);
  124. this.deathAnimator.transform.position = new Vector2(this.myTrans.position.x, this.myTrans.position.y + 75f);
  125. if (this.respawnPoint != Vector2.zero)
  126. {
  127. this.myTrans.DOMove(new Vector3(this.respawnPoint.x, this.respawnPoint.y, this.myTrans.position.z), 0.3f, false);
  128. this.deathAnimator.transform.DOMove(new Vector3(this.respawnPoint.x, this.respawnPoint.y + 75f, this.myTrans.position.z), 0.3f, false);
  129. this.Invoke("Reset", 0.32f);
  130. }
  131. else
  132. {
  133. Log.Error("haven't set respawnPoint before use");
  134. }
  135. });
  136. }
  137. public void OnPause(bool isPause)
  138. {
  139. if (isPause)
  140. {
  141. this.animator.enabled = false;
  142. this.freezeTime = this.animator.GetCurrentAnimatorStateInfo(0).normalizedTime;
  143. }
  144. else
  145. {
  146. this.animator.enabled = true;
  147. AnimatorStateInfo currentAnimatorStateInfo = this.animator.GetCurrentAnimatorStateInfo(0);
  148. this.animator.Play(currentAnimatorStateInfo.fullPathHash, 0, this.freezeTime);
  149. }
  150. }
  151. public void OnEntertBlock(ILevelBlock block)
  152. {
  153. }
  154. public void OnLeaveBlock(ILevelBlock block)
  155. {
  156. }
  157. public void OnPickingTime(float time)
  158. {
  159. }
  160. public void _OnTriggerEnter(Collider2D other)
  161. {
  162. if (this.restting)
  163. {
  164. return;
  165. }
  166. if (other.CompareTag("Land"))
  167. {
  168. this.hasLand = true;
  169. if (this.currState == PlayerControllerDemo.ActionState.jump || this.currState == PlayerControllerDemo.ActionState.passiveAir)
  170. {
  171. base.ChangeState(PlayerControllerDemo.ActionState.land, null);
  172. }
  173. }
  174. else if (other.CompareTag("Lantern") || other.CompareTag("Attackable"))
  175. {
  176. this.isInLantern = true;
  177. this.currAttackableList.Add(other.gameObject.GetComponent<Attackable>());
  178. if (this.isAttack && this.checkAttackLantern())
  179. {
  180. this.isAttack = false;
  181. this.attackWindowTimer = 0f;
  182. this.realAttack = true;
  183. if (this.currState != PlayerControllerDemo.ActionState.passiveAir)
  184. {
  185. base.ChangeState(PlayerControllerDemo.ActionState.attack, null);
  186. }
  187. }
  188. }
  189. else if (other.CompareTag("Gear") && !this.invisible)
  190. {
  191. SingletonMonoBehaviourClass<GameLogicMgr>.instance.Reset();
  192. PlayerDataMgr.Instance.PersistSectionData();
  193. HurtableDotsGetter component = other.GetComponent<HurtableDotsGetter>();
  194. if (component != null)
  195. {
  196. ParticleSystemAttractor component2 = base.GetComponent<ParticleSystemAttractor>();
  197. if (component2 != null)
  198. {
  199. component2.Attract(component.dotsParticleSystem, this.myTrans, new Vector3(0f, 100f, 0f), 2.2f);
  200. }
  201. }
  202. }
  203. }
  204. public void _OnTriggerExit(Collider2D other)
  205. {
  206. if (this.restting)
  207. {
  208. return;
  209. }
  210. if (other.CompareTag("Lantern") || other.CompareTag("Attackable"))
  211. {
  212. Attackable component = other.gameObject.GetComponent<Attackable>();
  213. for (int i = 0; i < this.currAttackableList.Count; i++)
  214. {
  215. if (component == this.currAttackableList[i])
  216. {
  217. this.currAttackableList.RemoveAt(i);
  218. break;
  219. }
  220. }
  221. if (this.currAttackableList.Count == 0)
  222. {
  223. this.isInLantern = false;
  224. }
  225. }
  226. else if (other.CompareTag("Land"))
  227. {
  228. this.hasLand = false;
  229. if (this.currState == PlayerControllerDemo.ActionState.jump || this.currState == PlayerControllerDemo.ActionState.passiveAir)
  230. {
  231. base.ChangeState(PlayerControllerDemo.ActionState.stand, null);
  232. }
  233. }
  234. }
  235. public void _OnTriggerStay(Collider2D collider)
  236. {
  237. }
  238. public void _OnCollisionStay(Collider2D collider)
  239. {
  240. if (collider.CompareTag("Land") && this.currState == PlayerControllerDemo.ActionState.passiveAir && !this.landBeWall)
  241. {
  242. this.hasLand = true;
  243. }
  244. }
  245. public bool _OnCollisionEnter(Collider2D coll, Vector2 normal)
  246. {
  247. if (this.restting)
  248. {
  249. return false;
  250. }
  251. if (coll.CompareTag("Land"))
  252. {
  253. SoundMgr.Instance.PlaySfx("PawnDown", 0.7f, false, 0f, 0f);
  254. if (normal.x > 0f)
  255. {
  256. this.isCollideWithWall = true;
  257. this.landBeWall = true;
  258. this.currContactNormal = normal;
  259. return true;
  260. }
  261. if (normal.x < 0f)
  262. {
  263. this.isCollideWithWall = true;
  264. this.landBeWall = true;
  265. this.currContactNormal = normal;
  266. return true;
  267. }
  268. if (normal.y <= 0f)
  269. {
  270. this.accel.y = 0f;
  271. this.vel.y = 0f;
  272. return false;
  273. }
  274. this.hasLand = true;
  275. PlayerCollisionChecker playerCollisionChecker = this.checkerForLand;
  276. if (this.myTrans.position.y + playerCollisionChecker.offset.y - playerCollisionChecker.size.y / 2f < coll.bounds.center.y + coll.bounds.extents.y)
  277. {
  278. this.myTrans.position = new Vector2(this.myTrans.position.x, coll.bounds.center.y + coll.bounds.extents.y + playerCollisionChecker.size.y / 2f - playerCollisionChecker.offset.y - 1f);
  279. }
  280. if (this.currState == PlayerControllerDemo.ActionState.roll || this.currState == PlayerControllerDemo.ActionState.jump || this.currState == PlayerControllerDemo.ActionState.passiveAir || this.currState == PlayerControllerDemo.ActionState.attack || this.currState == PlayerControllerDemo.ActionState.passiveAirWithWind)
  281. {
  282. base.ChangeState(PlayerControllerDemo.ActionState.land, null);
  283. }
  284. }
  285. else if (coll.CompareTag("Wall"))
  286. {
  287. this.isCollideWithWall = true;
  288. this.currContactNormal = normal;
  289. PlayerCollisionChecker playerCollisionChecker2 = this.checkerForWall;
  290. float num = 0f;
  291. float num2 = 0f;
  292. if (playerCollisionChecker2.shape == PlayerCollisionChecker.Shape.box)
  293. {
  294. num = playerCollisionChecker2.size.x / 2f;
  295. num2 = playerCollisionChecker2.size.y / 2f;
  296. }
  297. else if (playerCollisionChecker2.shape == PlayerCollisionChecker.Shape.circle)
  298. {
  299. num2 = (num = playerCollisionChecker2.radius);
  300. }
  301. if (normal.x < -0.1f)
  302. {
  303. if (this.myTrans.position.x + playerCollisionChecker2.offset.x + num > coll.bounds.center.x - coll.bounds.extents.x)
  304. {
  305. this.myTrans.position = new Vector2(coll.bounds.center.x - coll.bounds.extents.x - playerCollisionChecker2.offset.x - num + 0.5f, this.myTrans.position.y);
  306. }
  307. }
  308. else if (normal.x > 0.1f && this.myTrans.position.x + playerCollisionChecker2.offset.x - num < coll.bounds.center.x + coll.bounds.extents.x)
  309. {
  310. this.myTrans.position = new Vector2(coll.bounds.center.x + coll.bounds.extents.x - playerCollisionChecker2.offset.x + num - 0.5f, this.myTrans.position.y);
  311. }
  312. if (normal.y < -0.1f)
  313. {
  314. if (this.myTrans.position.y + playerCollisionChecker2.offset.y + num2 > coll.bounds.center.y - coll.bounds.extents.y)
  315. {
  316. this.myTrans.position = new Vector2(this.myTrans.position.x, coll.bounds.center.y - coll.bounds.extents.y - playerCollisionChecker2.offset.y - num2);
  317. }
  318. }
  319. else if (normal.y > 0.1f && this.myTrans.position.y + playerCollisionChecker2.offset.y - num2 < coll.bounds.center.y + coll.bounds.extents.y)
  320. {
  321. this.myTrans.position = new Vector2(this.myTrans.position.x, coll.bounds.center.y + coll.bounds.extents.y - playerCollisionChecker2.offset.y + num2);
  322. }
  323. }
  324. return true;
  325. }
  326. public void _OnCollisionExit(Collider2D coll)
  327. {
  328. if (this.restting)
  329. {
  330. return;
  331. }
  332. if (coll.CompareTag("Land"))
  333. {
  334. this.hasLand = false;
  335. if (this.landBeWall)
  336. {
  337. this.landBeWall = false;
  338. this.isCollideWithWall = false;
  339. }
  340. }
  341. else if (coll.CompareTag("Wall"))
  342. {
  343. this.isCollideWithWall = false;
  344. }
  345. }
  346. public Transform Transform
  347. {
  348. get
  349. {
  350. return base.transform;
  351. }
  352. }
  353. public void SetRespawnPoint(Vector2 point)
  354. {
  355. this.respawnPoint = point;
  356. }
  357. public Vector2 Velocity
  358. {
  359. get
  360. {
  361. if (this.currState == PlayerControllerDemo.ActionState.stand)
  362. {
  363. return Vector2.zero;
  364. }
  365. return this.Vel;
  366. }
  367. }
  368. public void PlayAnimation(string animeName)
  369. {
  370. this.animator.Play(animeName);
  371. }
  372. public GameObject GameObject
  373. {
  374. get
  375. {
  376. return base.gameObject;
  377. }
  378. }
  379. private static void log(string str)
  380. {
  381. PlayerControllerDemo.pDocument = PlayerControllerDemo.pDocument + "\n" + str;
  382. }
  383. public void Stop()
  384. {
  385. this.inputDir = Vector2.zero;
  386. base.ChangeState(PlayerControllerDemo.ActionState.stand, null);
  387. }
  388. public void SetDirection(int dir)
  389. {
  390. if (dir > 0)
  391. {
  392. this.myTrans.localScale = new Vector3(1f, 1f, 1f);
  393. }
  394. else
  395. {
  396. this.myTrans.localScale = new Vector3(-1f, 1f, 1f);
  397. }
  398. this.direction = dir;
  399. }
  400. public void ResetInputStatus()
  401. {
  402. this.inputDir = Vector2.zero;
  403. }
  404. private void Awake()
  405. {
  406. this.myTrans = base.transform;
  407. this.animator = base.GetComponent<Animator>();
  408. base.Initialize<PlayerControllerDemo.ActionState>();
  409. }
  410. private void Start()
  411. {
  412. base.ChangeState(PlayerControllerDemo.ActionState.stand, null);
  413. this.direction = 1;
  414. if (this.inputMethod == PlayerControllerDemo.InputMethod.newMethod)
  415. {
  416. SingletonMonoBehaviourClass<InputMgr>.instance.RegisterInputEventHandler(this);
  417. }
  418. this.guid = Guid.NewGuid().ToString();
  419. PlayerCollisionChecker[] componentsInChildren = this.myTrans.GetComponentsInChildren<PlayerCollisionChecker>();
  420. foreach (PlayerCollisionChecker playerCollisionChecker in componentsInChildren)
  421. {
  422. if (playerCollisionChecker.gameObject.name.Contains("wall"))
  423. {
  424. this.checkerForWall = playerCollisionChecker;
  425. }
  426. else if (playerCollisionChecker.gameObject.name.Contains("land"))
  427. {
  428. this.checkerForLand = playerCollisionChecker;
  429. }
  430. playerCollisionChecker.RegisterHandler(this);
  431. }
  432. this.inited = true;
  433. RuntimeAnimatorController runtimeAnimatorController = this.animator.runtimeAnimatorController;
  434. for (int j = 0; j < runtimeAnimatorController.animationClips.Length; j++)
  435. {
  436. if (runtimeAnimatorController.animationClips[j].name == "atk1")
  437. {
  438. this.atkAnimationLength = runtimeAnimatorController.animationClips[j].length;
  439. }
  440. }
  441. }
  442. public void FixSide()
  443. {
  444. if ((float)this.direction * this.myTrans.localScale.x < 0f)
  445. {
  446. this.myTrans.localScale = new Vector2((float)this.direction, 1f);
  447. }
  448. }
  449. private void CheckInputDown(KeyCode key)
  450. {
  451. if (this.blockInput)
  452. {
  453. return;
  454. }
  455. bool flag = false;
  456. if (key == KeyCode.R)
  457. {
  458. SingletonMonoBehaviourClass<GameLogicMgr>.instance.Reset();
  459. }
  460. if (key == KeyCode.T)
  461. {
  462. this.deathCount = 0;
  463. SingletonMonoBehaviourClass<GameLogicMgr>.instance.ClearLevelTimeText();
  464. }
  465. if (key == KeyCode.A)
  466. {
  467. this.leftButtonPressed = true;
  468. this.inputDir.x = -1f;
  469. if (this.direction > 0)
  470. {
  471. this.OnDirectionChanged(-1);
  472. flag = true;
  473. }
  474. this.direction = -1;
  475. if ((this.currState == PlayerControllerDemo.ActionState.run || this.currState == PlayerControllerDemo.ActionState.accRun) && flag)
  476. {
  477. base.ChangeState(PlayerControllerDemo.ActionState.slideTurn, "directPlay");
  478. }
  479. if (this.currState == PlayerControllerDemo.ActionState.slide && Mathf.Abs(this.vel.x) > this.maxRunSpeed * 0.5f)
  480. {
  481. base.ChangeState(PlayerControllerDemo.ActionState.slideTurn, null);
  482. }
  483. }
  484. else if (key == KeyCode.D)
  485. {
  486. this.rightButtonPressed = true;
  487. this.inputDir.x = 1f;
  488. if (this.direction < 0)
  489. {
  490. this.OnDirectionChanged(1);
  491. flag = true;
  492. }
  493. this.direction = 1;
  494. if ((this.currState == PlayerControllerDemo.ActionState.run || this.currState == PlayerControllerDemo.ActionState.accRun) && flag)
  495. {
  496. base.ChangeState(PlayerControllerDemo.ActionState.slideTurn, "directPlay");
  497. }
  498. if (this.currState == PlayerControllerDemo.ActionState.slide && Mathf.Abs(this.vel.x) > this.maxRunSpeed * 0.5f)
  499. {
  500. base.ChangeState(PlayerControllerDemo.ActionState.slideTurn, null);
  501. }
  502. }
  503. else if (key == KeyCode.J)
  504. {
  505. this.actionButtonPressed = true;
  506. }
  507. }
  508. private void CheckInputUp(KeyCode key)
  509. {
  510. if (this.blockInput)
  511. {
  512. return;
  513. }
  514. if (key == KeyCode.A)
  515. {
  516. this.leftButtonPressed = false;
  517. }
  518. else if (key == KeyCode.D)
  519. {
  520. this.rightButtonPressed = false;
  521. }
  522. if (key == KeyCode.A && this.inputDir.x == -1f)
  523. {
  524. this.inputDir.x = 0f;
  525. }
  526. else if (key == KeyCode.D && this.inputDir.x == 1f)
  527. {
  528. this.inputDir.x = 0f;
  529. }
  530. if (key == KeyCode.J)
  531. {
  532. this.actionButtonPressed = false;
  533. }
  534. }
  535. private void CheckInput()
  536. {
  537. if (UnityEngine.Input.GetKeyDown(KeyCode.T))
  538. {
  539. this.deathCount = 0;
  540. SingletonMonoBehaviourClass<GameLogicMgr>.instance.ClearLevelTimeText();
  541. }
  542. if (this.inputMethod == PlayerControllerDemo.InputMethod.newMethod)
  543. {
  544. return;
  545. }
  546. if (this.blockInput)
  547. {
  548. return;
  549. }
  550. bool flag = false;
  551. if (UnityEngine.Input.GetKeyDown(KeyCode.A))
  552. {
  553. this.inputDir.x = -1f;
  554. if (this.direction > 0)
  555. {
  556. this.OnDirectionChanged(-1);
  557. flag = true;
  558. }
  559. this.direction = -1;
  560. PlayerControllerDemo.ActionState currState = this.currState;
  561. if (currState == PlayerControllerDemo.ActionState.run && flag)
  562. {
  563. this.accel = this.Run2StandAccel;
  564. UnityEngine.Debug.Log("a vel: " + this.vel);
  565. UnityEngine.Debug.Log("accel: " + this.accel);
  566. base.ChangeState(PlayerControllerDemo.ActionState.slideTurn, null);
  567. }
  568. }
  569. else if (UnityEngine.Input.GetKeyDown(KeyCode.D))
  570. {
  571. this.inputDir.x = 1f;
  572. if (this.direction < 0)
  573. {
  574. this.OnDirectionChanged(1);
  575. flag = true;
  576. }
  577. this.direction = 1;
  578. if (this.currState == PlayerControllerDemo.ActionState.run && flag)
  579. {
  580. this.accel = this.Run2StandAccel;
  581. UnityEngine.Debug.Log("d vel: " + this.vel);
  582. UnityEngine.Debug.Log("accel: " + this.accel);
  583. base.ChangeState(PlayerControllerDemo.ActionState.slideTurn, null);
  584. }
  585. }
  586. if (UnityEngine.Input.GetKeyUp(KeyCode.A) && this.inputDir.x == -1f)
  587. {
  588. this.inputDir.x = 0f;
  589. }
  590. else if (UnityEngine.Input.GetKeyUp(KeyCode.D) && this.inputDir.x == 1f)
  591. {
  592. this.inputDir.x = 0f;
  593. }
  594. }
  595. private void ApplayGravity(float dt)
  596. {
  597. if (this.currAttackableList.Count == 0)
  598. {
  599. this.vel.y = this.vel.y + this.gravity.y * dt;
  600. }
  601. else
  602. {
  603. Attackable nearestAttackable = this.GetNearestAttackable();
  604. if (nearestAttackable.AffectGravity())
  605. {
  606. this.vel.y = this.vel.y + this.gravity.y * nearestAttackable.gravityFactor * dt;
  607. }
  608. else
  609. {
  610. this.vel.y = this.vel.y + this.gravity.y * dt;
  611. }
  612. }
  613. }
  614. private void InterpolatePos(float dt)
  615. {
  616. if (this.testing)
  617. {
  618. return;
  619. }
  620. this.tempVec2 = this.myTrans.position;
  621. if (this.vel.x > this.maxRunSpeed)
  622. {
  623. if (this.currState == PlayerControllerDemo.ActionState.accRun)
  624. {
  625. base.ChangeState(PlayerControllerDemo.ActionState.run, null);
  626. }
  627. this.vel.x = this.maxRunSpeed;
  628. }
  629. else if (this.vel.x < -this.maxRunSpeed)
  630. {
  631. if (this.currState == PlayerControllerDemo.ActionState.accRun)
  632. {
  633. base.ChangeState(PlayerControllerDemo.ActionState.run, null);
  634. }
  635. this.vel.x = -this.maxRunSpeed;
  636. }
  637. this.vel += this.accel * dt;
  638. if (this.currState == PlayerControllerDemo.ActionState.passiveAirWithWind)
  639. {
  640. if (this.bloweeStack.Count > 0)
  641. {
  642. IBlowee blowee = this.bloweeStack[this.bloweeStack.Count - 1];
  643. LocalWind localWind = blowee as LocalWind;
  644. if (localWind != null)
  645. {
  646. this.vel.y = Mathf.Clamp(this.vel.y, localWind.minHeroYSpeed, localWind.maxHeroYSpeed);
  647. }
  648. }
  649. }
  650. else
  651. {
  652. this.vel.y = Mathf.Clamp(this.vel.y, this.minYVel, this.maxYVel);
  653. }
  654. if (this.isCollideWithWall)
  655. {
  656. Vector2 rhs = this.currContactNormal;
  657. float num = Vector2.Dot(this.vel.normalized, rhs);
  658. if (num < 0f)
  659. {
  660. float num2 = Mathf.Atan2(rhs.y, rhs.x) * 57.29578f;
  661. if ((num2 > -35f && num2 < 35f) || (num2 > 145f && num2 < 215f) || (num2 < -145f && num2 > -215f))
  662. {
  663. this.vel.x = 0f;
  664. }
  665. if (num2 < -55f && num2 > -125f)
  666. {
  667. this.vel.y = 0f;
  668. }
  669. }
  670. }
  671. if (this.hasLand && this.vel.y < 0f)
  672. {
  673. this.vel.y = 0f;
  674. }
  675. this.animator.SetFloat("speedX", Mathf.Abs(this.vel.x));
  676. this.tempVec2.x = this.tempVec2.x + this.vel.x * dt;
  677. if (!this.hasLand || this.vel.y >= 0f)
  678. {
  679. this.tempVec2.y = this.tempVec2.y + this.vel.y * dt;
  680. }
  681. this.myTrans.position = this.tempVec2;
  682. if (this.turnDirection)
  683. {
  684. this.turnDirection = false;
  685. }
  686. }
  687. private Vector2 GetInputDir()
  688. {
  689. return this.inputDir;
  690. }
  691. private void Stand_KeyDown(KeyCode key)
  692. {
  693. }
  694. private void Stand_KeyUp(KeyCode key)
  695. {
  696. }
  697. private void stand_Enter(object userData = null)
  698. {
  699. if (this.inputDir.x != 0f)
  700. {
  701. base.ChangeState(PlayerControllerDemo.ActionState.run, userData);
  702. return;
  703. }
  704. this.vel = Vector2.zero;
  705. this.accel = Vector2.zero;
  706. if (userData != null)
  707. {
  708. string text = userData as string;
  709. if (text != null && text == "directPlay")
  710. {
  711. this.animator.Play("StandRun");
  712. }
  713. }
  714. else
  715. {
  716. this.animator.SetTrigger("standRun");
  717. }
  718. }
  719. private void stand_Exit(object userData = null)
  720. {
  721. this.animator.ResetTrigger("standRun");
  722. }
  723. private void stand_Update()
  724. {
  725. float deltaTime = SingletonMonoBehaviourClass<TimeMgr>.instance.deltaTime;
  726. this.CheckInput();
  727. if (this.inputDir.x > 0f || this.inputDir.x < 0f)
  728. {
  729. base.ChangeState(PlayerControllerDemo.ActionState.run, null);
  730. return;
  731. }
  732. AnimatorStateInfo currentAnimatorStateInfo = this.animator.GetCurrentAnimatorStateInfo(0);
  733. bool flag = this.actionButtonPressed;
  734. if (!this.hasLand)
  735. {
  736. base.ChangeState(PlayerControllerDemo.ActionState.passiveAir, null);
  737. return;
  738. }
  739. if (flag && currentAnimatorStateInfo.IsName("StandRun"))
  740. {
  741. base.ChangeState(PlayerControllerDemo.ActionState.jump, "preJump");
  742. return;
  743. }
  744. this.InterpolatePos(deltaTime);
  745. }
  746. private void slide_Enter(object userData = null)
  747. {
  748. this.animator.SetTrigger("slide");
  749. }
  750. private void slide_Exit(object userData = null)
  751. {
  752. this.animator.ResetTrigger("slide");
  753. }
  754. private void slide_Update()
  755. {
  756. this.CheckInput();
  757. if (this.actionButtonPressed)
  758. {
  759. this.accel.x = 0f;
  760. this.actionButtonPressed = false;
  761. base.ChangeState(PlayerControllerDemo.ActionState.jump, null);
  762. return;
  763. }
  764. bool flag = this.animator.IsInTransition(0);
  765. if (this.vel.x > 0f)
  766. {
  767. this.accel.x = this.Run2StandAccel.x;
  768. this.slideSign = -1;
  769. }
  770. else
  771. {
  772. this.accel.x = -this.Run2StandAccel.x;
  773. this.slideSign = 1;
  774. }
  775. if (this.vel.x == 0f)
  776. {
  777. base.ChangeState(PlayerControllerDemo.ActionState.stand, null);
  778. return;
  779. }
  780. this.InterpolatePos(SingletonMonoBehaviourClass<TimeMgr>.instance.deltaTime);
  781. if (!flag)
  782. {
  783. if (this.slideSign > 0)
  784. {
  785. if (this.vel.x >= 0f)
  786. {
  787. if (this.inputDir.x != 0f)
  788. {
  789. base.ChangeState(PlayerControllerDemo.ActionState.run, null);
  790. return;
  791. }
  792. base.ChangeState(PlayerControllerDemo.ActionState.stand, null);
  793. return;
  794. }
  795. }
  796. else if (this.vel.x <= 0f)
  797. {
  798. if (this.inputDir.x != 0f)
  799. {
  800. base.ChangeState(PlayerControllerDemo.ActionState.run, null);
  801. return;
  802. }
  803. base.ChangeState(PlayerControllerDemo.ActionState.stand, null);
  804. return;
  805. }
  806. }
  807. if (!this.hasLand)
  808. {
  809. base.ChangeState(PlayerControllerDemo.ActionState.passiveAir, null);
  810. }
  811. }
  812. private void accRun_Enter(object userData = null)
  813. {
  814. this.animator.Play("accRun");
  815. if (this.direction > 0)
  816. {
  817. this.accel = this.stand2RunAccel;
  818. }
  819. else
  820. {
  821. this.accel = this.stand2RunAccel;
  822. this.accel.x = this.accel.x * -1f;
  823. }
  824. }
  825. private void AnimeEnd_accRun()
  826. {
  827. if (this.inputDir.x != 0f)
  828. {
  829. base.ChangeState(PlayerControllerDemo.ActionState.run, null);
  830. }
  831. else
  832. {
  833. base.ChangeState(PlayerControllerDemo.ActionState.stand, null);
  834. }
  835. }
  836. private void accRun_Update()
  837. {
  838. if (!this.hasLand)
  839. {
  840. base.ChangeState(PlayerControllerDemo.ActionState.passiveAir, null);
  841. return;
  842. }
  843. bool flag = this.actionButtonPressed;
  844. if (flag)
  845. {
  846. base.ChangeState(PlayerControllerDemo.ActionState.jump, "preJump");
  847. return;
  848. }
  849. if (this.inputDir.x == 0f)
  850. {
  851. base.ChangeState(PlayerControllerDemo.ActionState.slide, null);
  852. return;
  853. }
  854. this.InterpolatePos(SingletonMonoBehaviourClass<TimeMgr>.instance.deltaTime);
  855. this.PlayFootstepSound();
  856. }
  857. private void slideTurn_Enter(object userData = null)
  858. {
  859. if (userData != null)
  860. {
  861. this.animator.Play("SlideTurn");
  862. }
  863. else
  864. {
  865. this.animator.SetTrigger("slideTurn");
  866. }
  867. this.PlayTurnSmokeAnimation(1f);
  868. }
  869. private void slideTurn_Exit(object userData = null)
  870. {
  871. this.animator.ResetTrigger("slideTurn");
  872. }
  873. private void AnimeEnd_slideTurn()
  874. {
  875. if (this.inputDir.x != 0f)
  876. {
  877. base.ChangeState(PlayerControllerDemo.ActionState.accRun, null);
  878. }
  879. else
  880. {
  881. base.ChangeState(PlayerControllerDemo.ActionState.stand, null);
  882. }
  883. }
  884. private void slideTurn_Update()
  885. {
  886. if (!this.hasLand)
  887. {
  888. base.ChangeState(PlayerControllerDemo.ActionState.passiveAir, null);
  889. return;
  890. }
  891. this.CheckInput();
  892. if (this.vel.x > 0f)
  893. {
  894. this.accel.x = this.Run2StandAccel.x;
  895. this.slideSign = -1;
  896. }
  897. else
  898. {
  899. this.accel.x = -this.Run2StandAccel.x;
  900. this.slideSign = 1;
  901. }
  902. if (this.vel.x == 0f)
  903. {
  904. base.ChangeState(PlayerControllerDemo.ActionState.stand, null);
  905. return;
  906. }
  907. this.InterpolatePos(SingletonMonoBehaviourClass<TimeMgr>.instance.deltaTime);
  908. }
  909. private void OnDirectionChanged(int dir)
  910. {
  911. if (dir > 0)
  912. {
  913. this.myTrans.localScale = new Vector3(1f, 1f, 1f);
  914. this.accel.x = this.stand2RunAccel.x;
  915. }
  916. else
  917. {
  918. this.myTrans.localScale = new Vector3(-1f, 1f, 1f);
  919. this.accel.x = -this.stand2RunAccel.x;
  920. }
  921. if (this.currentEffect != null)
  922. {
  923. this.currentEffect.transform.localScale = ((this.currentEffect.transform.lossyScale.x <= 0f) ? new Vector2(-1f, 1f) : new Vector2(1f, 1f));
  924. this.currentEffect.SetScale(this.myTrans.localScale, "slash_distortion");
  925. }
  926. this.turnDirection = true;
  927. }
  928. private void ResetFootstepSound()
  929. {
  930. this.audioTimer = 0f;
  931. }
  932. private void PlayFootstepSound()
  933. {
  934. this.audioTimer += SingletonMonoBehaviourClass<TimeMgr>.instance.deltaTime;
  935. if (this.audioTimer > 0.27f)
  936. {
  937. this.audioTimer = 0f;
  938. SoundMgr.Instance.PlaySfx("FootStep", 1f, false, 0f, 0f);
  939. }
  940. }
  941. private void run_Enter(object userData = null)
  942. {
  943. if (this.direction > 0)
  944. {
  945. this.accel = this.stand2RunAccel;
  946. }
  947. else
  948. {
  949. this.accel = this.stand2RunAccel;
  950. this.accel.x = this.accel.x * -1f;
  951. }
  952. if (userData != null)
  953. {
  954. string text = userData as string;
  955. if (text != null && text == "directPlay")
  956. {
  957. this.animator.Play("StandRun");
  958. }
  959. }
  960. else
  961. {
  962. this.animator.SetTrigger("standRun");
  963. }
  964. this.ResetFootstepSound();
  965. }
  966. private void run_Exit(object userData = null)
  967. {
  968. this.ResetFootstepSound();
  969. this.animator.ResetTrigger("standRun");
  970. }
  971. private void run_Update()
  972. {
  973. float deltaTime = SingletonMonoBehaviourClass<TimeMgr>.instance.deltaTime;
  974. this.CheckInput();
  975. if (Mathf.Abs(this.vel.x) > this.maxRunSpeed)
  976. {
  977. this.accel.x = 0f;
  978. }
  979. if (this.inputDir.x == 0f)
  980. {
  981. if (this.vel.x != 0f)
  982. {
  983. this.accel = this.Run2StandAccel;
  984. base.ChangeState(PlayerControllerDemo.ActionState.slide, null);
  985. }
  986. else
  987. {
  988. base.ChangeState(PlayerControllerDemo.ActionState.stand, null);
  989. }
  990. return;
  991. }
  992. bool keyDown;
  993. if (this.inputMethod == PlayerControllerDemo.InputMethod.newMethod)
  994. {
  995. keyDown = this.actionButtonPressed;
  996. }
  997. else
  998. {
  999. keyDown = UnityEngine.Input.GetKeyDown(KeyCode.J);
  1000. }
  1001. if (keyDown)
  1002. {
  1003. base.ChangeState(PlayerControllerDemo.ActionState.jump, "preJump");
  1004. return;
  1005. }
  1006. if (!this.hasLand)
  1007. {
  1008. base.ChangeState(PlayerControllerDemo.ActionState.passiveAir, null);
  1009. return;
  1010. }
  1011. this.InterpolatePos(deltaTime);
  1012. this.PlayFootstepSound();
  1013. }
  1014. private void PlayLandSmokeAnimation(float speed)
  1015. {
  1016. this.smokeAnimator.transform.parent = this.myTrans.parent;
  1017. this.smokeAnimator.transform.position = this.smokeTargetTrans.position;
  1018. this.smokeAnimator.speed = speed;
  1019. this.smokeAnimator.Play("smoke");
  1020. }
  1021. private void PlayTurnSmokeAnimation(float speed)
  1022. {
  1023. this.smokeTurnAnimator.transform.parent = this.myTrans.parent;
  1024. this.smokeTurnAnimator.transform.position = this.smokeTurnTargetTrans.position;
  1025. this.smokeTurnAnimator.transform.localScale = new Vector2((float)(-(float)this.direction), 1f);
  1026. this.smokeTurnAnimator.speed = speed;
  1027. if (this.smokeTurnAnimator.GetCurrentAnimatorStateInfo(0).IsName("smoke"))
  1028. {
  1029. this.smokeTurnAnimator.Play("smoke1");
  1030. }
  1031. else if (this.smokeTurnAnimator.GetCurrentAnimatorStateInfo(0).IsName("smoke1"))
  1032. {
  1033. this.smokeTurnAnimator.Play("smoke");
  1034. }
  1035. else
  1036. {
  1037. this.smokeTurnAnimator.Play("smoke");
  1038. }
  1039. }
  1040. private void preJump_Enter(object userData = null)
  1041. {
  1042. this.animator.SetTrigger("jump");
  1043. this.PlayLandSmokeAnimation(2f);
  1044. this.actionButtonPressed = false;
  1045. SoundMgr.Instance.PlaySfx("PawnJump", 0.7f, false, 0f, 0f);
  1046. }
  1047. private void preJump_Update()
  1048. {
  1049. this.CheckInput();
  1050. this.InterpolatePos(SingletonMonoBehaviourClass<TimeMgr>.instance.deltaTime);
  1051. }
  1052. private void AnimeEnd_preJump()
  1053. {
  1054. base.ChangeState(PlayerControllerDemo.ActionState.jump, null);
  1055. }
  1056. private void jump_Enter(object userData)
  1057. {
  1058. if (userData is string)
  1059. {
  1060. string a = (string)userData;
  1061. if (a == "preJump")
  1062. {
  1063. this.animator.Play("preJump");
  1064. }
  1065. }
  1066. else
  1067. {
  1068. this.animator.SetTrigger("jump");
  1069. }
  1070. this.PlayLandSmokeAnimation(2f);
  1071. this.actionButtonPressed = false;
  1072. SoundMgr.Instance.PlaySfx("PawnJump", 0.7f, false, 0f, 0f);
  1073. if (this.bloweeStack.Count > 0)
  1074. {
  1075. IBlowee blowee = this.bloweeStack[this.bloweeStack.Count - 1];
  1076. this.vel.y = this.initJumpSpeed.y;
  1077. this.accel = this.JumpAccel;
  1078. }
  1079. else
  1080. {
  1081. this.vel.y = this.initJumpSpeed.y;
  1082. this.accel = this.JumpAccel;
  1083. }
  1084. this.jumpAccelTimer = 0f;
  1085. this.isFall = false;
  1086. }
  1087. private void jump_Exit(object userData = null)
  1088. {
  1089. this.animator.ResetTrigger("jump");
  1090. }
  1091. private Tween Impulse(Vector2 _accel, Vector2 _vel, float _t, string animationName = null)
  1092. {
  1093. string oldGUID = this.guid;
  1094. Sequence sequence = DOTween.Sequence();
  1095. sequence.AppendInterval(_t);
  1096. sequence.OnComplete(delegate
  1097. {
  1098. if (this.guid == oldGUID)
  1099. {
  1100. this.vel.y = _vel.y;
  1101. this.accel = _accel;
  1102. if (this.bloweeStack.Count > 0)
  1103. {
  1104. this.accel = Vector2.one * 0.001f;
  1105. }
  1106. this.controlPointTrans.position = this.myTrans.position;
  1107. this.tempT1 = Time.time;
  1108. if (animationName != null)
  1109. {
  1110. this.animator.Play(animationName);
  1111. if (animationName == "AfterHit")
  1112. {
  1113. this.animator.ResetTrigger("attack");
  1114. }
  1115. }
  1116. }
  1117. });
  1118. return sequence;
  1119. }
  1120. private float _length(float v0, float a, float t)
  1121. {
  1122. return v0 * t + 0.5f * a * Mathf.Pow(t, 2f);
  1123. }
  1124. private bool CalculateAttackLantern(Attackable currAttackable)
  1125. {
  1126. Attackable[] array = currAttackable.Next();
  1127. if (!currAttackable.Available())
  1128. {
  1129. return false;
  1130. }
  1131. bool result = false;
  1132. foreach (Attackable attackable in array)
  1133. {
  1134. if (attackable != null)
  1135. {
  1136. Vector2 a = attackable.transform.position;
  1137. Vector2 vector = this.myTrans.position;
  1138. Vector2 zero = Vector2.zero;
  1139. float futureTime = currAttackable.GetFutureTime(attackable);
  1140. float num = this.gravity.y * currAttackable.gravityFactor;
  1141. float num2 = 0f;
  1142. float num3 = 0f;
  1143. float num4;
  1144. if (Mathf.Abs(this.vel.x) < Mathf.Abs(this.maxRunSpeed))
  1145. {
  1146. num4 = (Mathf.Abs(this.maxRunSpeed) - Mathf.Abs(this.vel.x)) / this.stand2RunAccel.x;
  1147. if (num4 > futureTime)
  1148. {
  1149. num4 = futureTime;
  1150. }
  1151. }
  1152. else
  1153. {
  1154. num4 = futureTime;
  1155. }
  1156. float num5;
  1157. if (num4 < futureTime)
  1158. {
  1159. num5 = this._length(this.vel.x, this.accel.x, num4);
  1160. num2 = futureTime - num4;
  1161. }
  1162. else
  1163. {
  1164. num5 = this._length(this.vel.x, this.accel.x, futureTime);
  1165. }
  1166. float num6 = num4 + num2;
  1167. zero.x = vector.x + num5 + num3;
  1168. if (this.vel.y > 0f)
  1169. {
  1170. float num7 = -this.vel.y / num;
  1171. if (num7 > num6)
  1172. {
  1173. num7 = num6;
  1174. float num8 = this._length(this.vel.y, num, num7);
  1175. zero.y = vector.y + num8;
  1176. }
  1177. else
  1178. {
  1179. float num9 = this._length(this.vel.y, num, num7);
  1180. float num10 = this._length(0f, num, num6 - num7);
  1181. zero.y = vector.y + num9 + num10;
  1182. }
  1183. }
  1184. else
  1185. {
  1186. zero.y = vector.y + this._length(this.vel.y, num, num6);
  1187. }
  1188. this.controlPointTrans.position = zero;
  1189. Vector2 vector2 = a - zero;
  1190. if ((float)this.direction * vector2.x < 0f)
  1191. {
  1192. Vector2 b = currAttackable.transform.position;
  1193. Vector2 vector3 = a - b;
  1194. a.x = b.x - vector3.x;
  1195. vector2 = a - zero;
  1196. }
  1197. float num11 = (this.maxRunSpeed - Mathf.Abs(this.vel.x)) / this.stand2RunAccel.x;
  1198. if (num11 < 0f)
  1199. {
  1200. num11 = 0f;
  1201. }
  1202. float num12 = this._length(this.vel.x, this.stand2RunAccel.x, num11);
  1203. float num13 = Mathf.Abs(vector2.x) - num12;
  1204. float num14 = num13 / this.maxRunSpeed;
  1205. if (num14 < 0f)
  1206. {
  1207. num14 = 0f;
  1208. }
  1209. float num15 = num11 + num14;
  1210. float num16 = Mathf.Abs(vector2.y);
  1211. float num17 = Mathf.Abs(Mathf.Sqrt(num16 * 2f / (3f * -num)));
  1212. float num18 = Mathf.Max(num15, num17);
  1213. float num19;
  1214. if (num17 > num15)
  1215. {
  1216. num19 = Mathf.Sqrt(Mathf.Abs(2f * num * vector2.y));
  1217. }
  1218. else
  1219. {
  1220. num19 = Mathf.Abs(vector2.y) / num18 - num * num18 * 0.5f;
  1221. }
  1222. float num20 = this._length(num19, num, num18);
  1223. this.controlPointTrans.position = new Vector2(zero.x + num12 + num13, zero.y + num20);
  1224. Vector2 zero2 = this.stand2RunAccel;
  1225. if (vector2.x < 0f)
  1226. {
  1227. zero2.x *= -1f;
  1228. }
  1229. zero2 = Vector2.zero;
  1230. if (!currAttackable.Action(attackable))
  1231. {
  1232. return false;
  1233. }
  1234. currAttackable.PlayAnimationAfterTime("lanternHit", futureTime);
  1235. currAttackable.React(this.vel, futureTime);
  1236. SoundMgr.Instance.PlaySfx("HitPaperLantern", 0.8f, false, futureTime, 0f);
  1237. if (currAttackable.IsFixYSpeed(attackable))
  1238. {
  1239. Tween jumpTween = this.Impulse(zero2, new Vector2(0f, currAttackable.overrideVelY), futureTime, null);
  1240. currAttackable.SetJumpTween(jumpTween);
  1241. }
  1242. else
  1243. {
  1244. Tween jumpTween2 = this.Impulse(zero2, new Vector2(0f, num19), futureTime, "AfterHit");
  1245. currAttackable.SetJumpTween(jumpTween2);
  1246. }
  1247. result = true;
  1248. }
  1249. }
  1250. return result;
  1251. }
  1252. private Attackable GetNearestAttackable()
  1253. {
  1254. if (this.currAttackableList.Count == 0)
  1255. {
  1256. return null;
  1257. }
  1258. float num = float.MaxValue;
  1259. int index = 0;
  1260. for (int i = 0; i < this.currAttackableList.Count; i++)
  1261. {
  1262. float num2 = Vector2.Distance(this.currAttackableList[i].transform.position, this.myTrans.position);
  1263. if (num2 < num)
  1264. {
  1265. num = num2;
  1266. index = i;
  1267. }
  1268. }
  1269. return this.currAttackableList[index];
  1270. }
  1271. private bool checkAttackLantern()
  1272. {
  1273. if (this.isInLantern && !this.hasLand)
  1274. {
  1275. Attackable nearestAttackable = this.GetNearestAttackable();
  1276. return this.CalculateAttackLantern(nearestAttackable);
  1277. }
  1278. return false;
  1279. }
  1280. private void PlayAttackAnime()
  1281. {
  1282. }
  1283. private bool CanPlayAttackAnime(AnimatorStateInfo currState, Attackable currAttackable)
  1284. {
  1285. return currState.IsName("Fly2fall") || currState.IsName("Fall") || currState.IsTag("Fly") || currState.IsTag("InWind");
  1286. }
  1287. private void CheckAttack()
  1288. {
  1289. if (this.hasLand)
  1290. {
  1291. return;
  1292. }
  1293. bool keyDown;
  1294. if (this.inputMethod == PlayerControllerDemo.InputMethod.newMethod)
  1295. {
  1296. keyDown = this.actionButtonPressed;
  1297. }
  1298. else
  1299. {
  1300. keyDown = UnityEngine.Input.GetKeyDown(KeyCode.J);
  1301. }
  1302. AnimatorStateInfo currentAnimatorStateInfo = this.animator.GetCurrentAnimatorStateInfo(0);
  1303. Attackable nearestAttackable = this.GetNearestAttackable();
  1304. if (keyDown && this.CanPlayAttackAnime(currentAnimatorStateInfo, nearestAttackable))
  1305. {
  1306. int value = UnityEngine.Random.Range(1, 2);
  1307. this.animator.SetTrigger("attack");
  1308. this.animator.SetInteger("atkIdx", value);
  1309. if (this.atkAnimator.GetCurrentAnimatorStateInfo(0).IsName("atkFire1"))
  1310. {
  1311. this.atkAnimator.Play("atkFire2");
  1312. }
  1313. else
  1314. {
  1315. this.atkAnimator.Play("atkFire1");
  1316. }
  1317. base.Invoke("PlayAttackAnime", this.attackFireDelay);
  1318. this.attackWindowTime = this.atkAnimationLength / 2f;
  1319. this.attackWindowTimer = 0f;
  1320. this.isAttack = true;
  1321. this.isFall = false;
  1322. this.realAttack = false;
  1323. this.actionButtonPressed = false;
  1324. XffectComponent eft = this.effectPool.GetEffect("AtkTrail");
  1325. if (eft != null)
  1326. {
  1327. eft.gameObject.SetActive(true);
  1328. this.currentEffect = eft;
  1329. eft.GetComponent<XffectHelper>().SetVortexSpeed(3000f);
  1330. eft.transform.position = this.rotateRootTrans.position;
  1331. eft.transform.parent = this.rotateRootTrans;
  1332. if (this.rotateRootTrans.lossyScale.x < 0f)
  1333. {
  1334. eft.transform.localScale = new Vector3(-1f, 1f, 1f);
  1335. }
  1336. else
  1337. {
  1338. eft.transform.localScale = new Vector3(1f, 1f, 1f);
  1339. }
  1340. eft.GetComponent<XffectHelper>().SetDir(this.direction);
  1341. eft.Active();
  1342. Sequence s = DOTween.Sequence();
  1343. s.AppendInterval(0.21f);
  1344. s.AppendCallback(delegate
  1345. {
  1346. eft.GetComponent<XffectHelper>().SetVortexSpeed(0f);
  1347. eft.StopSmoothly(0.5f);
  1348. });
  1349. s.AppendInterval(0.5f);
  1350. s.AppendCallback(delegate
  1351. {
  1352. if (this.currentEffect != null)
  1353. {
  1354. this.currentEffect.transform.parent = this.effectPool.transform;
  1355. this.currentEffect = null;
  1356. }
  1357. });
  1358. }
  1359. }
  1360. if (this.isAttack)
  1361. {
  1362. this.attackWindowTimer += SingletonMonoBehaviourClass<TimeMgr>.instance.deltaTime;
  1363. if (this.attackWindowTimer < this.attackWindowTime)
  1364. {
  1365. if (this.checkAttackLantern())
  1366. {
  1367. this.isAttack = false;
  1368. this.attackWindowTimer = 0f;
  1369. this.realAttack = true;
  1370. if ((PlayerControllerDemo.ActionState)base.GetState() != PlayerControllerDemo.ActionState.passiveAir)
  1371. {
  1372. base.ChangeState(PlayerControllerDemo.ActionState.attack, null);
  1373. }
  1374. }
  1375. }
  1376. else
  1377. {
  1378. this.isAttack = false;
  1379. this.attackWindowTimer = 0f;
  1380. }
  1381. }
  1382. }
  1383. public void EndCheckAttack()
  1384. {
  1385. this.isAttack = false;
  1386. this.attackWindowTimer = 0f;
  1387. this.animator.speed = 1f;
  1388. if (this.currentEffect != null)
  1389. {
  1390. this.currentEffect.StopSmoothly(0.5f);
  1391. this.currentEffect.transform.parent = this.effectPool.transform;
  1392. }
  1393. }
  1394. private void jump_Update()
  1395. {
  1396. float deltaTime = SingletonMonoBehaviourClass<TimeMgr>.instance.deltaTime;
  1397. this.CheckInput();
  1398. this.CheckAttack();
  1399. this.DampingVel(deltaTime);
  1400. this.ApplayGravity(deltaTime);
  1401. this.InterpolatePos(deltaTime);
  1402. if (this.vel.y < this.rollYAxisLimit && this.animator.GetCurrentAnimatorStateInfo(0).IsTag("Fly"))
  1403. {
  1404. this.isFall = true;
  1405. base.ChangeState(PlayerControllerDemo.ActionState.passiveAir, "roll");
  1406. }
  1407. }
  1408. private void attack_Enter(object userData = null)
  1409. {
  1410. base.ChangeState(PlayerControllerDemo.ActionState.passiveAir, "keepAnime");
  1411. }
  1412. private void attack_Update()
  1413. {
  1414. this.CheckInput();
  1415. this.accel.x = this.inputDir.x * this.stand2RunAccel.x;
  1416. float deltaTime = SingletonMonoBehaviourClass<TimeMgr>.instance.deltaTime;
  1417. this.ApplayGravity(deltaTime);
  1418. this.InterpolatePos(deltaTime);
  1419. }
  1420. private void attack_Exit(object userData = null)
  1421. {
  1422. }
  1423. private void roll_Enter(object userData = null)
  1424. {
  1425. this.animator.SetTrigger("roll");
  1426. }
  1427. private void roll_Update()
  1428. {
  1429. this.CheckInput();
  1430. this.CheckAttack();
  1431. this.accel.x = this.inputDir.x * this.stand2RunAccel.x;
  1432. float deltaTime = SingletonMonoBehaviourClass<TimeMgr>.instance.deltaTime;
  1433. this.ApplayGravity(deltaTime);
  1434. this.InterpolatePos(deltaTime);
  1435. }
  1436. private void roll_Exit(object userData = null)
  1437. {
  1438. this.animator.ResetTrigger("roll");
  1439. }
  1440. private void passiveAir_Enter(object userData = null)
  1441. {
  1442. this.isFall = false;
  1443. if (userData != null && userData.GetType() == typeof(string))
  1444. {
  1445. string text = (string)userData;
  1446. if (text != "keepAnime")
  1447. {
  1448. this.animator.SetTrigger(text);
  1449. }
  1450. }
  1451. else if (this.vel.y <= 0f)
  1452. {
  1453. this.animator.SetTrigger("fall");
  1454. }
  1455. else
  1456. {
  1457. this.animator.SetTrigger("jump");
  1458. }
  1459. }
  1460. private void passiveAir_Exit(object userData = null)
  1461. {
  1462. this.animator.ResetTrigger("fall");
  1463. }
  1464. private bool TestCollideWithLand(Vector2 oldPos, Vector2 newPos)
  1465. {
  1466. if (!this.hasLand && this.vel.y < 0f)
  1467. {
  1468. RaycastHit2D[] array = Physics2D.RaycastAll(this.tempVec2, -Vector2.up);
  1469. Bounds bounds = default(Bounds);
  1470. bool flag = false;
  1471. for (int i = 0; i < array.Length; i++)
  1472. {
  1473. if (array[i].collider.CompareTag("Land"))
  1474. {
  1475. flag = true;
  1476. bounds = array[i].collider.bounds;
  1477. break;
  1478. }
  1479. }
  1480. if (flag && newPos.y < bounds.center.y + bounds.extents.y)
  1481. {
  1482. this.vel.y = (bounds.center.y + bounds.extents.y - oldPos.y) / SingletonMonoBehaviourClass<TimeMgr>.instance.deltaTime - 1f;
  1483. this.accel.y = 0f;
  1484. return true;
  1485. }
  1486. }
  1487. return false;
  1488. }
  1489. private void DampingVel(float dt)
  1490. {
  1491. if (this.inputDir.x != 0f)
  1492. {
  1493. this.accel.x = this.inputDir.x * this.stand2RunAccel.x;
  1494. }
  1495. else if (this.vel.x * (this.vel.x + this.accel.x * dt) <= 0f)
  1496. {
  1497. this.accel.x = 0f;
  1498. this.vel.x = 0f;
  1499. }
  1500. else
  1501. {
  1502. this.accel.x = (float)((this.vel.x <= 0f) ? -1 : 1) * this.Run2StandAccel.x * this.jumpDampingFactor;
  1503. }
  1504. }
  1505. private void passiveAir_Update()
  1506. {
  1507. float deltaTime = SingletonMonoBehaviourClass<TimeMgr>.instance.deltaTime;
  1508. this.CheckInput();
  1509. this.CheckAttack();
  1510. this.DampingVel(deltaTime);
  1511. this.ApplayGravity(deltaTime);
  1512. if (this.accel.x != 0f)
  1513. {
  1514. Attackable nearestAttackable = this.GetNearestAttackable();
  1515. if (nearestAttackable != null)
  1516. {
  1517. this.accel.x = this.accel.x / Mathf.Abs(this.accel.x) * this.stand2RunAccel.x * nearestAttackable.horizenalAccelFactor;
  1518. }
  1519. }
  1520. this.InterpolatePos(deltaTime);
  1521. if (this.animator.GetCurrentAnimatorStateInfo(0).IsTag("Fly") && this.vel.y < this.rollYAxisLimit)
  1522. {
  1523. this.animator.SetTrigger("roll");
  1524. }
  1525. if (this.hasLand)
  1526. {
  1527. base.ChangeState(PlayerControllerDemo.ActionState.land, null);
  1528. }
  1529. }
  1530. private void passiveAirWithWind_Enter(object userData = null)
  1531. {
  1532. this.isFall = false;
  1533. this.animator.SetTrigger("inWind");
  1534. this.hasLand = false;
  1535. if (this.bloweeStack.Count > 0)
  1536. {
  1537. IBlowee blowee = this.bloweeStack[this.bloweeStack.Count - 1];
  1538. Type type = blowee.GetType();
  1539. if (type == typeof(LocalDirectionalWind))
  1540. {
  1541. this.initWindAccel = this.gravity;
  1542. }
  1543. }
  1544. }
  1545. private void passiveAirWithWind_Update()
  1546. {
  1547. if (this.bloweeStack.Count == 0)
  1548. {
  1549. this.accel = Vector2.zero;
  1550. this.windTimer = 0f;
  1551. base.ChangeState(PlayerControllerDemo.ActionState.passiveAir, null);
  1552. return;
  1553. }
  1554. this.CheckInput();
  1555. this.CheckAttack();
  1556. this.animator.SetFloat("speedY", this.vel.y);
  1557. float deltaTime = SingletonMonoBehaviourClass<TimeMgr>.instance.deltaTime;
  1558. if (this.bloweeStack.Count > 0)
  1559. {
  1560. IBlowee blowee = this.bloweeStack[this.bloweeStack.Count - 1];
  1561. Type type = blowee.GetType();
  1562. if (type == typeof(LocalDirectionalWind))
  1563. {
  1564. Vector2 pos = this.myTrans.position;
  1565. if (this.inputDir.x < 0f)
  1566. {
  1567. this.initWindAccel = this.gravity + -this.stand2RunAccel;
  1568. }
  1569. else if (this.inputDir.x > 0f)
  1570. {
  1571. this.initWindAccel = this.gravity + this.stand2RunAccel;
  1572. }
  1573. else
  1574. {
  1575. this.initWindAccel = this.gravity;
  1576. }
  1577. this.accel = this.initWindAccel + blowee.GetDir(this, pos) * blowee.GetPower(this, pos);
  1578. this.InterpolatePos(deltaTime);
  1579. }
  1580. }
  1581. if (this.hasLand)
  1582. {
  1583. base.ChangeState(PlayerControllerDemo.ActionState.land, null);
  1584. }
  1585. }
  1586. private void passiveAirWithWind_Exit(object userData = null)
  1587. {
  1588. this.animator.ResetTrigger("inWind");
  1589. }
  1590. private void Reset()
  1591. {
  1592. base.PauseStateMachine(false);
  1593. this.deathAnimator.Play("ghost2Man");
  1594. this.isCollideWithWall = false;
  1595. this.restting = false;
  1596. this.hasLand = false;
  1597. this.blockInput = false;
  1598. this.isInLantern = false;
  1599. this.currAttackableList.Clear();
  1600. base.GetComponent<BoxCollider2D>().enabled = true;
  1601. }
  1602. private void ResetInput()
  1603. {
  1604. if (this.inputMethod == PlayerControllerDemo.InputMethod.newMethod)
  1605. {
  1606. this.leftButtonPressed = false;
  1607. this.rightButtonPressed = false;
  1608. this.actionButtonPressed = false;
  1609. }
  1610. }
  1611. public void ResetToCheckLastCheckPoint(float time)
  1612. {
  1613. this.restting = true;
  1614. this.blockInput = true;
  1615. this.ResetInput();
  1616. this.currAttackableList.Clear();
  1617. base.PauseStateMachine(true);
  1618. this.animator.Play("Fall");
  1619. base.ChangeState(PlayerControllerDemo.ActionState.passiveAir, null);
  1620. this.accel = Vector2.zero;
  1621. this.vel = Vector2.zero;
  1622. this.inputDir = Vector2.zero;
  1623. this.guid = Guid.NewGuid().ToString();
  1624. if (this.respawnPoint != Vector2.zero)
  1625. {
  1626. this.myTrans.DOMove(new Vector3(this.respawnPoint.x, this.respawnPoint.y, this.myTrans.position.z), time, false);
  1627. base.Invoke("Reset", time);
  1628. }
  1629. else
  1630. {
  1631. Log.Error("haven't set respawnPoint before use");
  1632. }
  1633. }
  1634. private void AnimeEnd_roll()
  1635. {
  1636. this.animator.ResetTrigger("roll");
  1637. }
  1638. private void land_Enter(object userData = null)
  1639. {
  1640. if (this.bloweeStack.Count > 0)
  1641. {
  1642. base.ChangeState(PlayerControllerDemo.ActionState.passiveAirWithWind, null);
  1643. return;
  1644. }
  1645. this.PlayLandSmokeAnimation(1f);
  1646. this.animator.SetTrigger("land");
  1647. if (this.inputDir.x != 0f)
  1648. {
  1649. base.ChangeState(PlayerControllerDemo.ActionState.accRun, null);
  1650. }
  1651. }
  1652. private void land_Exit(object userData = null)
  1653. {
  1654. this.animator.ResetTrigger("land");
  1655. }
  1656. private void land_Update()
  1657. {
  1658. this.CheckInput();
  1659. AnimatorStateInfo currentAnimatorStateInfo = this.animator.GetCurrentAnimatorStateInfo(0);
  1660. if (!currentAnimatorStateInfo.IsName("Land"))
  1661. {
  1662. this.animator.SetTrigger("land");
  1663. }
  1664. bool keyDown;
  1665. if (this.inputMethod == PlayerControllerDemo.InputMethod.newMethod)
  1666. {
  1667. keyDown = this.actionButtonPressed;
  1668. }
  1669. else
  1670. {
  1671. keyDown = UnityEngine.Input.GetKeyDown(KeyCode.J);
  1672. }
  1673. if (keyDown && currentAnimatorStateInfo.IsName("Land"))
  1674. {
  1675. UnityEngine.Debug.Log("Land to jump");
  1676. base.ChangeState(PlayerControllerDemo.ActionState.jump, null);
  1677. return;
  1678. }
  1679. if (this.inputDir.x != 0f)
  1680. {
  1681. }
  1682. }
  1683. public void AnimeEnd_atk()
  1684. {
  1685. this.animator.ResetTrigger("attack");
  1686. this.EndCheckAttack();
  1687. if (this.hasLand)
  1688. {
  1689. if (this.currState != PlayerControllerDemo.ActionState.land)
  1690. {
  1691. base.ChangeState(PlayerControllerDemo.ActionState.land, null);
  1692. }
  1693. else
  1694. {
  1695. this.animator.SetTrigger("land");
  1696. }
  1697. }
  1698. else if (this.currState != PlayerControllerDemo.ActionState.passiveAirWithWind)
  1699. {
  1700. if (!this.realAttack)
  1701. {
  1702. this.animator.Play("NoHit");
  1703. base.ChangeState(PlayerControllerDemo.ActionState.passiveAir, "keepAnime");
  1704. }
  1705. else
  1706. {
  1707. base.ChangeState(PlayerControllerDemo.ActionState.passiveAir, null);
  1708. }
  1709. }
  1710. else if (!this.realAttack)
  1711. {
  1712. this.animator.SetTrigger("inWind");
  1713. }
  1714. }
  1715. private void AnimeEnd_land()
  1716. {
  1717. if (!this.hasLand)
  1718. {
  1719. base.ChangeState(PlayerControllerDemo.ActionState.passiveAir, null);
  1720. return;
  1721. }
  1722. if (this.currState == PlayerControllerDemo.ActionState.land)
  1723. {
  1724. if (this.inputDir.x != 0f)
  1725. {
  1726. base.ChangeState(PlayerControllerDemo.ActionState.accRun, null);
  1727. }
  1728. else if (this.vel.x == 0f)
  1729. {
  1730. base.ChangeState(PlayerControllerDemo.ActionState.stand, null);
  1731. }
  1732. else
  1733. {
  1734. this.animator.Play("Slide");
  1735. base.ChangeState(PlayerControllerDemo.ActionState.slide, null);
  1736. }
  1737. }
  1738. }
  1739. public void TurnRight()
  1740. {
  1741. this.direction = 1;
  1742. this.myTrans.localScale = new Vector3(1f, 1f, 1f);
  1743. }
  1744. public void OnShowRemainTime(float time)
  1745. {
  1746. }
  1747. private static PlayerControllerDemo _instance;
  1748. private static string pDocument = "this is test information";
  1749. private float _speedInWind;
  1750. private Vector2 accel;
  1751. private bool accelWind;
  1752. private bool actionButtonPressed;
  1753. private Animator animator;
  1754. private float atkAnimationLength;
  1755. public Animator atkAnimator;
  1756. public float attackFireDelay;
  1757. private float attackWindowTime = 0.13333334f;
  1758. private float attackWindowTimer;
  1759. private float audioTimer;
  1760. private bool blockInput;
  1761. private readonly List<IBlowee> bloweeStack = new List<IBlowee>();
  1762. private PlayerCollisionChecker checkerForLand;
  1763. private PlayerCollisionChecker checkerForWall;
  1764. private bool closingToWind;
  1765. public float closingToWindDumpTime = 1f;
  1766. private Vector2 closingWindAccel;
  1767. private Vector2 closingWindVel;
  1768. public Transform controlPointTrans;
  1769. private string currAtkAnimeName;
  1770. private readonly List<Attackable> currAttackableList = new List<Attackable>();
  1771. private Vector2 currContactNormal;
  1772. private XffectComponent currentEffect;
  1773. private bool currrIsLanternKey;
  1774. private ContactPoint2D currWallContactPoint;
  1775. public AnimationClip death2GhostClip;
  1776. public Animator deathAnimator;
  1777. private int deathCount;
  1778. private int direction;
  1779. public bool drawDebugInfo;
  1780. public XffectCache effectPool;
  1781. private float freezeTime;
  1782. public Vector2 gravity;
  1783. private string guid;
  1784. private bool hasLand;
  1785. private bool hasNPC;
  1786. private bool inited;
  1787. public Vector2 initJumpSpeed;
  1788. private Vector2 initWindAccel;
  1789. private Vector2 initWindOffset;
  1790. private Vector2 inputDir = Vector2.zero;
  1791. public PlayerControllerDemo.InputMethod inputMethod;
  1792. public float intoWindAccelFactor = 1f;
  1793. private float intoWindTime;
  1794. private float intoWindTimer;
  1795. public bool invisible;
  1796. private bool isAttack;
  1797. private bool isCollideWithWall;
  1798. private bool isFall;
  1799. private bool isInLantern;
  1800. public Vector2 JumpAccel;
  1801. private float jumpAccelTimer;
  1802. public float jumpDampingFactor;
  1803. private bool landBeWall;
  1804. private bool leftButtonPressed;
  1805. public float maxRunSpeed;
  1806. public float maxYVel;
  1807. public float minYVel;
  1808. private IInputEventHandler myInputEventHandler;
  1809. private Transform myTrans;
  1810. private Quaternion perpQuat = Quaternion.Euler(0f, 0f, 90f);
  1811. private bool realAttack;
  1812. private Vector2 respawnPoint;
  1813. private bool restting;
  1814. private bool rightButtonPressed;
  1815. public float rollYAxisLimit;
  1816. public Transform rotateRootTrans;
  1817. public Vector2 Run2StandAccel;
  1818. private int slideSign;
  1819. public Animator smokeAnimator;
  1820. public Transform smokeTargetTrans;
  1821. public Animator smokeTurnAnimator;
  1822. public Transform smokeTurnTargetTrans;
  1823. public float speedInWind;
  1824. public Vector2 stand2RunAccel;
  1825. private float tempT1;
  1826. private float tempT2;
  1827. private Vector2 tempVec2;
  1828. public bool testing;
  1829. private bool turnDirection;
  1830. private Vector2 vel;
  1831. private Vector2 windOffset;
  1832. private float windTimer;
  1833. private float windWidth;
  1834. private Vector2 worldRight = new Vector2(1f, 0f);
  1835. public enum ActionState
  1836. {
  1837. invalid,
  1838. stand,
  1839. run,
  1840. slide,
  1841. slideTurn,
  1842. accRun,
  1843. preJump,
  1844. jump,
  1845. attack,
  1846. roll,
  1847. land,
  1848. boost,
  1849. passiveAir,
  1850. passiveAirWithWind
  1851. }
  1852. public enum InputMethod
  1853. {
  1854. oldMethod,
  1855. newMethod
  1856. }
  1857. }