AttributeStatus.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647
  1. using System.Collections.Generic;
  2. using UnityEngine;
  3. using System;
  4. using Sirenix.OdinInspector;
  5. using DG.Tweening;
  6. //各个状态
  7. public enum SpecialState
  8. {
  9. Null = -1,
  10. FloatState = 0,
  11. BlownUp = 1,
  12. ShotDown = 2,
  13. Weak = 3,
  14. }
  15. public class AttributeStatus : MonoBehaviour
  16. {
  17. //组件
  18. private MoveCharacter character;
  19. private Rigidbody rb;
  20. private Foot foot;
  21. private HitFeedbackSystem hitFeedbackSystem;
  22. //behit参数
  23. [DisplayOnly] public SpecialState curSpecialStates = SpecialState.Null;
  24. public AttackController.AttackMethod attackMethod;
  25. [LabelText("控制时间")] [DisplayOnly] public float attributeTime;
  26. [TabGroup("漂浮")]
  27. [DisplayOnly] public int floatingState; //0:不漂浮;1:漂浮中;2:飘着;3:掉下去
  28. private Vector3 origPos; //初始位置
  29. private float curHeight; //当前所在高度
  30. private float riseTime; //上升时间
  31. private float backSpeed; //返回速度
  32. private float rotateSpeed; //旋转速度
  33. private float rotateDir; //旋转方向
  34. private float height; //漂浮高度
  35. private float rise = 1;
  36. private float normalFallSpeed = 15f;
  37. [TabGroup("击飞击落")] [DisplayOnly] public int hitState;
  38. [TabGroup("击飞击落")] [DisplayOnly] public bool isFly;
  39. [TabGroup("击飞击落")] [LabelText("X方向阻力")] public float decelerationRatioX = 2f;
  40. [TabGroup("击飞击落")] [LabelText("Y方向重力")] public float decelerationRatioY = 15f;
  41. public Character landingDamageFrom;
  42. private Vector3 startFlyPos;
  43. [TabGroup("击飞击落")] [LabelText("旋转中心高度")] public float rotateCenterHeight = 1f;
  44. [TabGroup("击飞击落")] [LabelText("起飞预设角度")] public float startFlyAngle = 15f;
  45. [Tooltip("x为最小值,y为最大值")]
  46. [TabGroup("击飞击落")] [LabelText("飞行预设角速度随机范围")] public Vector2 flyingRotateSpeedRange = new Vector2(15, 45);
  47. private float flyingRotateSpeed;
  48. private Vector3 scale;
  49. [TabGroup("击飞击落")] [LabelText("压缩程度")] public float compressionDegree = 0.8f;
  50. [Tooltip("x为向下压缩经过的时间,y为回弹经过的时间")]
  51. [TabGroup("击飞击落")] [LabelText("压缩速度")] public Vector2 compressionSpeed = new Vector2(0.2f, 0.4f);
  52. [TabGroup("击飞击落")] [LabelText("弹跳速度")] public float jumpVel = 5f;
  53. [TabGroup("易伤")]
  54. [DisplayOnly] public bool haveVulnerable = false;
  55. [TabGroup("易伤")]
  56. [DisplayOnly] public float vulnerableRate = 0f;
  57. [DisplayOnly] public float vulnerableTime;
  58. [TabGroup("累伤")] [DisplayOnly] public float stackingWoudsTime;
  59. [TabGroup("累伤")] [DisplayOnly] public float stackingWords;
  60. //抗性
  61. [Serializable]
  62. public struct Resistances
  63. {
  64. [LabelText("控制层级")] public int controlOrder;
  65. //控制效果抗性
  66. [Range(0, 1)]
  67. [LabelText("漂浮抗性")]
  68. public float Float;
  69. [Range(0, 1)]
  70. [LabelText("击飞抗性")]
  71. public float BlowUp;
  72. [Range(0, 1)]
  73. [LabelText("击落抗性")]
  74. public float ShotDown;
  75. [Range(0, 1)]
  76. [LabelText("击晕抗性")]
  77. public float Weak;
  78. [Space]
  79. //非控制效果抗性
  80. [LabelText("护甲值")] public int armor;
  81. [LabelText("闪避")] public int dodge;
  82. }
  83. [LabelText("抗性")] public Resistances resistances;
  84. private void Awake()
  85. {
  86. character = GetComponentInParent<MoveCharacter>();
  87. rb = character.rb;
  88. foot = character.foot;
  89. hitFeedbackSystem = GetComponent<HitFeedbackSystem>();
  90. scale = character.mecanim.transform.localScale;
  91. }
  92. public void Update()
  93. {
  94. //易伤
  95. if (haveVulnerable)
  96. {
  97. vulnerableTime -= Time.deltaTime;
  98. if (vulnerableTime <= 0)
  99. {
  100. vulnerableRate = 0f;
  101. haveVulnerable = false;
  102. }
  103. }
  104. //累伤
  105. if (stackingWords > 0)
  106. {
  107. stackingWoudsTime -= Time.deltaTime;
  108. if (stackingWoudsTime <= 0)
  109. {
  110. stackingWords = 0;
  111. }
  112. }
  113. }
  114. public void AddSpecialState(AttackController.AttackMethod attackMethod, Character attackFrom)
  115. {
  116. if (attackMethod.attackInfo.attackEffect.Count > 0)
  117. {
  118. AttackEffect attackEffect = AttackEffect.Null;
  119. foreach (AttackEffect ae in attackMethod.attackInfo.attackEffect)
  120. {
  121. switch (attackMethod.attackInfo.attackEffect[0])
  122. {
  123. /*控制*/
  124. //漂浮
  125. case AttackEffect.FloatState:
  126. if (resistances.Float == 1)
  127. {
  128. break;
  129. }
  130. if (PriorityOrder(SpecialState.FloatState, attackMethod.attackInfo.floatState.ControlOrder))
  131. {
  132. attackEffect = AttackEffect.FloatState;
  133. }
  134. break;
  135. //击飞
  136. case AttackEffect.BlowUp:
  137. if (resistances.BlowUp == 1)
  138. {
  139. break;
  140. }
  141. if (!character.nowCanFly)
  142. {
  143. if (PriorityOrder(SpecialState.BlownUp,attackMethod.attackInfo.blowUp.ControlOrder))
  144. {
  145. attackEffect = AttackEffect.BlowUp;
  146. }
  147. }
  148. break;
  149. //击落
  150. case AttackEffect.ShotDown:
  151. if (resistances.ShotDown == 1)
  152. {
  153. break;
  154. }
  155. if (character.nowCanFly || !character.canNotShotDown)
  156. {
  157. if (PriorityOrder(SpecialState.ShotDown,attackMethod.attackInfo.shotDown.ControlOrder))
  158. {
  159. attackEffect = AttackEffect.ShotDown;
  160. }
  161. }
  162. break;
  163. //击晕
  164. case AttackEffect.Weak:
  165. if (resistances.Weak == 1)
  166. {
  167. break;
  168. }
  169. if (PriorityOrder(SpecialState.Weak,attackMethod.attackInfo.weak.ControlOrder))
  170. {
  171. attackEffect = AttackEffect.Weak;
  172. }
  173. break;
  174. }
  175. }
  176. if (attackEffect != AttackEffect.Null)
  177. {
  178. switch (attackEffect)
  179. {
  180. /*控制*/
  181. //漂浮
  182. case AttackEffect.FloatState:
  183. AddFloat(attackMethod);
  184. break;
  185. //击飞
  186. case AttackEffect.BlowUp:
  187. AddBlowUp(attackMethod, attackFrom.bodyTrans);
  188. if (attackMethod.attackInfo.blowUp.haveLandingDamage)
  189. {
  190. landingDamageFrom = attackFrom;
  191. }
  192. break;
  193. //击落
  194. case AttackEffect.ShotDown:
  195. AddShotDown(attackMethod, attackFrom.bodyTrans);
  196. if (attackMethod.attackInfo.shotDown.haveLandingDamage)
  197. {
  198. landingDamageFrom = attackFrom;
  199. }
  200. break;
  201. //击晕
  202. case AttackEffect.Weak:
  203. AddWeak(attackMethod);
  204. break;
  205. }
  206. return;
  207. }
  208. }
  209. if (curSpecialStates == SpecialState.Null)
  210. {
  211. hitFeedbackSystem.EnterHitStun(attackFrom);
  212. }
  213. }
  214. //CharacterState为SpecialStatus时调用此函数
  215. public void SpecialStateEffect(SpecialState specialState)
  216. {
  217. switch (specialState)
  218. {
  219. //漂浮
  220. case SpecialState.FloatState:
  221. switch (floatingState)
  222. {
  223. case 1:
  224. character.transform.localEulerAngles += new Vector3(0, 0, 1) * rotateDir * rotateSpeed * Time.deltaTime;
  225. curHeight = Mathf.SmoothDamp(curHeight, height, ref rise, riseTime);
  226. character.transform.position = new Vector3(origPos.x, curHeight, origPos.z);
  227. if (curHeight >= height - 0.02f)
  228. {
  229. floatingState = 2;
  230. height = character.transform.position.y;
  231. }
  232. break;
  233. case 2:
  234. character.transform.localEulerAngles += new Vector3(0, 0, 1) * rotateDir * rotateSpeed * Time.deltaTime;
  235. break;
  236. case 3:
  237. if (character.transform.position.y >= origPos.y + 0.05f)
  238. {
  239. curHeight -= normalFallSpeed * Time.deltaTime;
  240. character.transform.position = new Vector3(origPos.x, curHeight, origPos.z);
  241. }
  242. else if (foot.TrigGround || curHeight <= origPos.y + 0.05f)
  243. {
  244. floatingState = 0;
  245. character.bodyCollider.layer = character.gameObject.layer;
  246. character.isAdjustHeight = 1;
  247. OutSpecialState();
  248. return;
  249. }
  250. break;
  251. }
  252. PlayerController playerController = GetComponent<PlayerController>();
  253. if (playerController != null)
  254. {
  255. if (playerController.mp > 0)
  256. {
  257. playerController.lostMp += playerController.mpReplySpeed * Time.deltaTime;
  258. playerController.mp -= playerController.mpReplySpeed * Time.deltaTime;
  259. }
  260. if (playerController.lostMp >= playerController.addMp)
  261. {
  262. PoolManager.Instantiate(playerController.soul, character.transform.position, new Quaternion(0, 0, 0, 0), null);
  263. playerController.lostMp = 0;
  264. }
  265. }
  266. attributeTime -= Time.deltaTime;
  267. if (attributeTime <= 0)
  268. {
  269. character.transform.localEulerAngles = Vector3.zero;
  270. floatingState = 3;
  271. rb.useGravity = true;
  272. }
  273. break;
  274. //击飞
  275. case SpecialState.BlownUp:
  276. //击落
  277. case SpecialState.ShotDown:
  278. Vector3 vel = rb.velocity;
  279. switch (hitState)
  280. {
  281. case -1:
  282. break;
  283. case 0:
  284. if (isFly && foot.TrigGround && vel.y < 0.1f)
  285. {
  286. if (!foot.haveGravity)
  287. {
  288. character.transform.position = new Vector3(transform.position.x, character.platformPosY, transform.position.z);
  289. }
  290. character.ani.Play(AnimatorHash.ANIMATOR_weak, 0, 0);
  291. character.bodyCollider.layer = character.gameObject.layer;
  292. vel = vel / 5f;
  293. vel.y = jumpVel;
  294. character.mecanim.transform.localPosition = Vector3.zero;
  295. character.mecanim.transform.localRotation = Quaternion.Euler(0, 0, 0);
  296. character.transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles.x, transform.rotation.eulerAngles.y, character.platformRotZ);
  297. hitState = 1;
  298. int landingDamage;
  299. if (specialState == SpecialState.BlownUp)
  300. {
  301. if (attackMethod.attackInfo.blowUp.haveLandingDamage)
  302. {
  303. landingDamage = (int)(Mathf.Abs(transform.position.x - startFlyPos.x) * attackMethod.attackInfo.blowUp.landingDamageRate);
  304. if (landingDamage > 0)
  305. {
  306. character.BeHit(attackMethod, landingDamageFrom, landingDamage);
  307. }
  308. }
  309. }
  310. else
  311. {
  312. AttackInfo.ShotDown shotDown = attackMethod.attackInfo.shotDown;
  313. if (shotDown.haveLandingDamage)
  314. {
  315. landingDamage = (int)(Mathf.Abs(transform.position.y - startFlyPos.y) * shotDown.landingDamageRate);
  316. landingDamage = Mathf.Clamp(landingDamage, shotDown.minLandingDamage, landingDamage);
  317. if (landingDamage > 0)
  318. {
  319. character.BeHit(attackMethod, landingDamageFrom, landingDamage);
  320. }
  321. }
  322. }
  323. BounceEffect();
  324. }
  325. else
  326. {
  327. if (vel.x > 0)
  328. {
  329. vel.x -= decelerationRatioX * Time.deltaTime;
  330. }
  331. else
  332. {
  333. vel.x += decelerationRatioX * Time.deltaTime;
  334. }
  335. vel.y -= decelerationRatioY * Time.deltaTime;
  336. character.mecanim.transform.RotateAround(
  337. character.transform.position + rotateCenterHeight * Vector3.up,
  338. Vector3.forward,
  339. flyingRotateSpeed * Time.deltaTime);
  340. isFly = true;
  341. }
  342. break;
  343. case 1:
  344. //眩晕状态
  345. if (attributeTime <= 0)
  346. {
  347. character.isAdjustHeight = 1;
  348. character.nowCanFly = character.canFly;
  349. OutSpecialState();
  350. }
  351. else
  352. {
  353. if (vel.x > 0)
  354. {
  355. vel.x -= decelerationRatioX * Time.deltaTime;
  356. }
  357. else
  358. {
  359. vel.x += decelerationRatioX * Time.deltaTime;
  360. }
  361. if (!foot.TrigGround || vel.y > 0.1f)
  362. {
  363. vel.y -= decelerationRatioY * Time.deltaTime;
  364. }
  365. attributeTime -= Time.deltaTime;
  366. }
  367. break;
  368. }
  369. rb.velocity = vel;
  370. break;
  371. //眩晕
  372. case SpecialState.Weak:
  373. if (attributeTime <= 0)
  374. {
  375. OutSpecialState();
  376. }
  377. else
  378. {
  379. if (!character.isFrozen) rb.velocity = Vector3.zero;
  380. attributeTime -= Time.deltaTime;
  381. }
  382. break;
  383. }
  384. }
  385. void BounceEffect()
  386. {
  387. Transform spine = character.mecanim.transform;
  388. Sequence landSequence = DOTween.Sequence();
  389. landSequence.Append(spine.DOScaleY(scale.y * compressionDegree, compressionSpeed.x));
  390. landSequence.Append(spine.DOScaleY(scale.y, compressionSpeed.y));
  391. }
  392. public void OutSpecialState()
  393. {
  394. character.mecanim.transform.localRotation = Quaternion.Euler(0, 0, 0);
  395. curSpecialStates = SpecialState.Null;
  396. if (character.canFly)
  397. {
  398. rb.useGravity = false;
  399. character.isAdjustHeight = 1;
  400. }
  401. character.ChangeState(CharacterState.Idle);
  402. }
  403. //判断优先级,ture为优先级高于当前控制
  404. public bool PriorityOrder(SpecialState specialState, int controlOrder)
  405. {
  406. //控制层级小于控制抗性层级,该控制效果无效
  407. if (controlOrder < resistances.controlOrder)
  408. {
  409. return false;
  410. }
  411. if (curSpecialStates == SpecialState.Null)
  412. {
  413. curSpecialStates = specialState;
  414. return true;
  415. }
  416. else
  417. {
  418. if (curSpecialStates >= specialState)
  419. {
  420. curSpecialStates = specialState;
  421. return true;
  422. }
  423. }
  424. return false;
  425. }
  426. //受到漂浮
  427. public void AddFloat(AttackController.AttackMethod attackMethod)
  428. {
  429. if (resistances.Float == 1)
  430. {
  431. return;
  432. }
  433. this.attackMethod = attackMethod;
  434. AttackInfo.FloatState floatState = attackMethod.attackInfo.floatState;
  435. rb.isKinematic = false;
  436. rb.useGravity = false;
  437. floatingState = 1;
  438. origPos = character.transform.position;
  439. curHeight = origPos.y;
  440. riseTime = UnityEngine.Random.Range(floatState.upTime.x, floatState.upTime.y);
  441. backSpeed = UnityEngine.Random.Range(floatState.backSpeed.x, floatState.backSpeed.y);
  442. if (gameObject.tag == "Enemy" || gameObject.tag == "Player")
  443. {
  444. backSpeed = -backSpeed;
  445. }
  446. rotateSpeed = UnityEngine.Random.Range(floatState.rotateSpeed.x, floatState.rotateSpeed.y);
  447. rotateDir = (1.5f - UnityEngine.Random.Range(1, 3)) * 2;
  448. height = UnityEngine.Random.Range(floatState.height.x, floatState.height.y);
  449. attributeTime = floatState.time * (1 - resistances.Float);
  450. character.ChangeState(CharacterState.SpecialStatus_Float);
  451. character.ChangeStateText(CharacterState.SpecialStatus_Float);
  452. }
  453. //受到击飞
  454. public void AddBlowUp(AttackController.AttackMethod attackMethod, Transform attackFrom)
  455. {
  456. if (resistances.BlowUp == 1)
  457. {
  458. return;
  459. }
  460. this.attackMethod = attackMethod;
  461. AttackInfo.BlowUp blowUp = attackMethod.attackInfo.blowUp;
  462. attributeTime = blowUp.time * (1 - resistances.BlowUp);
  463. Vector3 vec3 = new Vector3(
  464. blowUp.dir.x + UnityEngine.Random.Range(-blowUp.dirRandom.x / 2f, blowUp.dirRandom.x / 2f),
  465. blowUp.dir.y + UnityEngine.Random.Range(-blowUp.dirRandom.y / 2f, blowUp.dirRandom.y / 2f),
  466. 0).normalized;
  467. int attackDir = 0;
  468. switch (blowUp.directionType)
  469. {
  470. case AttackInfo.BlowUp.DirectionType.Common:
  471. attackDir = attackFrom.localScale.x < 0 ? -1 : 1;
  472. break;
  473. case AttackInfo.BlowUp.DirectionType.Spread:
  474. attackDir = attackFrom.position.x < transform.position.x ? -1 : 1;
  475. break;
  476. case AttackInfo.BlowUp.DirectionType.Explosion:
  477. attackDir = 1;
  478. vec3 = transform.position - attackFrom.transform.position;
  479. vec3.y += 0.5f;
  480. break;
  481. }
  482. if (attackDir < 0)
  483. {
  484. vec3.x = -vec3.x;
  485. }
  486. hitState = -1;
  487. character.ChangeState(CharacterState.SpecialStatus_BlowUp);
  488. character.ChangeStateText(CharacterState.SpecialStatus_BlowUp);
  489. rb.useGravity = true;
  490. rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionZ;
  491. rb.velocity = Vector3.zero;
  492. rb.AddForce(vec3 * blowUp.force * (1 - resistances.BlowUp), ForceMode.Impulse);
  493. rb.transform.rotation = Quaternion.Euler(0, 0, 0);
  494. character.mecanim.transform.RotateAround(
  495. character.transform.position + rotateCenterHeight * Vector3.up,
  496. Vector3.forward,
  497. startFlyAngle * attackDir);
  498. flyingRotateSpeed = UnityEngine.Random.Range(flyingRotateSpeedRange.x, flyingRotateSpeedRange.y) * attackDir;
  499. startFlyPos = transform.position;
  500. hitState = 0;
  501. isFly = false;
  502. character.ani.Play("hitted", 0, 0);
  503. }
  504. //受到击落
  505. public void AddShotDown(AttackController.AttackMethod attackMethod, Transform attackFrom)
  506. {
  507. if (resistances.ShotDown == 1)
  508. {
  509. return;
  510. }
  511. this.attackMethod = attackMethod;
  512. AttackInfo.ShotDown shotDown = attackMethod.attackInfo.shotDown;
  513. attributeTime = shotDown.time * (1 - resistances.ShotDown);
  514. Vector3 vec3 = new Vector3(
  515. shotDown.dir.x + UnityEngine.Random.Range(-shotDown.dirRandom.x / 2f, shotDown.dirRandom.x / 2f),
  516. shotDown.dir.y + UnityEngine.Random.Range(-shotDown.dirRandom.y / 2f, shotDown.dirRandom.y / 2f),
  517. 0).normalized;
  518. int attackDir = 0;
  519. switch (shotDown.directionType)
  520. {
  521. case AttackInfo.ShotDown.DirectionType.Common:
  522. attackDir = attackFrom.localScale.x < 0 ? -1 : 1;
  523. break;
  524. case AttackInfo.ShotDown.DirectionType.Spread:
  525. attackDir = attackFrom.position.x < transform.position.x ? -1 : 1;
  526. break;
  527. }
  528. if (attackDir < 0)
  529. {
  530. vec3.x = -vec3.x;
  531. }
  532. rb.useGravity = true;
  533. rb.constraints = RigidbodyConstraints.FreezeRotation | RigidbodyConstraints.FreezePositionZ;
  534. rb.velocity = Vector3.zero;
  535. rb.AddForce(vec3 * shotDown.force * (1 - resistances.ShotDown), ForceMode.Impulse);
  536. rb.transform.rotation = Quaternion.Euler(0, 0, 0);
  537. character.ani.Play("hitted", 0, 0);
  538. character.nowCanFly = false;
  539. startFlyPos = transform.position;
  540. hitState = 0;
  541. isFly = false;
  542. character.ChangeState(CharacterState.SpecialStatus_ShotDown);
  543. character.ChangeStateText(CharacterState.SpecialStatus_ShotDown);
  544. }
  545. //受到击晕
  546. public void AddWeak(AttackController.AttackMethod attackMethod)
  547. {
  548. if (resistances.Weak == 1)
  549. {
  550. return;
  551. }
  552. this.attackMethod = attackMethod;
  553. AttackInfo.Weak weak = attackMethod.attackInfo.weak;
  554. attributeTime = weak.time * (1 - resistances.Weak);
  555. character.ani.Play("weak", 0, 0);
  556. character.ChangeState(CharacterState.SpecialStatus_Weak);
  557. character.ChangeStateText(CharacterState.SpecialStatus_Weak);
  558. }
  559. public void AddWeak(float _attributeTime)
  560. {
  561. if (resistances.Weak == 1 || character.isDie)
  562. {
  563. return;
  564. }
  565. attributeTime = _attributeTime;
  566. character.ani.Play("weak", 0, 0);
  567. character.ChangeState(CharacterState.SpecialStatus_Weak);
  568. character.ChangeStateText(CharacterState.SpecialStatus_Weak);
  569. }
  570. //受到穿甲
  571. public int AddArmorPiercing(AttackController.AttackMethod attackMethod)
  572. {
  573. this.attackMethod = attackMethod;
  574. AttackInfo.ArmorPiercing armor = attackMethod.attackInfo.armorPiercing;
  575. //计算护甲减免
  576. int am = resistances.armor;
  577. if (am > 0)
  578. {
  579. am = am - armor.rate;
  580. if (am < 0)
  581. {
  582. am = 0;
  583. }
  584. }
  585. return am;
  586. }
  587. //受到易伤
  588. public void AddVulnerable(float _vulnerableRate,float _vulnerableTime)
  589. {
  590. vulnerableRate += _vulnerableRate;
  591. vulnerableTime = _vulnerableTime;
  592. haveVulnerable = true;
  593. Debug.Log("添加易伤,vulnerableTime:" + vulnerableTime + ",vulnerableRate:" + vulnerableRate);
  594. }
  595. //受到累伤
  596. public void AddStackingWouds(AttackController.AttackMethod attackMethod)
  597. {
  598. this.attackMethod = attackMethod;
  599. AttackInfo.StackingWounds stackingWounds = attackMethod.attackInfo.stackingWounds;
  600. if(stackingWoudsTime > 0)
  601. {
  602. stackingWords += attackMethod.attackInfo.stackingWounds.damage;
  603. }
  604. stackingWoudsTime = stackingWounds.time;
  605. }
  606. }