using System; using System.Collections; using GameWorld; using LitJson; using UnityEngine; public class RiderGunAnimEvent : BaseBehaviour { private Transform player { get { return R.Player.Transform; } } private void Start() { this._action = base.GetComponent(); this._eAttr = base.GetComponent(); this._atk = base.GetComponentInChildren(); this._atkData = SingletonMono.Instance.attack[EnemyType.骑兵改]; this._atk2LoopTimes = 2; } public void ChangeState(RiderGunAction.StateEnum sta) { this._action.AnimChangeState(sta, 1f); } public void Atk2End() { this._atk2LoopTimes--; if (this._atk2LoopTimes <= 0) { this._atk2LoopTimes = 2; this._action.AnimChangeState(RiderGunAction.StateEnum.Atk2End, 1f); } } public void StartPabody() { this._eAttr.paBody = true; } public void EndPabody() { this._eAttr.paBody = false; } public void SetAtkData() { this._atk.atkData = this._atkData[this._action.stateMachine.currentState]; } public void LunchBullet() { float num = Vector2.Angle(this.gunLunch.position - this.gun.position, Vector2.up); Transform transform = UnityEngine.Object.Instantiate(this.bulletPrefab, this.gunLunch.position, Quaternion.identity); transform.localRotation = Quaternion.Euler(0f, 0f, (float)this._eAttr.faceDir * -num); transform.GetComponent().velocity = (this.gunLunch.position - this.gun.position).normalized * 20f; EnemyBullet component = transform.GetComponent(); component.damage = this._eAttr.atk; component.origin = base.gameObject; component.SetAtkData(this._atkData["GunAtk2Ready"]); } public void SpwanEffect() { GameObject gameObject = UnityEngine.Object.Instantiate(this.atkEffect, base.transform.position + Vector3.back * 0.01f, Quaternion.identity); gameObject.GetComponent().state.SetAnimation(0, this._action.stateMachine.currentState, false); gameObject.transform.localScale = base.transform.localScale; gameObject.AddComponent(); UnityEngine.Object.Destroy(gameObject.GetComponent()); } public void PlaySound(int index) { R.Audio.PlayEffect(index, new Vector3?(base.transform.position)); } public void PlayMoveSound() { R.Audio.PlayEffect(this.moveSound[UnityEngine.Random.Range(0, this.moveSound.Length)], new Vector3?(base.transform.position)); } public void DestroySelf() { base.Invoke("RealDestroy", 2f); base.gameObject.SetActive(false); } private void RealDestroy() { UnityEngine.Object.Destroy(base.gameObject); } public void BackToIdle() { if (this._action.IsInWeakSta()) { this._eAttr.enterWeakMod = false; this._action.AnimChangeState(RiderAction.StateEnum.WeakMod, 1f); } else { this._action.AnimChangeState(RiderAction.StateEnum.Ready, 1f); } } public IEnumerator WeakOver() { for (int i = 0; i < 116; i++) { if (this._action.stateMachine.currentState == "WeakMod" && !this._action.IsInWeakSta()) { this._action.AnimChangeState(RiderAction.StateEnum.Ready, 1f); } yield return new WaitForFixedUpdate(); } yield break; } public void QTECameraZoomIn() { R.Camera.Controller.CameraZoom(base.transform.position + Vector3.up * 3f, 0.2f, 3f); R.Camera.Controller.CameraShake(0.2f, 0.4f, CameraController.ShakeTypeEnum.Rect, false); R.Camera.Controller.OpenMotionBlur(0.13333334f, 1f, base.transform.position); } public void QTEFinalHurt() { EnemyHurtAtkEventArgs args = new EnemyHurtAtkEventArgs(base.gameObject, EnemyHurtAtkEventArgs.HurtTypeEnum.QTEHurt); EventManager.PostEvent("EnemyHurtAtk", this.player.gameObject, args); } public void QTEPlyerAttack() { R.Player.Action.ChangeState(PlayerAction.StateEnum.RiderQTEHurt_2, 1f); } public void QTEPlayerBack() { R.Player.Action.ChangeState(PlayerAction.StateEnum.EndAtk, 1f); } public void ExecuteEffect() { EnemyBaseHurt component = base.GetComponent(); component.HitEffect(component.center.localPosition, "Atk1"); } public void ExecuteShadeAttack() { R.Effect.Generate(180, null, base.transform.position, default(Vector3), default(Vector3), true); } public void ExecutePlyerAttack() { Vector3 position = base.transform.position + Vector3.up * 2.1f; position.z = LayerManager.ZNum.MMiddle_P; this.player.position = position; R.Player.Action.ChangeState(PlayerAction.StateEnum.RiderQTEHurt_3, 2f); } public void ExecuteFinalHurt() { EnemyHurtAtkEventArgs args = new EnemyHurtAtkEventArgs(base.gameObject, EnemyHurtAtkEventArgs.HurtTypeEnum.Execute, string.Empty); EventManager.PostEvent("EnemyHurtAtk", this.player.gameObject, args); } private RiderGunAction _action; private EnemyAttribute _eAttr; private int _atk2LoopTimes; private EnemyAtk _atk; private JsonData _atkData; [SerializeField] private Transform gun; [SerializeField] private Transform gunLunch; [SerializeField] private Transform bulletPrefab; [SerializeField] private GameObject atkEffect; [SerializeField] private int[] moveSound; }