// Use this for initialization void Awake() { RConsole.OnInitConsole(""); Application.targetFrameRate = 1000; MessagerCenter.Register("InitConfig", InitConfig); MessagerCenter <bool> .Register("SetDebug", SetDebug); // MessagerCenter<bool>.Register("QCToolsOn", QCToolsOn); // MessagerCenter<bool>.Register("TruckToolsOn", QCTruckToolsOn); MessagerCenter <string> .Register("ec", ec); MessagerCenter.Broadcast("InitConfig"); //Debug.Log("初始化开始 in " + this.name); //Debug.Log("初始化开始 in " + this); }
public override void Update() { // 碰撞检测 ishit = Physics.Raycast(DCxWeldingGunControl.Instance.GunNozzlePosition, DCxWeldingGunControl.Instance.GunNozzleDirection, out _hitInfo, maxRayLength, 1 << 12); // 碰撞检测 lengthishit = Physics.Raycast(DCxWeldingGunControl.Instance.GunNozzlePosition, DCxWeldingGunControl.Instance.GunNozzleDirection, out _lengthhitInfo, maxRayLength * 3, 1 << 12); if (isAuto) { if (ishit) { //if (Input.GetKeyDown(KeyCode.Space)) //{ // isPress = true; //} //else if (Input.GetKeyUp(KeyCode.Space)) //{ // isPress = false; //} } else { isPress = false; } } else { //// 按键检测 //isPress = Input.GetKey(KeyCode.Space); } if (IsWelding) { MessagerCenter <bool, Vector2> .Broadcast("UpdateHitInfo", true, hitInfo.textureCoord); //EFxEffectManager.Instance.StartAllEffect(); //RSxReplaySystem.Instance.AddRecord("z", "z"); } else { MessagerCenter <bool, Vector2> .Broadcast("UpdateHitInfo", false, Vector2.zero); //EFxEffectManager.Instance.StopAllEffect(); } // 焊枪嘴颜色改变 if (ishit) { float pv = Vector3.Distance(DCxWeldingGunControl.Instance.GunNozzlePosition, DCxWeldingControl.Instance.hitInfo.point); gunNozzleCube.GetComponent <Renderer>().material.color = Color.green; //gunNozzleCube.transform.localPosition = new Vector3(0, 0, pv - 0.04f); } else { gunNozzleCube.GetComponent <Renderer>().material.color = Color.red; //gunNozzleCube.transform.localPosition = new Vector3(0, 0, maxRayLength - 0.04f); } }