ThiefBombAnimEvent.cs 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using System;
  2. using LitJson;
  3. using UnityEngine;
  4. public class ThiefBombAnimEvent : BaseBehaviour
  5. {
  6. private void Awake()
  7. {
  8. this._action = base.GetComponent<ThiefBombAction>();
  9. this._enemyAtk = base.GetComponentInChildren<EnemyAtk>();
  10. }
  11. private void Start()
  12. {
  13. this._jsonData = SingletonMono<EnemyDataPreload>.Instance.attack[EnemyType.背弹者];
  14. }
  15. public void ChangeState(ThiefBombAction.StateEnum sta)
  16. {
  17. this._action.AnimChangeState(sta, 1f);
  18. }
  19. public void SetAtkData()
  20. {
  21. this._enemyAtk.atkData = this._jsonData[this._action.stateMachine.currentState];
  22. }
  23. public void PlaySound(int id)
  24. {
  25. R.Audio.PlayEffect(id, new Vector3?(base.transform.position));
  26. }
  27. public void DestroySelf()
  28. {
  29. base.Invoke("RealDestroy", 2f);
  30. base.gameObject.SetActive(false);
  31. }
  32. private void RealDestroy()
  33. {
  34. UnityEngine.Object.Destroy(base.gameObject);
  35. }
  36. public void PlayBombEffect()
  37. {
  38. Transform transform = R.Effect.Generate(162, base.transform, Vector2.up * 1.2f, default(Vector3), default(Vector3), true);
  39. EnemyBullet componentInChildren = transform.GetComponentInChildren<EnemyBullet>();
  40. componentInChildren.SetAtkData(this._jsonData[this._action.stateMachine.currentState]);
  41. componentInChildren.damage = base.GetComponentInChildren<EnemyAttribute>().atk;
  42. componentInChildren.origin = null;
  43. }
  44. private ThiefBombAction _action;
  45. private JsonData _jsonData;
  46. private EnemyAtk _enemyAtk;
  47. }