You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

Character.cs 27 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771
  1. using Preparation.Interface;
  2. using Preparation.Utility;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Threading;
  6. namespace GameClass.GameObj
  7. {
  8. public partial class Character : Moveable, ICharacter // 负责人LHR摆烂终了
  9. {
  10. private readonly ReaderWriterLockSlim hpReaderWriterLock = new();
  11. public ReaderWriterLockSlim HPReadWriterLock => hpReaderWriterLock;
  12. private readonly object vampireLock = new();
  13. public object VampireLock => vampire;
  14. #region 装弹、攻击相关的基本属性及方法
  15. /// <summary>
  16. /// 装弹冷却
  17. /// </summary>
  18. protected int cd;
  19. public int CD
  20. {
  21. get
  22. {
  23. lock (actionLock)
  24. {
  25. return cd;
  26. }
  27. }
  28. }
  29. public int OrgCD { get; protected set; }
  30. public readonly BulletType OriBulletOfPlayer;
  31. private BulletType bulletOfPlayer;
  32. public BulletType BulletOfPlayer
  33. {
  34. get
  35. {
  36. lock (actionLock)
  37. {
  38. return bulletOfPlayer;
  39. }
  40. }
  41. set
  42. {
  43. lock (actionLock)
  44. {
  45. bulletOfPlayer = value;
  46. cd = OrgCD = (BulletFactory.BulletCD(value));
  47. Debugger.Output(this, string.Format("'s CD has been set to: {0}.", cd));
  48. maxBulletNum = bulletNum = (BulletFactory.BulletNum(value));
  49. }
  50. }
  51. }
  52. protected int maxBulletNum;
  53. public int MaxBulletNum
  54. {
  55. get
  56. {
  57. lock (actionLock)
  58. {
  59. return maxBulletNum;
  60. }
  61. }
  62. }
  63. private int bulletNum;
  64. private int updateTimeOfBulletNum = 0;
  65. public int UpdateBulletNum(int time)
  66. {
  67. lock (actionLock)
  68. {
  69. if (bulletNum < maxBulletNum)
  70. {
  71. int add = Math.Min(maxBulletNum - bulletNum, (time - updateTimeOfBulletNum) / cd);
  72. updateTimeOfBulletNum += add * cd;
  73. return (bulletNum += add);
  74. }
  75. return maxBulletNum;
  76. }
  77. }
  78. /// <summary>
  79. /// 进行一次攻击
  80. /// </summary>
  81. /// <returns>攻击操作发出的子弹</returns>
  82. public Bullet? Attack(double angle, int time)
  83. {
  84. lock (actionLock)
  85. {
  86. if (bulletOfPlayer == BulletType.Null)
  87. return null;
  88. if (UpdateBulletNum(time) > 0)
  89. {
  90. if (bulletNum == maxBulletNum) updateTimeOfBulletNum = time;
  91. --bulletNum;
  92. XY res = Position + new XY // 子弹紧贴人物生成。
  93. (
  94. (int)(Math.Abs((Radius + BulletFactory.BulletRadius(bulletOfPlayer)) * Math.Cos(angle))) * Math.Sign(Math.Cos(angle)),
  95. (int)(Math.Abs((Radius + BulletFactory.BulletRadius(bulletOfPlayer)) * Math.Sin(angle))) * Math.Sign(Math.Sin(angle))
  96. );
  97. Bullet? bullet = BulletFactory.GetBullet(this, res, this.bulletOfPlayer);
  98. if (bullet == null) return null;
  99. bullet.AP += TryAddAp() ? GameData.ApPropAdd : 0;
  100. facingDirection = new(angle, bullet.AttackDistance);
  101. return bullet;
  102. }
  103. else
  104. return null;
  105. }
  106. }
  107. /*
  108. /// <summary>
  109. /// 攻击被反弹,反弹伤害不会再被反弹
  110. /// </summary>
  111. /// <param name="subHP"></param>
  112. /// <param name="hasSpear"></param>
  113. /// <param name="bouncer">反弹伤害者</param>
  114. /// <returns>是否因反弹伤害而死</returns>
  115. private bool BeBounced(int subHP, bool hasSpear, Character? bouncer)
  116. {
  117. lock (beAttackedLock)
  118. {
  119. if (hp <= 0)
  120. return false;
  121. if (!(bouncer?.TeamID == this.TeamID))
  122. {
  123. if (hasSpear || !HasShield)
  124. _ = TrySubHp(subHP);
  125. if (hp <= 0)
  126. TryActivatingLIFE();
  127. }
  128. return hp <= 0;
  129. }
  130. }*/
  131. #endregion
  132. #region 感知相关的基本属性及方法
  133. private Dictionary<BgmType, double> bgmDictionary = new();
  134. public Dictionary<BgmType, double> BgmDictionary
  135. {
  136. get => bgmDictionary;
  137. private set
  138. {
  139. lock (gameObjLock)
  140. {
  141. bgmDictionary = value;
  142. }
  143. }
  144. }
  145. public void AddBgm(BgmType bgm, double value)
  146. {
  147. if (BgmDictionary.ContainsKey(bgm))
  148. BgmDictionary[bgm] = value;
  149. else BgmDictionary.Add(bgm, value);
  150. }
  151. private int alertnessRadius;
  152. public int AlertnessRadius
  153. {
  154. get => alertnessRadius;
  155. set
  156. {
  157. lock (gameObjLock)
  158. {
  159. alertnessRadius = value;
  160. }
  161. }
  162. }
  163. private double concealment;
  164. public double Concealment
  165. {
  166. get => concealment;
  167. set
  168. {
  169. lock (gameObjLock)
  170. {
  171. concealment = value;
  172. }
  173. }
  174. }
  175. private int viewRange;
  176. public int ViewRange
  177. {
  178. get => viewRange;
  179. set
  180. {
  181. lock (gameObjLock)
  182. {
  183. viewRange = (value > 0) ? value : 0;
  184. }
  185. }
  186. }
  187. #endregion
  188. #region 交互相关的基本属性及方法
  189. private int speedOfOpeningOrLocking;
  190. public int SpeedOfOpeningOrLocking
  191. {
  192. get => speedOfOpeningOrLocking;
  193. set
  194. {
  195. lock (gameObjLock)
  196. {
  197. speedOfOpeningOrLocking = value;
  198. }
  199. }
  200. }
  201. private int speedOfClimbingThroughWindows;
  202. public int SpeedOfClimbingThroughWindows
  203. {
  204. get => speedOfClimbingThroughWindows;
  205. set
  206. {
  207. lock (gameObjLock)
  208. {
  209. speedOfClimbingThroughWindows = value;
  210. }
  211. }
  212. }
  213. private int speedOfOpenChest;
  214. public int SpeedOfOpenChest
  215. {
  216. get => speedOfOpenChest;
  217. set
  218. {
  219. lock (gameObjLock)
  220. {
  221. speedOfOpenChest = value;
  222. }
  223. }
  224. }
  225. #endregion
  226. #region 血量相关的基本属性及方法
  227. private int maxHp;
  228. public int MaxHp
  229. {
  230. get
  231. {
  232. HPReadWriterLock.EnterReadLock();
  233. try
  234. {
  235. return maxHp;
  236. }
  237. finally
  238. {
  239. HPReadWriterLock.ExitReadLock();
  240. }
  241. }
  242. protected set
  243. {
  244. HPReadWriterLock.EnterWriteLock();
  245. try
  246. {
  247. maxHp = value;
  248. if (hp > maxHp) hp = maxHp;
  249. }
  250. finally
  251. {
  252. HPReadWriterLock.ExitWriteLock();
  253. }
  254. }
  255. } // 最大血量
  256. protected int hp;
  257. public int HP
  258. {
  259. get
  260. {
  261. HPReadWriterLock.EnterReadLock();
  262. try
  263. {
  264. return hp;
  265. }
  266. finally
  267. {
  268. HPReadWriterLock.ExitReadLock();
  269. }
  270. }
  271. set
  272. {
  273. HPReadWriterLock.EnterWriteLock();
  274. try
  275. {
  276. if (value > 0)
  277. {
  278. hp = value <= maxHp ? value : maxHp;
  279. }
  280. else
  281. hp = 0;
  282. }
  283. finally
  284. {
  285. HPReadWriterLock.ExitWriteLock();
  286. }
  287. }
  288. }
  289. /// <summary>
  290. /// 尝试减血
  291. /// </summary>
  292. /// <param name="sub">减血量</param>
  293. public int TrySubHp(int sub)
  294. {
  295. HPReadWriterLock.EnterWriteLock();
  296. try
  297. {
  298. int previousHp = hp;
  299. if (hp <= sub)
  300. {
  301. hp = 0;
  302. return hp;
  303. }
  304. else
  305. {
  306. hp -= sub;
  307. return sub;
  308. }
  309. }
  310. finally
  311. {
  312. HPReadWriterLock.ExitWriteLock();
  313. }
  314. }
  315. private double vampire = 0; // 回血率:0-1之间
  316. public double Vampire
  317. {
  318. get
  319. {
  320. lock (vampireLock)
  321. return vampire;
  322. }
  323. set
  324. {
  325. lock (vampireLock)
  326. if (value > 1)
  327. vampire = 1;
  328. else if (value < 0)
  329. vampire = 0;
  330. else
  331. vampire = value;
  332. }
  333. }
  334. public double OriVampire { get; protected set; }
  335. #endregion
  336. #region 状态相关的基本属性与方法
  337. private PlayerStateType playerState = PlayerStateType.Null;
  338. public PlayerStateType PlayerState
  339. {
  340. get
  341. {
  342. lock (actionLock)
  343. {
  344. if (playerState == PlayerStateType.Null && IsMoving) return PlayerStateType.Moving;
  345. return playerState;
  346. }
  347. }
  348. }
  349. public bool NoHp()
  350. {
  351. lock (actionLock)
  352. return (playerState == PlayerStateType.Deceased || playerState == PlayerStateType.Escaped || playerState == PlayerStateType.Addicted || playerState == PlayerStateType.Rescued);
  353. }
  354. public bool Commandable()
  355. {
  356. lock (actionLock)
  357. {
  358. return (playerState != PlayerStateType.Deceased && playerState != PlayerStateType.Escaped
  359. && playerState != PlayerStateType.Addicted && playerState != PlayerStateType.Rescued
  360. && playerState != PlayerStateType.Swinging && playerState != PlayerStateType.TryingToAttack
  361. && playerState != PlayerStateType.ClimbingThroughWindows
  362. && playerState != PlayerStateType.Stunned && playerState != PlayerStateType.Charmed);
  363. }
  364. }
  365. public bool CanPinDown()
  366. {
  367. lock (actionLock)
  368. {
  369. return (playerState != PlayerStateType.Deceased && playerState != PlayerStateType.Escaped
  370. && playerState != PlayerStateType.Addicted && playerState != PlayerStateType.Rescued
  371. && playerState != PlayerStateType.Stunned && playerState != PlayerStateType.Charmed);
  372. }
  373. }
  374. public bool InteractingWithMapWithoutMoving()
  375. {
  376. lock (actionLock)
  377. {
  378. return (playerState == PlayerStateType.LockingOrOpeningTheDoor || playerState == PlayerStateType.Fixing || playerState == PlayerStateType.OpeningTheChest);
  379. }
  380. }
  381. public bool NullOrMoving()
  382. {
  383. lock (actionLock)
  384. {
  385. return (playerState == PlayerStateType.Null || playerState == PlayerStateType.Moving);
  386. }
  387. }
  388. public bool CanBeAwed()
  389. {
  390. lock (actionLock)
  391. return !(playerState == PlayerStateType.Deceased || playerState == PlayerStateType.Escaped
  392. || playerState == PlayerStateType.Addicted
  393. || playerState == PlayerStateType.Rescued || playerState == PlayerStateType.Treated
  394. || playerState == PlayerStateType.Stunned || playerState == PlayerStateType.Charmed
  395. || playerState == PlayerStateType.Null || playerState == PlayerStateType.Moving);
  396. }
  397. private GameObj? whatInteractingWith = null;
  398. public GameObj? WhatInteractingWith => whatInteractingWith;
  399. private long ChangePlayerState(PlayerStateType value = PlayerStateType.Null, GameObj? gameObj = null)
  400. {
  401. //只能被SetPlayerState引用
  402. whatInteractingWith = gameObj;
  403. if (value != PlayerStateType.Moving)
  404. IsMoving = false;
  405. playerState = (value == PlayerStateType.Moving) ? PlayerStateType.Null : value;
  406. //Debugger.Output(this,playerState.ToString()+" "+IsMoving.ToString());
  407. return ++stateNum;
  408. }
  409. private long ChangePlayerStateInOneThread(PlayerStateType value = PlayerStateType.Null, GameObj? gameObj = null)
  410. {
  411. //只能被SetPlayerState引用
  412. whatInteractingWith = gameObj;
  413. if (value != PlayerStateType.Moving)
  414. IsMoving = false;
  415. playerState = (value == PlayerStateType.Moving) ? PlayerStateType.Null : value;
  416. //Debugger.Output(this,playerState.ToString()+" "+IsMoving.ToString());
  417. return stateNum;
  418. }
  419. public long SetPlayerState(PlayerStateType value = PlayerStateType.Null, GameObj? gameObj = null)
  420. {
  421. lock (actionLock)
  422. {
  423. PlayerStateType nowPlayerState = PlayerState;
  424. if (nowPlayerState == value) return -1;
  425. switch (nowPlayerState)
  426. {
  427. case PlayerStateType.Escaped:
  428. case PlayerStateType.Deceased:
  429. return -1;
  430. case PlayerStateType.Addicted:
  431. if (value == PlayerStateType.Rescued)
  432. return ChangePlayerStateInOneThread(value, gameObj);
  433. else if (value == PlayerStateType.Null)
  434. return ChangePlayerState(value, gameObj);
  435. else return -1;
  436. case PlayerStateType.Rescued:
  437. if (value == PlayerStateType.Addicted)
  438. return ChangePlayerStateInOneThread(value, gameObj);
  439. else if (value == PlayerStateType.Null)
  440. return ChangePlayerState(value, gameObj);
  441. else return -1;
  442. case PlayerStateType.TryingToAttack:
  443. if (value != PlayerStateType.Moving && value != PlayerStateType.ClimbingThroughWindows)
  444. return ChangePlayerState(value, gameObj);
  445. else return -1;
  446. case PlayerStateType.Stunned:
  447. case PlayerStateType.Charmed:
  448. if (value != PlayerStateType.Moving && value != PlayerStateType.ClimbingThroughWindows && value != PlayerStateType.Swinging)
  449. return ChangePlayerState(value, gameObj);
  450. else return -1;
  451. case PlayerStateType.Swinging:
  452. if (value != PlayerStateType.Moving && value != PlayerStateType.ClimbingThroughWindows)
  453. {
  454. ThreadNum.Release();
  455. return ChangePlayerState(value, gameObj);
  456. }
  457. else return -1;
  458. case PlayerStateType.ClimbingThroughWindows:
  459. if (value != PlayerStateType.Moving)
  460. {
  461. Window window = (Window)WhatInteractingWith!;
  462. window.FinishClimbing();
  463. if (window.Stage.x == 0)
  464. ThreadNum.Release();
  465. else ReSetPos(window.Stage);
  466. return ChangePlayerState(value, gameObj);
  467. }
  468. else return -1;
  469. case PlayerStateType.OpeningTheChest:
  470. ((Chest)WhatInteractingWith!).StopOpen();
  471. return ChangePlayerState(value, gameObj);
  472. case PlayerStateType.OpeningTheDoorway:
  473. Doorway doorway = (Doorway)WhatInteractingWith!;
  474. doorway.StopOpenning();
  475. return ChangePlayerState(value, gameObj);
  476. default:
  477. return ChangePlayerState(value, gameObj);
  478. }
  479. }
  480. }
  481. public long SetPlayerStateNaturally()
  482. {
  483. lock (actionLock)
  484. {
  485. whatInteractingWith = null;
  486. IsMoving = false;
  487. playerState = PlayerStateType.Null;
  488. return ++stateNum;
  489. }
  490. }
  491. public void RemoveFromGame(PlayerStateType playerStateType)
  492. {
  493. lock (actionLock)
  494. {
  495. MoveReaderWriterLock.EnterWriteLock();
  496. try
  497. {
  498. canMove = false;
  499. isRemoved = true;
  500. }
  501. finally
  502. {
  503. MoveReaderWriterLock.ExitWriteLock();
  504. }
  505. playerState = playerStateType;
  506. position = GameData.PosWhoDie;
  507. }
  508. }
  509. #endregion
  510. private long score = 0;
  511. public long Score
  512. {
  513. get => Interlocked.Read(ref score);
  514. }
  515. /// <summary>
  516. /// 加分
  517. /// </summary>
  518. /// <param name="add">增加量</param>
  519. public virtual void AddScore(long add)
  520. {
  521. Interlocked.Add(ref score, add);
  522. //Debugger.Output(this, " 's score has been added to: " + score.ToString());
  523. }
  524. /// <summary>
  525. /// 角色所属队伍ID
  526. /// </summary>
  527. private long teamID = long.MaxValue;
  528. public long TeamID
  529. {
  530. get => Interlocked.Read(ref teamID);
  531. set => Interlocked.Exchange(ref teamID, value);
  532. }
  533. private long playerID = long.MaxValue;
  534. public long PlayerID
  535. {
  536. get => Interlocked.Read(ref playerID);
  537. set => Interlocked.Exchange(ref playerID, value);
  538. }
  539. #region 道具和buff相关属性、方法
  540. private Gadget[] propInventory = new Gadget[GameData.maxNumOfPropInPropInventory]
  541. {new NullProp(), new NullProp(),new NullProp() };
  542. public Gadget[] PropInventory
  543. {
  544. get => propInventory;
  545. set
  546. {
  547. lock (gameObjLock)
  548. {
  549. propInventory = value;
  550. Debugger.Output(this, " prop becomes " + (PropInventory == null ? "null" : PropInventory.ToString()));
  551. }
  552. }
  553. }
  554. /// <summary>
  555. /// 使用物品栏中的道具
  556. /// </summary>
  557. /// <returns>被使用的道具</returns>
  558. public Gadget UseProp(int indexing)
  559. {
  560. if (indexing < 0 || indexing >= GameData.maxNumOfPropInPropInventory)
  561. return new NullProp();
  562. lock (gameObjLock)
  563. {
  564. Gadget prop = propInventory[indexing];
  565. PropInventory[indexing] = new NullProp();
  566. return prop;
  567. }
  568. }
  569. public Gadget UseProp(PropType propType)
  570. {
  571. lock (gameObjLock)
  572. {
  573. if (propType == PropType.Null)
  574. {
  575. for (int indexing = 0; indexing < GameData.maxNumOfPropInPropInventory; ++indexing)
  576. {
  577. if (PropInventory[indexing].GetPropType() != PropType.Null)
  578. {
  579. Gadget prop = PropInventory[indexing];
  580. PropInventory[indexing] = new NullProp();
  581. return prop;
  582. }
  583. }
  584. }
  585. else
  586. for (int indexing = 0; indexing < GameData.maxNumOfPropInPropInventory; ++indexing)
  587. {
  588. if (PropInventory[indexing].GetPropType() == propType)
  589. {
  590. Gadget prop = PropInventory[indexing];
  591. PropInventory[indexing] = new NullProp();
  592. return prop;
  593. }
  594. }
  595. return new NullProp();
  596. }
  597. }
  598. /// <summary>
  599. /// 如果indexing==GameData.maxNumOfPropInPropInventory表明道具栏为满
  600. /// </summary>
  601. public int IndexingOfAddProp()
  602. {
  603. int indexing = 0;
  604. for (; indexing < GameData.maxNumOfPropInPropInventory; ++indexing)
  605. if (PropInventory[indexing].GetPropType() == PropType.Null)
  606. break;
  607. return indexing;
  608. }
  609. public void AddMoveSpeed(int buffTime, double add = 1.0) => buffManager.AddMoveSpeed(add, buffTime, newVal =>
  610. { MoveSpeed = newVal < GameData.characterMaxSpeed ? newVal : GameData.characterMaxSpeed; },
  611. OrgMoveSpeed);
  612. public bool HasFasterSpeed => buffManager.HasFasterSpeed;
  613. public void AddShield(int shieldTime) => buffManager.AddShield(shieldTime);
  614. public bool HasShield => buffManager.HasShield;
  615. public void AddLife(int LIFETime) => buffManager.AddLife(LIFETime);
  616. public bool HasLIFE => buffManager.HasLIFE;
  617. public void AddAp(int time) => buffManager.AddAp(time);
  618. public bool HasAp => buffManager.HasAp;
  619. public void AddSpear(int spearTime) => buffManager.AddSpear(spearTime);
  620. public bool HasSpear => buffManager.HasSpear;
  621. public void AddClairaudience(int time) => buffManager.AddClairaudience(time);
  622. public bool HasClairaudience => buffManager.HasClairaudience;
  623. public void AddInvisible(int time) => buffManager.AddInvisible(time);
  624. public bool HasInvisible => buffManager.HasInvisible;
  625. private Array buffTypeArray = Enum.GetValues(typeof(BuffType));
  626. public Dictionary<BuffType, bool> Buff
  627. {
  628. get
  629. {
  630. Dictionary<BuffType, bool> buff = new Dictionary<BuffType, bool>();
  631. foreach (BuffType type in buffTypeArray)
  632. {
  633. if (type != BuffType.Null)
  634. buff.Add(type, GetBuffStatus(type));
  635. }
  636. return buff;
  637. }
  638. }
  639. private bool GetBuffStatus(BuffType type)
  640. {
  641. switch (type)
  642. {
  643. case BuffType.Spear:
  644. return this.HasSpear;
  645. case BuffType.AddSpeed:
  646. return this.HasFasterSpeed;
  647. case BuffType.Shield:
  648. return this.HasShield;
  649. case BuffType.AddLife:
  650. return this.HasLIFE;
  651. case BuffType.AddAp:
  652. return this.HasAp;
  653. case BuffType.Clairaudience:
  654. return this.HasClairaudience;
  655. case BuffType.Invisible:
  656. return this.HasInvisible;
  657. default:
  658. return false;
  659. }
  660. }
  661. public void TryActivatingLIFE()
  662. {
  663. if (buffManager.TryActivatingLIFE())
  664. {
  665. AddScore(GameData.ScorePropRemainHp);
  666. hp = GameData.RemainHpWhenAddLife;
  667. }
  668. }
  669. public bool TryAddAp()
  670. {
  671. if (buffManager.TryAddAp())
  672. {
  673. AddScore(GameData.ScorePropAddAp);
  674. return true;
  675. }
  676. return false;
  677. }
  678. public bool TryUseSpear()
  679. {
  680. return buffManager.TryUseSpear();
  681. }
  682. public bool TryUseShield()
  683. {
  684. if (buffManager.TryUseShield())
  685. {
  686. AddScore(GameData.ScorePropUseShield);
  687. return true;
  688. }
  689. return false;
  690. }
  691. #endregion
  692. /* public override void Reset() // 要加锁吗?
  693. {
  694. lock (gameObjLock)
  695. {
  696. // _ = AddDeathCount();
  697. base.Reset();
  698. this.MoveSpeed = OrgMoveSpeed;
  699. HP = MaxHp;
  700. PropInventory = null;
  701. BulletOfPlayer = OriBulletOfPlayer;
  702. lock (gameObjLock)
  703. bulletNum = maxBulletNum;
  704. buffManager.ClearAll();
  705. IsInvisible = false;
  706. this.Vampire = this.OriVampire;
  707. }
  708. }*/
  709. public override bool IsRigid => true;
  710. public override ShapeType Shape => ShapeType.Circle;
  711. public override bool IgnoreCollideExecutor(IGameObj targetObj)
  712. {
  713. if (IsRemoved)
  714. return true;
  715. if (targetObj.Type == GameObjType.Gadget)
  716. {
  717. return true;
  718. }
  719. if (targetObj.Type == GameObjType.Character && XY.DistanceCeil3(targetObj.Position, this.Position) < this.Radius + targetObj.Radius - GameData.adjustLength)
  720. return true;
  721. return false;
  722. }
  723. }
  724. }