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.
88 lines
3.0 KiB
88 lines
3.0 KiB
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<Animator>(); |
|
} |
|
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); |
|
AddRotateEvent(transform.localEulerAngles, RotateType.transform); |
|
} |
|
} |
|
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); |
|
AddRotateEvent(transform.localEulerAngles, RotateType.transform); |
|
} |
|
} |
|
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); |
|
AddRotateEvent(transform.localEulerAngles, RotateType.transform); |
|
} |
|
} |
|
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); |
|
AddRotateEvent(transform.localEulerAngles, RotateType.transform); |
|
} |
|
} |
|
internal override void SetAnimAndHose(bool value) |
|
{ |
|
part1.gameObject.SetActive(value); |
|
anim.SetBool("isInSitu",value); |
|
} |
|
} |