661 lines
26 KiB
661 lines
26 KiB
using UnityEngine; |
|
using System.Collections; |
|
using AX.TrackRecord; |
|
using System; |
|
using AX.MessageSystem; |
|
using UnityEngine.UI; |
|
using System.Collections.Generic; |
|
public class ControlJuGaoChe : ControlJuBi |
|
{ |
|
|
|
private GameObject part1; |
|
private GameObject part2; |
|
private GameObject part3; |
|
private GameObject part4; |
|
private GameObject part5; |
|
private GameObject part6; |
|
private GameObject part7; |
|
private GameObject part8; |
|
private GameObject part9; |
|
private GameObject water; |
|
private CarMessage CarMess; |
|
float rotatSpeed = 10; |
|
float zSpeed = 5; |
|
float aspect = 1.5f; |
|
bool ctrlDown = false; |
|
public bool firstZero = true; |
|
public bool firstFull = false; |
|
public bool secondZero = true; |
|
public bool secondFull = false; |
|
public bool thirdZero = true; |
|
public bool thirdFull = false; |
|
bool zero = true; |
|
bool full = false; |
|
public bool Min = false; |
|
public bool Max = false; |
|
//public LouCengControllor zSpeedId; |
|
bool TheOneFull = true; |
|
bool TheOneZero = false; |
|
bool TheTwoFull = true; |
|
bool TheTwoZero = false; |
|
bool TheThreeFull = true; |
|
bool TheThreeZero = false; |
|
|
|
|
|
private GameObject CarControlToggle; |
|
GameObject TimeZhou; |
|
public float GetRiseNum; |
|
//public int RiseNum; |
|
float part; |
|
public float MaxRise = 32; |
|
Slider zSpeedId; |
|
float SpeedBase = 30; |
|
private Car_3_JGC_GPC_YTC_Rise_Attribute carAttribut = new Car_3_JGC_GPC_YTC_Rise_Attribute(); |
|
public Car_3_JGC_GPC_YTC_Rise_Attribute CarAttribut |
|
{ |
|
set |
|
{ |
|
carAttribut = value; |
|
firstZero = carAttribut.FirstZero; |
|
firstFull = carAttribut.FirstFull; |
|
secondZero = carAttribut.SecondZero; |
|
secondFull = carAttribut.SecondFull; |
|
thirdZero = carAttribut.ThirdZero; |
|
thirdFull = carAttribut.ThirdFull; |
|
//RiseNum = carAttribut.RiseNum; |
|
MaxRise = carAttribut.MaxRise; |
|
} |
|
get |
|
{ |
|
carAttribut.FirstZero = firstZero; |
|
carAttribut.FirstFull = firstFull; |
|
carAttribut.SecondZero = secondZero; |
|
carAttribut.SecondFull = secondFull; |
|
carAttribut.ThirdZero = thirdZero; |
|
carAttribut.ThirdFull = thirdFull; |
|
//carAttribut.RiseNum = RiseNum; |
|
carAttribut.MaxRise = MaxRise; |
|
return carAttribut; |
|
} |
|
} |
|
|
|
public ArrayList GetBoolState() |
|
{ |
|
ArrayList boolList = new ArrayList(); |
|
boolList.Add(firstZero); |
|
boolList.Add(firstFull); |
|
boolList.Add(secondZero); |
|
boolList.Add(secondFull); |
|
boolList.Add(thirdZero); |
|
boolList.Add(thirdFull); |
|
boolList.Add(zero); |
|
boolList.Add(full); |
|
return boolList; |
|
} |
|
public void SetBoolState(ArrayList boollist) |
|
{ |
|
if (boollist.Count < 8) |
|
return; |
|
firstZero = (bool)boollist[0]; |
|
firstFull = (bool)boollist[1]; |
|
secondZero = (bool)boollist[2]; |
|
secondFull = (bool)boollist[3]; |
|
thirdZero = (bool)boollist[4]; |
|
thirdFull = (bool)boollist[5]; |
|
zero = (bool)boollist[6]; |
|
full = (bool)boollist[7]; |
|
} |
|
void Awake() |
|
{ |
|
CarMess = this.gameObject.GetComponent<CarMessage>(); |
|
part1 = this.transform.Find("Bi").gameObject; |
|
part2 = this.transform.Find("Bi/Bi1").gameObject; |
|
part3 = this.transform.Find("Bi/Bi1/Bi2").gameObject; |
|
part4 = this.transform.Find("Bi/Bi1/Bi2/Bi3").gameObject; |
|
part5 = this.transform.Find("Bi/Bi1/Bi2/Bi3/Bi4").gameObject; |
|
part6 = this.transform.Find("Bi/Bi1/Bi2/Bi3/Bi4/Bi5").gameObject; |
|
part7 = this.transform.Find("Bi/Bi1/Bi2/Bi3/Bi4/Bi5/pingtai").gameObject; |
|
part9 = part7.transform.Find("shuipao").gameObject; |
|
part8 = this.transform.Find("polySurface3148/zhijia").gameObject; |
|
//water = part9.transform.FindChild("Hose").gameObject; |
|
part = (int)(100 / 5); |
|
Part1currentFrame_y = part1.transform.localEulerAngles.y; |
|
Part2currentFrame_x = part2.transform.localEulerAngles.x; |
|
Part3currentFrame_z = part3.transform.localPosition.z; |
|
Part4currentFrame_z = part4.transform.localPosition.z; |
|
Part5currentFrame_z = part5.transform.localPosition.z; |
|
Part6currentFrame_x = part6.transform.localEulerAngles.x; |
|
Part1lastFrame_y = Part1currentFrame_y; |
|
Part2lastFrame_x = Part2currentFrame_x; |
|
Part3lastFrame_z = Part3currentFrame_z; |
|
Part4lastFrame_z = Part4currentFrame_z; |
|
Part5lastFrame_z = Part5currentFrame_z; |
|
Part6lastFrame_x = Part6currentFrame_x; |
|
|
|
zSpeedId = GameObject.Find("Canvas").transform.Find("控制举臂").GetComponent<ControlRiseCar>().TheSlider; |
|
|
|
CarControlToggle = GameObject.Find("Canvas").transform.Find("控制举臂").gameObject; |
|
} |
|
//void OnDestroy() |
|
//{ |
|
// MessageDispatcher.RemoveListener("LeftShift_W_JGC", LeftShift_W_JGC, "CUBE"); |
|
// MessageDispatcher.RemoveListener("LeftShift_S_JGC", LeftShift_S_JGC, "CUBE"); |
|
// MessageDispatcher.RemoveListener("W_JGC", W_JGC, "CUBE"); |
|
// MessageDispatcher.RemoveListener("S_JGC", S_JGC, "CUBE"); |
|
// MessageDispatcher.RemoveListener("U_JGC", U_JGC, "CUBE"); |
|
// MessageDispatcher.RemoveListener("J_JGC", J_JGC, "CUBE"); |
|
// MessageDispatcher.RemoveListener("A_JGC", A_JGC, "CUBE"); |
|
// MessageDispatcher.RemoveListener("D_JGC", D_JGC, "CUBE"); |
|
// MessageDispatcher.RemoveListener("H_JGC", H_JGC, "CUBE"); |
|
// MessageDispatcher.RemoveListener("K_JGC", K_JGC, "CUBE"); |
|
// MessageDispatcher.RemoveListener("LeftShift_U_JGC", LeftShift_U_JGC, "CUBE"); |
|
// MessageDispatcher.RemoveListener("LeftShift_J_JGC", LeftShift_J_JGC, "CUBE"); |
|
// MessageDispatcher.RemoveListener("Equals_JGC", Equals_JGC, "CUBE"); |
|
// MessageDispatcher.RemoveListener("Minus_JGC", Minus_JGC, "CUBE"); |
|
// MessageDispatcher.RemoveListener("BackZhiJia", BackZhiJia); |
|
//} |
|
//void OnDisable() |
|
//{ |
|
// MessageDispatcher.RemoveListener("LeftShift_W_JGC", LeftShift_W_JGC, "CUBE"); |
|
// MessageDispatcher.RemoveListener("LeftShift_S_JGC", LeftShift_S_JGC, "CUBE"); |
|
// MessageDispatcher.RemoveListener("W_JGC", W_JGC, "CUBE"); |
|
// MessageDispatcher.RemoveListener("S_JGC", S_JGC, "CUBE"); |
|
// MessageDispatcher.RemoveListener("U_JGC", U_JGC, "CUBE"); |
|
// MessageDispatcher.RemoveListener("J_JGC", J_JGC, "CUBE"); |
|
// MessageDispatcher.RemoveListener("A_JGC", A_JGC, "CUBE"); |
|
// MessageDispatcher.RemoveListener("D_JGC", D_JGC, "CUBE"); |
|
// MessageDispatcher.RemoveListener("H_JGC", H_JGC, "CUBE"); |
|
// MessageDispatcher.RemoveListener("K_JGC", K_JGC, "CUBE"); |
|
// MessageDispatcher.RemoveListener("LeftShift_U_JGC", LeftShift_U_JGC, "CUBE"); |
|
// MessageDispatcher.RemoveListener("LeftShift_J_JGC", LeftShift_J_JGC, "CUBE"); |
|
// MessageDispatcher.RemoveListener("Equals_JGC", Equals_JGC, "CUBE"); |
|
// MessageDispatcher.RemoveListener("Minus_JGC", Minus_JGC, "CUBE"); |
|
// MessageDispatcher.RemoveListener("BackZhiJia", BackZhiJia); |
|
//} |
|
//void OnEnable() |
|
//{ |
|
// MessageDispatcher.AddListener("LeftShift_W_JGC", LeftShift_W_JGC, "CUBE"); |
|
// MessageDispatcher.AddListener("LeftShift_S_JGC", LeftShift_S_JGC, "CUBE"); |
|
// MessageDispatcher.AddListener("W_JGC", W_JGC, "CUBE"); |
|
// MessageDispatcher.AddListener("S_JGC", S_JGC, "CUBE"); |
|
// MessageDispatcher.AddListener("U_JGC", U_JGC, "CUBE"); |
|
// MessageDispatcher.AddListener("J_JGC", J_JGC, "CUBE"); |
|
// MessageDispatcher.AddListener("A_JGC", A_JGC, "CUBE"); |
|
// MessageDispatcher.AddListener("D_JGC", D_JGC, "CUBE"); |
|
// MessageDispatcher.AddListener("H_JGC", H_JGC, "CUBE"); |
|
// MessageDispatcher.AddListener("K_JGC", K_JGC, "CUBE"); |
|
// MessageDispatcher.AddListener("LeftShift_U_JGC", LeftShift_U_JGC, "CUBE"); |
|
// MessageDispatcher.AddListener("LeftShift_J_JGC", LeftShift_J_JGC, "CUBE"); |
|
// MessageDispatcher.AddListener("Equals_JGC", Equals_JGC, "CUBE"); |
|
// MessageDispatcher.AddListener("Minus_JGC", Minus_JGC, "CUBE"); |
|
// MessageDispatcher.AddListener("BackZhiJia", BackZhiJia); |
|
//} |
|
public override void BackZhiJia(IMessage message) |
|
{ |
|
if ((string)message.Data == this.gameObject.name) |
|
{ |
|
part1.transform.localPosition = new Vector3(-0.09668041f, 2.987368f, -4.938063f); |
|
part1.transform.localEulerAngles = new Vector3(0, 0, 0); |
|
part2.transform.localPosition = new Vector3(0.04685513f, 2.295632f, -1.095285f); |
|
part2.transform.localEulerAngles = new Vector3(-5.954f, 0, 0); |
|
part3.transform.localPosition = new Vector3(0.02088456f, 0.1439531f, 0.2888333f); |
|
part3.transform.localEulerAngles = new Vector3(0, 0, 0); |
|
part4.transform.localPosition = new Vector3(-0.01290758f, 0.08318195f, 0.1470551f); |
|
part4.transform.localEulerAngles = new Vector3(0, 0, 0); |
|
part5.transform.localPosition = new Vector3(-0.03615425f, 0.2560756f, 0.04462866f); |
|
part5.transform.localEulerAngles = new Vector3(0, 0, 0); |
|
part6.transform.localPosition = new Vector3(0f, -1.03678f, 19.41323f); |
|
part6.transform.localEulerAngles = new Vector3(0, 0, 0); |
|
part9.transform.localPosition = new Vector3(-0.088f, 0.745f, 0.848f); |
|
part9.transform.localEulerAngles = new Vector3(2.725f, 362.828f, 2.006f); |
|
part7.transform.localEulerAngles = new Vector3(172.927f, -180.096f, 179.22f); |
|
part7.transform.localPosition = new Vector3(0.049f, -1.467f, -15.608f); |
|
|
|
MaxRise = 32; |
|
NewSetBool(); |
|
if (RecordManager.Instance.IsRecording) |
|
{ |
|
MessageDispatcher.SendMessage("RecordZhiJiaBack", (object)this.gameObject.name); |
|
} |
|
} |
|
} |
|
public override void LeftShift_W(IMessage message) |
|
{ |
|
if ((string)message.Data == this.gameObject.name) |
|
{ |
|
if (gameObject.GetComponent<LineamentEvent>().ControlJuBi && CarControlToggle.activeInHierarchy) |
|
{ |
|
if (int.Parse(CarMess.CarAttri.Hegih) <= part * 2) |
|
{ |
|
return; |
|
} |
|
float TheHeigh = MaxRise + part3.transform.localPosition.z + part4.transform.localPosition.z + part5.transform.localPosition.z; |
|
if (TheHeigh > float.Parse(CarMess.Heigh)) |
|
{ |
|
return; |
|
} |
|
|
|
if (!firstFull) |
|
{ |
|
float z = part3.transform.localPosition.z; |
|
if (float.Parse(CarMess.Heigh) - MaxRise >= part) |
|
{ |
|
if (z > 19.4f) |
|
{ |
|
firstFull = true; |
|
//MaxRise += part; |
|
Vector3 newVector = part3.transform.localPosition; |
|
newVector.z = 19.4f; |
|
} |
|
else |
|
{ |
|
firstZero = false; |
|
part3.transform.localPosition = new Vector3(0.016f, 0.174f, z + Time.deltaTime * zSpeedId.value * SpeedBase / aspect); |
|
} |
|
} |
|
else |
|
{ |
|
if (float.Parse(CarMess.Heigh) - MaxRise >= part) |
|
{ |
|
if (z >= 0 && z < 19.4f) |
|
{ |
|
|
|
firstZero = false; |
|
part3.transform.localPosition = new Vector3(-0.025f, 0.174f, z + Time.deltaTime * zSpeedId.value * SpeedBase / aspect); |
|
} |
|
else |
|
{ |
|
firstFull = false; |
|
} |
|
} |
|
} |
|
|
|
} |
|
else if (firstFull && !secondFull) |
|
{ |
|
float z = part4.transform.localPosition.z; |
|
if (float.Parse(CarMess.Heigh) - MaxRise >= part) |
|
{ |
|
if (z > 19.4f) |
|
{ |
|
secondFull = true; |
|
//MaxRise += part; |
|
Vector3 newVector = part4.transform.localPosition; |
|
newVector.z = 19.4f; |
|
} |
|
else |
|
{ |
|
secondZero = false; |
|
part4.transform.localPosition = new Vector3(-0.038f, 0.197f, z + Time.deltaTime * zSpeedId.value * SpeedBase / aspect); |
|
} |
|
} |
|
else |
|
{ |
|
if (float.Parse(CarMess.Heigh) - MaxRise >= part) |
|
{ |
|
if (z >= 0 && z < 19.4f) |
|
{ |
|
secondZero = false; |
|
part4.transform.localPosition = new Vector3(0.025f, 0.197f, z + Time.deltaTime * zSpeedId.value * SpeedBase / aspect); |
|
} |
|
else |
|
{ |
|
secondFull = false; |
|
} |
|
} |
|
} |
|
} |
|
else if (secondFull && !thirdFull) |
|
{ |
|
float z = part5.transform.localPosition.z; |
|
if (float.Parse(CarMess.Heigh) - MaxRise >= part) |
|
{ |
|
if (z > 19.4f) |
|
{ |
|
thirdFull = true; |
|
//MaxRise += part; |
|
Vector3 newVector = part5.transform.localPosition; |
|
newVector.z = 19.4f; |
|
} |
|
else |
|
{ |
|
thirdZero = false; |
|
part5.transform.localPosition = new Vector3(-0.038f, 0.197f, z + Time.deltaTime * zSpeedId.value * SpeedBase / aspect); |
|
} |
|
} |
|
else |
|
{ |
|
if (float.Parse(CarMess.Heigh) - MaxRise >= part) |
|
{ |
|
if (z >= 0 && z < 19.4f) |
|
{ |
|
thirdZero = false; |
|
part5.transform.localPosition = new Vector3(0.025f, 0.197f, z + Time.deltaTime * zSpeedId.value * SpeedBase / aspect); |
|
} |
|
else |
|
{ |
|
thirdFull = false; |
|
} |
|
} |
|
} |
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} //LeftShift_W控制车臂伸长 |
|
public override void LeftShift_S(IMessage message)//LeftShift_S控制车臂的缩短 |
|
{ |
|
if ((string)message.Data == this.gameObject.name) |
|
{ |
|
if (gameObject.GetComponent<LineamentEvent>().ControlJuBi && CarControlToggle.activeInHierarchy) |
|
{ |
|
if (!thirdZero) |
|
{ |
|
float z = part5.transform.localPosition.z; |
|
if (z <=0) |
|
{ |
|
thirdZero = true; |
|
//MaxRise -= part; |
|
Vector3 newVector = part5.transform.localPosition; |
|
newVector.z = 0; |
|
part5.transform.localPosition = newVector; |
|
} |
|
else |
|
{ |
|
thirdFull = false; |
|
part5.transform.localPosition = new Vector3(-0.038f, 0.197f, z - Time.deltaTime * zSpeedId.value * SpeedBase / aspect); |
|
} |
|
} |
|
else if (thirdZero && !secondZero) |
|
{ |
|
float z = part4.transform.localPosition.z; |
|
if (z <= 0) |
|
{ |
|
secondZero = true; |
|
//MaxRise -= part; |
|
Vector3 newVector = part4.transform.localPosition; |
|
newVector.z = 0; |
|
part4.transform.localPosition = newVector; |
|
} |
|
else |
|
{ |
|
secondFull = false; |
|
part4.transform.localPosition = new Vector3(-0.038f, 0.197f, z - Time.deltaTime * zSpeedId.value * SpeedBase / aspect); |
|
} |
|
|
|
} |
|
else if (secondZero && !firstZero) |
|
{ |
|
float z = part3.transform.localPosition.z; |
|
if (z <= 0) |
|
{ |
|
firstZero = true; |
|
MaxRise = 32; |
|
Vector3 newVector=part3.transform.localPosition; |
|
newVector.z=0; |
|
part3.transform.localPosition = newVector; |
|
} |
|
else |
|
{ |
|
firstFull = false; |
|
part3.transform.localPosition = new Vector3(0.016f, 0.174f, z - Time.deltaTime * zSpeedId.value * SpeedBase / aspect); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
public override void W(IMessage message)//W控制车臂抬起 |
|
{ |
|
if ((string)message.Data == this.gameObject.name) |
|
{ |
|
if (gameObject.GetComponent<LineamentEvent>().ControlJuBi && CarControlToggle.activeInHierarchy) |
|
{ |
|
if (part2.transform.localEulerAngles.x >= 285 && part2.transform.localEulerAngles.x <= 359) |
|
{ |
|
part2.transform.Rotate(-Time.deltaTime * zSpeedId.value * SpeedBase, 0, 0); |
|
} |
|
} |
|
} |
|
} |
|
public override void S(IMessage message)//S控制车臂的放下 |
|
{ |
|
if ((string)message.Data == this.gameObject.name) |
|
{ |
|
if (gameObject.GetComponent<LineamentEvent>().ControlJuBi && CarControlToggle.activeInHierarchy) |
|
{ |
|
if (part2.transform.localEulerAngles.x > 353.5) |
|
{ |
|
return; |
|
} |
|
else |
|
{ |
|
part2.transform.Rotate(Time.deltaTime * zSpeedId.value * SpeedBase, 0, 0); |
|
} |
|
} |
|
} |
|
} |
|
public override void A(IMessage message)//A控制车臂的左旋转 |
|
{ |
|
if ((string)message.Data == this.gameObject.name) |
|
{ |
|
if (gameObject.GetComponent<LineamentEvent>().ControlJuBi && CarControlToggle.activeInHierarchy) |
|
{ |
|
part1.transform.Rotate(0, -Time.deltaTime * zSpeedId.value * SpeedBase, 0); |
|
} |
|
} |
|
} |
|
public override void D(IMessage message)//D控制车臂的右旋转 |
|
{ |
|
if ((string)message.Data == this.gameObject.name) |
|
{ |
|
if (gameObject.GetComponent<LineamentEvent>().ControlJuBi && CarControlToggle.activeInHierarchy) |
|
{ |
|
part1.transform.Rotate(0, Time.deltaTime * zSpeedId.value * SpeedBase, 0); |
|
} |
|
} |
|
} |
|
public override void H(IMessage message)//H控制喷水头的左旋转 |
|
{ |
|
if ((string)message.Data == this.gameObject.name) |
|
{ |
|
if (gameObject.GetComponent<LineamentEvent>().ControlShuiPao) |
|
{ |
|
part9.transform.Rotate(0, -Time.deltaTime * zSpeedId.value * SpeedBase, 0, Space.World); |
|
} |
|
} |
|
} |
|
public override void K(IMessage message)//K控制喷水头的右旋转 |
|
{ |
|
if ((string)message.Data == this.gameObject.name) |
|
{ |
|
if (gameObject.GetComponent<LineamentEvent>().ControlShuiPao) |
|
{ |
|
part9.transform.Rotate(0, Time.deltaTime * zSpeedId.value * SpeedBase, 0, Space.World); |
|
} |
|
|
|
} |
|
} |
|
public override void U(IMessage message) |
|
{ |
|
if ((string)message.Data == this.gameObject.name) |
|
{ |
|
if (gameObject.GetComponent<LineamentEvent>().ControlShuiPao) |
|
{ |
|
part9.transform.Rotate(-Time.deltaTime * zSpeedId.value * SpeedBase, 0, 0); |
|
} |
|
|
|
} |
|
} |
|
public override void J(IMessage message) |
|
{ |
|
if ((string)message.Data == this.gameObject.name) |
|
{ |
|
if (gameObject.GetComponent<LineamentEvent>().ControlShuiPao) |
|
{ |
|
part9.transform.Rotate(Time.deltaTime * zSpeedId.value * SpeedBase, 0, 0); |
|
} |
|
} |
|
} |
|
public override void LeftShift_U(IMessage message)//LeftShift_U控制喷水臂的收回 |
|
{ |
|
if ((string)message.Data == this.gameObject.name) |
|
{ |
|
if(gameObject.GetComponent<LineamentEvent>().ControlJuBi && CarControlToggle.activeInHierarchy) |
|
{ |
|
part6.transform.Rotate(-Time.deltaTime * zSpeedId.value * SpeedBase, 0, 0); |
|
} |
|
|
|
} |
|
} |
|
public override void LeftShift_J(IMessage message)//LeftShift_J控制喷水臂的抬起 |
|
{ |
|
if ((string)message.Data == this.gameObject.name) |
|
{ |
|
if(gameObject.GetComponent<LineamentEvent>().ControlJuBi && CarControlToggle.activeInHierarchy) |
|
{ |
|
part6.transform.Rotate(Time.deltaTime * zSpeedId.value * SpeedBase, 0, 0); |
|
} |
|
|
|
} |
|
} |
|
public override void Equals(IMessage message)//Equals控制水流增加 |
|
{ |
|
if ((string)message.Data == this.gameObject.name) |
|
{ |
|
if (gameObject.GetComponent<LineamentEvent>().ControlShuiPao) |
|
{ |
|
if (part9.transform.Find("Hose").childCount > 0) |
|
{ |
|
ParticleSystemControl scale = part9.transform.Find("Hose").GetChild(0).GetComponent<ParticleSystemControl>(); |
|
scale.waterStraightScale += Time.deltaTime * 0.5f; |
|
|
|
} |
|
|
|
//scale.waterFogScale += Time.deltaTime * 0.5f; |
|
|
|
} |
|
} |
|
} |
|
public override void Minus(IMessage message)//Minus控制水流减少 |
|
{ |
|
if ((string)message.Data == this.gameObject.name) |
|
{ |
|
if (gameObject.GetComponent<LineamentEvent>().ControlShuiPao) |
|
{ |
|
if (part9.transform.Find("Hose").childCount > 0) |
|
{ |
|
ParticleSystemControl scale = part9.transform.Find("Hose").GetChild(0).GetComponent<ParticleSystemControl>(); |
|
scale.waterStraightScale -= Time.deltaTime * 0.5f; |
|
|
|
} |
|
|
|
//scale.waterFogScale -= Time.deltaTime * 0.5f; |
|
} |
|
} |
|
} |
|
|
|
public void NewSetBool() |
|
{ |
|
MaxRise = 32; |
|
|
|
firstZero = true; |
|
firstFull = false; |
|
secondZero = true; |
|
secondFull = false; |
|
thirdZero = true; |
|
thirdFull = false; |
|
|
|
zero = true; |
|
full = false; |
|
|
|
TheOneFull = true; |
|
TheOneZero = false; |
|
TheTwoFull = true; |
|
TheTwoZero = false; |
|
TheThreeFull = true; |
|
TheThreeZero = false; |
|
} |
|
|
|
|
|
bool OneUp = false; |
|
bool OneDown = false; |
|
bool TwoUp = false; |
|
bool TwoDown = false; |
|
bool ThreeUp = false; |
|
bool ThreeDown = false; |
|
|
|
float TIMESTAMP = 1f; |
|
float timer = 0f; |
|
float THRESHOLD = 0.1f; |
|
float Part1lastFrame_y; |
|
float Part1currentFrame_y; |
|
float Part2lastFrame_x; |
|
float Part2currentFrame_x; |
|
float Part3lastFrame_z; |
|
float Part3currentFrame_z; |
|
float Part4lastFrame_z; |
|
float Part4currentFrame_z; |
|
float Part5lastFrame_z; |
|
float Part5currentFrame_z; |
|
float Part6lastFrame_x; |
|
float Part6currentFrame_x; |
|
void Update() |
|
{ |
|
if (GetComponent<LineamentEvent>().ControlJuBi) |
|
{ |
|
|
|
var theta = Vector3.Dot(part7.transform.forward, Vector3.up); |
|
var angle = Mathf.Rad2Deg * theta; |
|
part7.transform.Rotate(angle, 0, 0); |
|
} |
|
if (Input.GetKeyDown(KeyCode.LeftControl)) |
|
{ |
|
ctrlDown = true; |
|
} |
|
else |
|
{ |
|
ctrlDown = false; |
|
}if (RecordManager.Instance.IsRecording) |
|
{ |
|
if (GetComponent<LineamentEvent>().ControlJuBi) |
|
{ |
|
if (timer > 0) |
|
{ |
|
timer -= Time.deltaTime; |
|
} |
|
else |
|
{ |
|
Part1currentFrame_y = part1.transform.localEulerAngles.y; |
|
Part2currentFrame_x = part2.transform.localEulerAngles.x; |
|
Part3currentFrame_z = part3.transform.localPosition.z; |
|
Part4currentFrame_z = part4.transform.localPosition.z; |
|
Part5currentFrame_z = part5.transform.localPosition.z; |
|
Part6currentFrame_x = part6.transform.localEulerAngles.x; |
|
|
|
|
|
if (Mathf.Abs(Part1currentFrame_y - Part1lastFrame_y) > THRESHOLD || |
|
Mathf.Abs(Part2currentFrame_x - Part2lastFrame_x) > THRESHOLD || |
|
Mathf.Abs(Part3currentFrame_z - Part3lastFrame_z) > THRESHOLD || |
|
Mathf.Abs(Part4currentFrame_z - Part4lastFrame_z) > THRESHOLD || |
|
Mathf.Abs(Part5currentFrame_z - Part5lastFrame_z) > THRESHOLD || |
|
Mathf.Abs(Part6currentFrame_x - Part6lastFrame_x) > THRESHOLD |
|
) |
|
{ |
|
|
|
MessageDispatcher.SendMessage("RecordControlJuBiEvent", (object)this.name); |
|
} |
|
Part1lastFrame_y = Part1currentFrame_y; |
|
Part2lastFrame_x = Part2currentFrame_x; |
|
Part3lastFrame_z = Part3currentFrame_z; |
|
Part4lastFrame_z = Part4currentFrame_z; |
|
Part5lastFrame_z = Part5currentFrame_z; |
|
Part6lastFrame_x = Part6currentFrame_x; |
|
timer = TIMESTAMP; |
|
} |
|
} |
|
} |
|
} |
|
|
|
}
|
|
|