You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
698 lines
29 KiB
698 lines
29 KiB
3 years ago
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
using System;
|
||
|
using AX.MessageSystem;
|
||
|
using AX.TrackRecord;
|
||
|
using UnityEngine.UI;
|
||
|
using System.Collections.Generic;
|
||
|
public class ControlGaoPenChe : 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 water;
|
||
|
private CarMessage CarMess;
|
||
|
bool Middle=false;
|
||
|
float zSpeed = 5;
|
||
|
float aspect = 1.5f;
|
||
|
float SpeedBase=30;
|
||
|
bool ctrlDown = false;
|
||
|
public bool Min = false;
|
||
|
public bool Max = false;
|
||
|
//public LouCengControllor zSpeedId;
|
||
|
Slider zSpeedId;
|
||
|
private GameObject CarControlToggle;
|
||
|
GameObject TimeZhou;
|
||
|
private Car_3_JGC_GPC_YTC_Rise_Attribute carAttribute = new Car_3_JGC_GPC_YTC_Rise_Attribute();
|
||
|
public Car_3_JGC_GPC_YTC_Rise_Attribute CarAttribute
|
||
|
{
|
||
|
set
|
||
|
{
|
||
|
carAttribute = value;
|
||
|
firstZero = carAttribute.FirstZero;
|
||
|
firstFull = carAttribute.FirstFull;
|
||
|
secondZero = carAttribute.SecondZero;
|
||
|
secondFull = carAttribute.SecondFull;
|
||
|
thirdZero = carAttribute.ThirdZero;
|
||
|
thirdFull = carAttribute.ThirdFull;
|
||
|
fourthZero = carAttribute.FourthZero;
|
||
|
fourthFull = carAttribute.FourthFull;
|
||
|
//RiseNum = carAttribute.RiseNum;
|
||
|
MaxRise = carAttribute.MaxRise;
|
||
|
}
|
||
|
get
|
||
|
{
|
||
|
carAttribute.FirstZero = firstZero;
|
||
|
carAttribute.FirstFull = firstFull;
|
||
|
carAttribute.SecondZero = secondZero;
|
||
|
carAttribute.SecondFull = secondFull;
|
||
|
carAttribute.ThirdZero = thirdZero;
|
||
|
carAttribute.ThirdFull = thirdFull;
|
||
|
carAttribute.FourthZero = fourthZero;
|
||
|
carAttribute.FourthFull = fourthFull;
|
||
|
//carAttribute.RiseNum = RiseNum;
|
||
|
carAttribute.MaxRise = MaxRise;
|
||
|
return carAttribute;
|
||
|
}
|
||
|
}
|
||
|
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/Bi6").gameObject;
|
||
|
part8 = this.transform.Find("Bi/Bi1/Bi2/Bi3/Bi4/Bi5/Bi6/pentou").gameObject;
|
||
|
//water = part8.transform.FindChild("Hose").GetChild(1).gameObject;
|
||
|
zSpeedId = GameObject.Find("Canvas").transform.Find("控制举臂").GetComponent<ControlRiseCar>().TheSlider;
|
||
|
timer = TIMESTAMP;
|
||
|
part = 15.8f;
|
||
|
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_z = part6.transform.localPosition.z;
|
||
|
Part7currentFrame_x = part7.transform.localEulerAngles.x;
|
||
|
Part1lastFrame_y = Part1currentFrame_y;
|
||
|
Part2lastFrame_x = Part2currentFrame_x;
|
||
|
Part3lastFrame_z = Part3currentFrame_z;
|
||
|
Part4lastFrame_z = Part4currentFrame_z;
|
||
|
Part5lastFrame_z = Part5currentFrame_z;
|
||
|
Part6lastFrame_z = Part6currentFrame_z;
|
||
|
Part7lastFrame_x = Part7currentFrame_x;
|
||
|
|
||
|
CarControlToggle = GameObject.Find("Canvas").transform.Find("控制举臂").gameObject;
|
||
|
}
|
||
|
public override void BackZhiJia(IMessage message)
|
||
|
{
|
||
|
if ((string)message.Data == this.gameObject.name)
|
||
|
{
|
||
|
part1.transform.localPosition = new Vector3(0.1158764f, 2.884305f, -5.409204f);
|
||
|
part1.transform.localEulerAngles=new Vector3(0,0,0);
|
||
|
part2.transform.localPosition = new Vector3(0.04685513f, 2.295632f, -1.095285f);
|
||
|
part2.transform.localEulerAngles = new Vector3(-6.452f, 0, 0);
|
||
|
part3.transform.localPosition = new Vector3(-0.03794783f, 0.2298133f, 0.4708243f);
|
||
|
part3.transform.localEulerAngles = new Vector3(0, 0, 0);
|
||
|
part4.transform.localPosition = new Vector3(0, 0, 0.194763f);
|
||
|
part4.transform.localEulerAngles = new Vector3(0, 0, 0);
|
||
|
part5.transform.localPosition = new Vector3(0, 1.136868e-15f, 0.07003048f);
|
||
|
part5.transform.localEulerAngles = new Vector3(0, 0, 0);
|
||
|
part6.transform.localPosition = new Vector3(0.002715573f, 0.2560885f, 0.1570805f);
|
||
|
part6.transform.localEulerAngles = new Vector3(0, 0, 0);
|
||
|
part7.transform.localPosition = new Vector3(4.547473e-15f, -0.9121876f, 15.99139f);
|
||
|
part7.transform.localEulerAngles = new Vector3(0, 0, 0);
|
||
|
part8.transform.localPosition = new Vector3(0.0355448f, -0.8291441f, -12.53523f);
|
||
|
part8.transform.localEulerAngles = new Vector3(0, 0, 0);
|
||
|
MaxRise = 32;
|
||
|
|
||
|
NewSetBool();
|
||
|
|
||
|
if (RecordManager.Instance.IsRecording)
|
||
|
{
|
||
|
MessageDispatcher.SendMessage("RecordZhiJiaBack", (object)this.gameObject.name);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
//void OnDestroy()
|
||
|
//{
|
||
|
// MessageDispatcher.RemoveListener("LeftShift_W_GPC", LeftShift_W_GPC, "CUBE");
|
||
|
// MessageDispatcher.RemoveListener("LeftShift_S_GPC", LeftShift_S_GPC, "CUBE");
|
||
|
// MessageDispatcher.RemoveListener("W_GPC", W_GPC, "CUBE");
|
||
|
// MessageDispatcher.RemoveListener("S_GPC", S_GPC, "CUBE");
|
||
|
// MessageDispatcher.RemoveListener("A_GPC", A_GPC, "CUBE");
|
||
|
// MessageDispatcher.RemoveListener("D_GPC", D_GPC, "CUBE");
|
||
|
// MessageDispatcher.RemoveListener("U_GPC", U_GPC, "CUBE");
|
||
|
// MessageDispatcher.RemoveListener("J_GPC", J_GPC, "CUBE");
|
||
|
// MessageDispatcher.RemoveListener("H_GPC", H_GPC, "CUBE");
|
||
|
// MessageDispatcher.RemoveListener("K_GPC", K_GPC, "CUBE");
|
||
|
// MessageDispatcher.RemoveListener("LeftShift_U_GPC", LeftShift_U_GPC, "CUBE");
|
||
|
// MessageDispatcher.RemoveListener("LeftShift_J_GPC", LeftShift_J_GPC, "CUBE");
|
||
|
// MessageDispatcher.RemoveListener("Equals_GPC", Equals_GPC, "CUBE");
|
||
|
// MessageDispatcher.RemoveListener("Minus_GPC", Minus_GPC, "CUBE");
|
||
|
// MessageDispatcher.RemoveListener("BackZhiJia", BackZhiJia);
|
||
|
//}
|
||
|
//void OnDisable()
|
||
|
//{
|
||
|
// MessageDispatcher.RemoveListener("LeftShift_W_GPC", LeftShift_W_GPC, "CUBE");
|
||
|
// MessageDispatcher.RemoveListener("LeftShift_S_GPC", LeftShift_S_GPC, "CUBE");
|
||
|
// MessageDispatcher.RemoveListener("W_GPC", W_GPC, "CUBE");
|
||
|
// MessageDispatcher.RemoveListener("S_GPC", S_GPC, "CUBE");
|
||
|
// MessageDispatcher.RemoveListener("A_GPC", A_GPC, "CUBE");
|
||
|
// MessageDispatcher.RemoveListener("D_GPC", D_GPC, "CUBE");
|
||
|
// MessageDispatcher.RemoveListener("U_GPC", U_GPC, "CUBE");
|
||
|
// MessageDispatcher.RemoveListener("J_GPC", J_GPC, "CUBE");
|
||
|
// MessageDispatcher.RemoveListener("H_GPC", H_GPC, "CUBE");
|
||
|
// MessageDispatcher.RemoveListener("K_GPC", K_GPC, "CUBE");
|
||
|
// MessageDispatcher.RemoveListener("LeftShift_U_GPC", LeftShift_U_GPC, "CUBE");
|
||
|
// MessageDispatcher.RemoveListener("LeftShift_J_GPC", LeftShift_J_GPC, "CUBE");
|
||
|
// MessageDispatcher.RemoveListener("Equals_GPC", Equals_GPC, "CUBE");
|
||
|
// MessageDispatcher.RemoveListener("Minus_GPC", Minus_GPC, "CUBE");
|
||
|
// MessageDispatcher.RemoveListener("BackZhiJia", BackZhiJia);
|
||
|
//}
|
||
|
//void OnEnable()
|
||
|
//{
|
||
|
// MessageDispatcher.AddListener("LeftShift_W_GPC", LeftShift_W_GPC, "CUBE");
|
||
|
// MessageDispatcher.AddListener("LeftShift_S_GPC", LeftShift_S_GPC, "CUBE");
|
||
|
// MessageDispatcher.AddListener("W_GPC", W_GPC, "CUBE");
|
||
|
// MessageDispatcher.AddListener("S_GPC", S_GPC, "CUBE");
|
||
|
// MessageDispatcher.AddListener("A_GPC", A_GPC, "CUBE");
|
||
|
// MessageDispatcher.AddListener("D_GPC", D_GPC, "CUBE");
|
||
|
// MessageDispatcher.AddListener("U_GPC", U_GPC, "CUBE");
|
||
|
// MessageDispatcher.AddListener("J_GPC", J_GPC, "CUBE");
|
||
|
// MessageDispatcher.AddListener("H_GPC", H_GPC, "CUBE");
|
||
|
// MessageDispatcher.AddListener("K_GPC", K_GPC, "CUBE");
|
||
|
// MessageDispatcher.AddListener("LeftShift_U_GPC", LeftShift_U_GPC, "CUBE");
|
||
|
// MessageDispatcher.AddListener("LeftShift_J_GPC", LeftShift_J_GPC, "CUBE");
|
||
|
// MessageDispatcher.AddListener("Equals_GPC", Equals_GPC, "CUBE");
|
||
|
// MessageDispatcher.AddListener("Minus_GPC", Minus_GPC, "CUBE");
|
||
|
// MessageDispatcher.AddListener("BackZhiJia", BackZhiJia);
|
||
|
//}
|
||
|
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.Heigh) <= part * 2)
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
float TheHeigh = MaxRise + part3.transform.localPosition.z + part4.transform.localPosition.z + part5.transform.localPosition.z + part6.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 > 15.8f)
|
||
|
{
|
||
|
firstFull = true;
|
||
|
Vector3 newVector = part3.transform.localPosition;
|
||
|
newVector.z = 15.8f;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
firstZero = false;
|
||
|
part3.transform.localPosition = new Vector3(-0.025f, 0.174f, z + Time.deltaTime * zSpeedId.value * SpeedBase / aspect);
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (float.Parse(CarMess.Heigh) - MaxRise >= part)
|
||
|
{
|
||
|
if (z >= 0 && z < 15.8f)
|
||
|
{
|
||
|
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 > 15.8f)
|
||
|
{
|
||
|
secondFull = true;
|
||
|
Vector3 newVector = part4.transform.localPosition;
|
||
|
newVector.z = 15.8f;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
secondZero = false;
|
||
|
part4.transform.localPosition = new Vector3(0.025f, 0.197f, z + Time.deltaTime * zSpeedId.value * SpeedBase / aspect);
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (float.Parse(CarMess.Heigh) - MaxRise >= part)
|
||
|
{
|
||
|
if (z >= 0 && z < 15.8f)
|
||
|
{
|
||
|
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 > 15.8f)
|
||
|
{
|
||
|
thirdFull = true;
|
||
|
Vector3 newVector = part5.transform.localPosition;
|
||
|
newVector.z = 15.8f;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
thirdZero = false;
|
||
|
part5.transform.localPosition = new Vector3(0.025f, 0.197f, z + Time.deltaTime * zSpeedId.value * SpeedBase / aspect);
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (float.Parse(CarMess.Heigh) - MaxRise >= part)
|
||
|
{
|
||
|
if (z >= 0 && z < 15.8f)
|
||
|
{
|
||
|
thirdZero = false;
|
||
|
part5.transform.localPosition = new Vector3(0.025f, 0.197f, z + Time.deltaTime * zSpeedId.value * SpeedBase / aspect);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
thirdFull = false;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
else if (thirdFull && !fourthFull)
|
||
|
{
|
||
|
float z = part6.transform.localPosition.z;
|
||
|
|
||
|
if (float.Parse(CarMess.Heigh) - MaxRise >= part)
|
||
|
{
|
||
|
if (z > 15.8f)
|
||
|
{
|
||
|
fourthFull = true;
|
||
|
Vector3 newVector = part6.transform.localPosition;
|
||
|
newVector.z = 15.8f;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
fourthZero = false;
|
||
|
part6.transform.localPosition = new Vector3(0.025f, 0.197f, z + Time.deltaTime * zSpeedId.value * SpeedBase / aspect);
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
|
||
|
if (float.Parse(CarMess.Heigh) - MaxRise >= part)
|
||
|
{
|
||
|
if (z >= 0 && z < 15.8f)
|
||
|
{
|
||
|
fourthZero = false;
|
||
|
part6.transform.localPosition = new Vector3(0.025f, 0.197f, z + Time.deltaTime * zSpeedId.value * SpeedBase / aspect);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
fourthFull = false;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}//LeftShift_W控制车臂的伸长
|
||
|
public override void LeftShift_S(IMessage message)
|
||
|
{
|
||
|
if ((string)message.Data == this.gameObject.name)
|
||
|
{
|
||
|
if (gameObject.GetComponent<LineamentEvent>().ControlJuBi && CarControlToggle.activeInHierarchy)
|
||
|
{
|
||
|
if (!fourthZero)
|
||
|
{
|
||
|
float z = part6.transform.localPosition.z;
|
||
|
if (z <=0)
|
||
|
{
|
||
|
fourthZero = true;
|
||
|
Vector3 newVector = part6.transform.localPosition;
|
||
|
newVector.z = 0;
|
||
|
part6.transform.localPosition = newVector;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
fourthFull = false;
|
||
|
part6.transform.localPosition = new Vector3(0.025f, 0.197f, z - Time.deltaTime * zSpeedId.value * SpeedBase / aspect);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
if (fourthZero && !thirdZero)
|
||
|
{
|
||
|
float z = part5.transform.localPosition.z;
|
||
|
if (z <=0)
|
||
|
{
|
||
|
thirdZero = true;
|
||
|
Vector3 newVector = part5.transform.localPosition;
|
||
|
newVector.z = 0;
|
||
|
part5.transform.localPosition = newVector;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
thirdFull = false;
|
||
|
part5.transform.localPosition = new Vector3(0.025f, 0.197f, z - Time.deltaTime * zSpeedId.value * SpeedBase / aspect);
|
||
|
}
|
||
|
|
||
|
}
|
||
|
else if (thirdZero && !secondZero)
|
||
|
{
|
||
|
float z = part4.transform.localPosition.z;
|
||
|
if (z <=0)
|
||
|
{
|
||
|
secondZero = true;
|
||
|
Vector3 newVector = part4.transform.localPosition;
|
||
|
newVector.z = 0;
|
||
|
part4.transform.localPosition = newVector;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
secondFull = false;
|
||
|
part4.transform.localPosition = new Vector3(0.025f, 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.025f, 0.174f, z - Time.deltaTime * zSpeedId.value * SpeedBase / aspect);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}//LeftShift_S控制车臂的收缩
|
||
|
public override void W(IMessage message)
|
||
|
{
|
||
|
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)
|
||
|
{
|
||
|
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)
|
||
|
{
|
||
|
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)
|
||
|
{
|
||
|
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 LeftShift_U(IMessage message)//LeftShift_U控制喷水臂的收回
|
||
|
{
|
||
|
if ((string)message.Data == this.gameObject.name)
|
||
|
{
|
||
|
if (gameObject.GetComponent<LineamentEvent>().ControlJuBi && CarControlToggle.activeInHierarchy)
|
||
|
{
|
||
|
part7.transform.Rotate(-Time.deltaTime * zSpeedId.value * SpeedBase, 0, 0);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
public override void LeftShift_J(IMessage message)//LeftShift_U控制喷水臂的抬起
|
||
|
{
|
||
|
if ((string)message.Data == this.gameObject.name)
|
||
|
{
|
||
|
if (gameObject.GetComponent<LineamentEvent>().ControlJuBi && CarControlToggle.activeInHierarchy)
|
||
|
{
|
||
|
part7.transform.Rotate(Time.deltaTime * zSpeedId.value * SpeedBase, 0, 0);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
public override void U(IMessage message)
|
||
|
{
|
||
|
if ((string)message.Data == this.gameObject.name)
|
||
|
{
|
||
|
if (gameObject.GetComponent<LineamentEvent>().ControlShuiPao)
|
||
|
{
|
||
|
part8.transform.Rotate(-Time.deltaTime * zSpeedId.value * SpeedBase, 0, 0);
|
||
|
}
|
||
|
}
|
||
|
}//U控制喷水头的抬起
|
||
|
public override void J(IMessage message)
|
||
|
{
|
||
|
if ((string)message.Data == this.gameObject.name)
|
||
|
{
|
||
|
if (gameObject.GetComponent<LineamentEvent>().ControlShuiPao)
|
||
|
{
|
||
|
part8.transform.Rotate(Time.deltaTime * zSpeedId.value * SpeedBase, 0, 0);
|
||
|
}
|
||
|
}
|
||
|
}//J控制喷水头的放下
|
||
|
public override void H(IMessage message)
|
||
|
{
|
||
|
if ((string)message.Data == this.gameObject.name)
|
||
|
{
|
||
|
if (gameObject.GetComponent<LineamentEvent>().ControlShuiPao)
|
||
|
{
|
||
|
part8.transform.Rotate(0, Time.deltaTime * zSpeedId.value * SpeedBase, 0);
|
||
|
}
|
||
|
}
|
||
|
}//H控制喷水头的左旋转
|
||
|
public override void K(IMessage message)
|
||
|
{
|
||
|
if ((string)message.Data == this.gameObject.name)
|
||
|
{
|
||
|
if (gameObject.GetComponent<LineamentEvent>().ControlShuiPao)
|
||
|
{
|
||
|
part8.transform.Rotate(0, -Time.deltaTime * zSpeedId.value * SpeedBase, 0);
|
||
|
}
|
||
|
}
|
||
|
}//K控制喷水头的右旋转
|
||
|
public override void Equals(IMessage message)//控制水流增加
|
||
|
{
|
||
|
if ((string)message.Data == this.gameObject.name)
|
||
|
{
|
||
|
if (gameObject.GetComponent<LineamentEvent>().ControlShuiPao)
|
||
|
{
|
||
|
if (part8.transform.Find("Hose").childCount > 0)
|
||
|
{
|
||
|
ParticleSystemControl scale = part8.transform.Find("Hose").GetChild(0).GetComponent<ParticleSystemControl>();
|
||
|
scale.waterStraightScale += Time.deltaTime * 0.5f;
|
||
|
}
|
||
|
|
||
|
//scale.waterFogScale += Time.deltaTime * 0.5f;
|
||
|
//scale.UpdateScale();
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
public override void Minus(IMessage message)//控制水流减少
|
||
|
{
|
||
|
if ((string)message.Data == this.gameObject.name)
|
||
|
{
|
||
|
if (gameObject.GetComponent<LineamentEvent>().ControlShuiPao)
|
||
|
{
|
||
|
if (part8.transform.Find("Hose").childCount > 0)
|
||
|
{
|
||
|
ParticleSystemControl scale = part8.transform.Find("Hose").GetChild(0).GetComponent<ParticleSystemControl>();
|
||
|
scale.waterStraightScale -= Time.deltaTime * 0.5f;
|
||
|
}
|
||
|
|
||
|
//scale.waterFogScale -= Time.deltaTime * 0.5f;
|
||
|
//scale.UpdateScale();
|
||
|
//particlesystemcon
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
void Start()
|
||
|
{
|
||
|
}
|
||
|
public float GetRiseNum;
|
||
|
//public int RiseNum;
|
||
|
float part;
|
||
|
public float MaxRise = 32;
|
||
|
public void GetRiseMi(int i)
|
||
|
{
|
||
|
//RiseNum = i;
|
||
|
//part = (int)(100 / 6);
|
||
|
}//从面部接受最大升高米数
|
||
|
public bool firstZero = true;
|
||
|
public bool firstFull = false;
|
||
|
public bool secondZero = true;
|
||
|
public bool secondFull = false;
|
||
|
public bool thirdZero = true;
|
||
|
public bool thirdFull = false;
|
||
|
public bool fourthZero = true;
|
||
|
public bool fourthFull = false;
|
||
|
|
||
|
bool TheOneFull = true;
|
||
|
bool TheOneZero = false;
|
||
|
bool TheTwoFull = true;
|
||
|
bool TheTwoZero = false;
|
||
|
bool TheThreeFull = true;
|
||
|
bool TheThreeZero = false;
|
||
|
bool TheFourFull = true;
|
||
|
bool TheFourZero = false;
|
||
|
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(fourthZero);
|
||
|
boolList.Add(fourthFull);
|
||
|
return boolList;
|
||
|
}
|
||
|
public void NewSetBool()
|
||
|
{
|
||
|
MaxRise = 32;
|
||
|
|
||
|
firstZero = true;
|
||
|
firstFull = false;
|
||
|
secondZero = true;
|
||
|
secondFull = false;
|
||
|
thirdZero = true;
|
||
|
thirdFull = false;
|
||
|
fourthZero = true;
|
||
|
fourthFull = false;
|
||
|
|
||
|
TheOneFull = true;
|
||
|
TheOneZero = false;
|
||
|
TheTwoFull = true;
|
||
|
TheTwoZero = false;
|
||
|
TheThreeFull = true;
|
||
|
TheThreeZero = false;
|
||
|
TheFourFull = true;
|
||
|
TheFourZero = false;
|
||
|
}
|
||
|
|
||
|
float TIMESTAMP = 1.0f;
|
||
|
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_z;
|
||
|
float Part6currentFrame_z;
|
||
|
float Part7lastFrame_x;
|
||
|
float Part7currentFrame_x;
|
||
|
void Update()
|
||
|
{
|
||
|
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_z = part6.transform.localPosition.z;
|
||
|
Part7currentFrame_x = part7.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_z - Part6lastFrame_z) > THRESHOLD ||
|
||
|
Mathf.Abs(Part7currentFrame_x - Part7lastFrame_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_z = Part6currentFrame_z;
|
||
|
Part7lastFrame_x = Part7currentFrame_x;
|
||
|
timer = TIMESTAMP;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|