using System.Collections; using System.Collections.Generic; using AX.InputSystem; using AX.MessageSystem; using UnityEngine; public class FiremanControlSprayHead : ControlSprayHead { private Animator anim; internal override void InitGameObject() { base.InitGameObject(); part2 = transform; anim = GetComponent(); } internal override void H(IMessage message) { var gameObjID = (long)message.Sender; if (gameObjID == GameObjID) { if (RecordEvent.IsRecord()) CreateRotationEvent(part2); var speed = ((WeightCmdArgs)message.Data).Weight; float x =part2.localEulerAngles.x; float y =part2.localEulerAngles.y; float z =part2.localEulerAngles.z; y -= speed; part2.localEulerAngles = new Vector3(x, y, z); } } internal override void K(IMessage message) { var gameObjID = (long)message.Sender; if (gameObjID == GameObjID) { if (RecordEvent.IsRecord()) CreateRotationEvent(part2); var speed = ((WeightCmdArgs)message.Data).Weight; float x = transform.localEulerAngles.x; float y = transform.localEulerAngles.y; float z = transform.localEulerAngles.z; y += speed; transform.localEulerAngles = new Vector3(x, y, z); } } internal override void U(IMessage message) { var gameObjID = (long)message.Sender; if (gameObjID == GameObjID) { if (RecordEvent.IsRecord()) CreateRotationEvent(part1); var speed = ((WeightCmdArgs)message.Data).Weight*2; float x = part1.localEulerAngles.x; float y = part1.localEulerAngles.y; x = CheckValue(x); x += speed; x = Mathf.Clamp(x, -20, 55); part1.localEulerAngles = new Vector3(x, y, 0); } } internal override void J(IMessage message) { var gameObjID = (long)message.Sender; if (gameObjID == GameObjID) { if (RecordEvent.IsRecord()) CreateRotationEvent(part1); var speed = ((WeightCmdArgs)message.Data).Weight*2; float x = part1.localEulerAngles.x; float y = part1.localEulerAngles.y; x = CheckValue(x); x -= speed; x = Mathf.Clamp(x, -20, 55); part1.localEulerAngles = new Vector3(x, y, 0); } } internal override void SetAnimAndHose(bool value) { part1.gameObject.SetActive(value); anim.SetBool("isInSitu",value); } }