|
|
@@ -1,4 +1,5 @@
|
|
|
-using System.Collections;
|
|
|
+using System;
|
|
|
+using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
|
using UnityEngine;
|
|
|
/* 弓对象 */
|
|
|
@@ -7,35 +8,48 @@ public class ArmBow : MonoBehaviour
|
|
|
[SerializeField] AnimationPlayer AP_arm;
|
|
|
[SerializeField] AnimationPlayer AP_bow;
|
|
|
[SerializeField] GameObject arrow;
|
|
|
- [SerializeField] BowCamera bowCamera;
|
|
|
+ BowCamera _bowCamera;
|
|
|
+ BowCamera bowCamera {
|
|
|
+ get {
|
|
|
+ if (!_bowCamera) _bowCamera = GetComponentInParent<BowCamera>();
|
|
|
+ return _bowCamera;
|
|
|
+ }
|
|
|
+ }
|
|
|
public HashSet<TargetBody> validTargets = new HashSet<TargetBody>();
|
|
|
+
|
|
|
+ //射箭姿态记录索引倒退数,根据射击难度制造误差
|
|
|
+ [NonSerialized] public int shootBackTime = 0;
|
|
|
|
|
|
- public int shootBackTime = 0;
|
|
|
+ bool canShoot = false;
|
|
|
+ bool pulling = false;
|
|
|
+ bool readying = false;
|
|
|
|
|
|
- private bool canShoot = false;
|
|
|
- private bool pulling = false;
|
|
|
- private bool readying = false;
|
|
|
//禁止准备的外部接口
|
|
|
- public bool banReady = false;
|
|
|
+ [NonSerialized] public bool banReady = false;
|
|
|
//禁止射击的外部接口
|
|
|
- public bool banShoot = false;
|
|
|
+ [NonSerialized] public bool banShoot = false;
|
|
|
+
|
|
|
+ //九轴姿态记录
|
|
|
+ [NonSerialized] public Quaternion[] recordRotations = new Quaternion[100];
|
|
|
+ float[] recordRotationVars = new float[99];
|
|
|
+ [NonSerialized] public int recordCount = 0;
|
|
|
|
|
|
public static ArmBow ins;
|
|
|
- public Quaternion[] recordRotations = new Quaternion[100];
|
|
|
- public float[] recordRotationVars = new float[99];
|
|
|
- public int recordCount = 0;
|
|
|
|
|
|
- void Start()
|
|
|
+ void Awake()
|
|
|
{
|
|
|
ins = this;
|
|
|
- this.readyShoot();
|
|
|
-
|
|
|
//initdata
|
|
|
int currentShootLevel = LoginMgr.myUserInfo.shootLevel;
|
|
|
int[] shootBackTimes = {0, 1, 5};
|
|
|
shootBackTime = shootBackTimes[currentShootLevel];
|
|
|
}
|
|
|
|
|
|
+ void Start()
|
|
|
+ {
|
|
|
+ this.readyShoot();
|
|
|
+ }
|
|
|
+
|
|
|
void FixedUpdate()
|
|
|
{
|
|
|
if (this.canShoot)
|