// Use this for initialization void Start () { MasterSkripta = FindObjectOfType<GMS>(); this.GetComponent<Button>().onClick.AddListener(() => OnClick()); }
public float getDistanceOffset() { List <GameObject> gameObjectList = new List <GameObject>(); gameObjectList.Add(gameObject); for (int i = 0; i < gameObject.transform.childCount; i++) { gameObjectList.Add(gameObject.transform.GetChild(i).gameObject); gameObjectList.AddRange(GMS.getChildrenOfThisGameObject(gameObject.transform.GetChild(i).gameObject)); } List <Collider> colliderFilterList = new List <Collider>(); for (int i = 0; i < gameObjectList.Count; i++) { if (gameObjectList[i].GetComponent <Collider>()) { colliderFilterList.Add(gameObjectList[i].GetComponent <Collider>()); } } float distanceOffset = 0f; GameObject gameObjectParent = getEquipment().getOwner().gameObject; for (int i = 0; i < colliderFilterList.Count; i++) { distanceOffset = Mathf.Max(distanceOffset, Vector3.Distance(gameObjectParent.transform.position, colliderFilterList[i].bounds.center) + colliderFilterList[i].bounds.extents.magnitude); } return(distanceOffset); }
protected void calculateVolume() { if (isVolumeCalculated == false) { List <MeshFilter> meshFilterList = new List <MeshFilter>(); List <GameObject> gameObjectList = new List <GameObject>(); gameObjectList.Add(gameObject); for (int i = 0; i < gameObject.transform.childCount; i++) { gameObjectList.Add(gameObject.transform.GetChild(i).gameObject); gameObjectList.AddRange(GMS.getChildrenOfThisGameObject(gameObject.transform.GetChild(i).gameObject)); } for (int i = 0; i < gameObjectList.Count; i++) { if (gameObjectList[i].GetComponent <MeshFilter>()) { meshFilterList.Add(gameObjectList[i].GetComponent <MeshFilter>()); } } Vector3 dimensions = Vector3.zero; double volumeSum = 0f; for (int i = 0; i < meshFilterList.Count; i++) { dimensions = meshFilterList[i].gameObject.transform.lossyScale * Mathf.Pow(GMS.VolumeOfMesh(meshFilterList[i].mesh), 1f / 3f); volumeSum += (double)(dimensions.x) * (double)(dimensions.y) * (double)(dimensions.z); } volume = volumeSum; isVolumeCalculated = true; } }
public static GMS instance() { if (_instance == null) { _instance = new GMS(); } return(_instance); }
protected void setEquipment() { if (equipment == null) { equipment = GMS.instance().getEquipment(equipmentId); equipment.setShipPart(this); equipment.setTarget(null); equipment.setOwner(gameObject.transform.parent.transform.parent.gameObject.GetComponent <ObjectInSpace>()); } }
public virtual Protocol createLayer(ProtocolStack prot_stack) { if (protocol_name == null) { return(null); } Protocol protocol = null; switch (protocol_name) { case "TCP": protocol = new TCP(); break; case "TCPPING": protocol = new TCPPING(); break; case "QUEUE": protocol = new QUEUE(); break; case "TOTAL": protocol = new TOTAL(); break; case "VIEW_ENFORCER": protocol = new VIEW_ENFORCER(); break; case "pbcast.GMS": protocol = new GMS(); break; } if (protocol != null) { prot_stack.NCacheLog.Info("Configurator.createLayer()", "Created Layer " + protocol.GetType().FullName); protocol.Stack = prot_stack; if (properties != null) { if (!protocol.setPropertiesInternal(properties)) { return(null); } } protocol.init(); } else { prot_stack.NCacheLog.Error("Configurator.createLayer()", "Couldn't create layer: " + protocol_name); } return(protocol); }
void Start() { cameraRigidbody = GetComponent<Rigidbody>(); cameraVar = GetComponent<Camera>(); ScreenWidth = Screen.width; ScreenHeight = Screen.height; MasterSkripta = FindObjectOfType<GMS>(); }
protected void imgBtnSend_Click(object sender, ImageClickEventArgs e) { //如果没有手机号码接收信息,则程序不继续执行。 if (txtAccepter.Text == "") { Response.Write(bc.MessageBox("手机号码不能为空!")); return; } //获取短信猫的基本信息 string strCOM = GMS.GSMModemGetDevice(); //COM1 string strBTL = GMS.GSMModemGetBaudrate(); //波特率 string strMobileNo = GMS.GSMModemGetSnInfoNew(strCOM, strBTL); //机器号码 string strWarranty = "YIWU-IJDD-CDQW-JDWG"; //设备授权号(设备上自带) string[] Accepters = txtAccepter.Text.Split(','); //连接设备 if (GMS.GSMModemInitNew(strCOM, strBTL, null, null, false, strWarranty) == false) { Response.Write(bc.MessageBox("设备连接失败!" + GMS.GSMModemGetErrorMsg())); return; } // 发送短信 if (Accepters.Length > 1) { for (int j = 0; j < Accepters.Length; j++) { if (GMS.GSMModemSMSsend(null, 8, txtInfo.Text, Encoding.Default.GetByteCount(txtInfo.Text), Accepters[j].ToString(), false) == true) { Response.Write(bc.MessageBox("短信发送成功!")); } else { Response.Write(bc.MessageBox("短信发送失败!")); } } } else { if (GMS.GSMModemSMSsend(null, 8, txtInfo.Text, Encoding.Default.GetByteCount(txtInfo.Text), txtAccepter.Text, false) == true) { Response.Write(bc.MessageBox("短信发送成功!")); } else { Response.Write(bc.MessageBox("短信发送失败!")); } } }
void Start() { agent = GetComponent<NavMeshAgent>(); rend = GetComponent<Renderer>(); cam = Camera.main; GUIskripta = FindObjectOfType<UnitGuiScript>(); SkriptaCam = FindObjectOfType<RTSCameraScript>(); MasterSkripta = FindObjectOfType<GMS>(); //Debug.Log(GetInstanceID() + " " + gameObject.GetInstanceID()); }
public void fixedUpdate_RandomMovement() { if (AIMovement.distanceFormStartPoint > 0) { if (Vector3.Distance(owner.gameObject.transform.position, moveToPosition) <= 2f) { moveToPosition = startPosition + GMS.randomVector() * AIMovement.distanceFormStartPoint; owner.increaseEngineIntensity(-1f); owner.increaseEngineIntensity(0.2f); turnOnEngines(); } owner.alignTowardsFixedUpdate(moveToPosition); } }
public static float getShipPartVolume(ShipPart shipPart) { List <GameObject> gameObjectList = new List <GameObject>(); gameObjectList.Add(shipPart.gameObject); for (int i = 0; i < shipPart.gameObject.transform.childCount; i++) { gameObjectList.Add(shipPart.gameObject.transform.GetChild(i).gameObject); gameObjectList.AddRange(getChildrenOfThisGameObject(shipPart.gameObject.transform.GetChild(i).gameObject)); } GMS.fileWriteLn("MeshSizes", gameObjectList.Count + ""); GMS.fileWriteLn("MeshSizes", "Master: " + shipPart.gameObject.name); float volumeOfMesh = 0; float volumeOfCollider = 0; float volumeOfColliderSum = 0; Vector3 dimensions = Vector3.zero; for (int i = 0; i < gameObjectList.Count; i++) { volumeOfMesh = 0; volumeOfCollider = 0; dimensions = Vector3.zero; if (gameObjectList[i].GetComponent <MeshFilter>()) { volumeOfMesh = GMS.VolumeOfMesh(gameObjectList[i].GetComponent <MeshFilter>().mesh); dimensions = gameObjectList[i].transform.lossyScale * Mathf.Pow(volumeOfMesh, 1f / 3f); } GMS.fileWrite("MeshSizes", "name: " + gameObjectList[i].name + "; "); GMS.fileWrite("MeshSizes", "parents: " + GMS.getParentsOfThisGameObjectStr(gameObjectList[i]) + "; "); GMS.fileWrite("MeshSizes", "volumeOfMesh = " + volumeOfMesh + "u; "); GMS.fileWrite("MeshSizes", "dimensions = " + dimensions + "u; "); GMS.fileWrite("MeshSizes", "dimensionsMeters = " + ObjectInSpace.unitsToMeters(dimensions) + "m; "); GMS.fileWrite("MeshSizes", "dimensionsMetersVolume = " + (ObjectInSpace.unitsToMeters(dimensions).x *ObjectInSpace.unitsToMeters(dimensions).y *ObjectInSpace.unitsToMeters(dimensions).z) + "m^3; "); GMS.fileWrite("MeshSizes", "volumeOfCollider = " + volumeOfCollider + "u; "); GMS.fileWriteLn("MeshSizes", " "); } volumeOfColliderSum = Mathf.Round(volumeOfColliderSum); GMS.fileWrite("MeshSizes", "Master: " + shipPart.gameObject.name + ", "); GMS.fileWrite("MeshSizes", "volumeOfColliderSum = " + volumeOfColliderSum + "u; "); GMS.fileWrite("MeshSizes", "volumeOfColliderSum = " + ObjectInSpace.unitsToMetersCubic(volumeOfColliderSum) + "m^3; "); GMS.fileWriteLn("MeshSizes", " "); return(0f); }
public static Quaternion GetCameraRotation(Leap.Hand hand, Vector3 ReferAxis) { // 使用食指的掌故的方向作为 移动方向 Vector3 MoveDirection = new Vector3(); MoveDirection = GMS.toVec3(hand.Fingers[1].bones[0].Direction); // 投影到XZ平面 MoveDirection.y = 0; ReferAxis.y = 0; // 计算夹角 Quaternion q = new Quaternion(); q.SetFromToRotation(ReferAxis, MoveDirection); return(q); }
void Awake() { if (instance == null)//This will ensure that there is only a single instance of this class in the game at all times. { instance = this; DontDestroyOnLoad(this.gameObject); } else { if (instance != this) { Destroy(this.gameObject); } } DontDestroyOnLoad(gameObject); //This object will persist through scenes }
public ActionResult Edit(GMS.Core.Config.SettingConfig site) { try { var adminMenuConfig = CachedConfigContext.Current.SettingConfig; adminMenuConfig.WebSiteDescription = site.WebSiteDescription ?? ""; adminMenuConfig.WebSiteKeywords = site.WebSiteKeywords ?? ""; adminMenuConfig.WebSiteTitle = site.WebSiteTitle ?? ""; CachedConfigContext.Current.Save(adminMenuConfig); return RedirectToAction("index"); } catch (Exception err) { return View("Error"); } }
public ClientGmsImpl(GMS g) { gms = g; }
public static bool fileWriteLn(string fileName, string text) { return(GMS.fileWrite(fileName, text, true)); }
public ParticipantGmsImpl(GMS g) { gms = g; suspected_mbrs.Clear(); }
// // GET: /Crm/Project/ public ActionResult Index(GMS.Project.Contract.ProjectRequest request) { var result = this.ProjectService.GetProjectBasedataList(request); return View(result); }