void Awake() { nChildrenInNode = 0; m_rectTransform = GetComponent <RectTransform>(); m_rotationVec = Vector3.zero; switch (m_NodeEnum) { case Node.LeftNode: Node_Manager.nodeLeft = this; m_NodePCStatusEnum = pcStatus.InLeftNode; m_defendAvoidButtonImage = GameObject.Find("UI_Player_LeftNode_DefendAvoid").GetComponent <Image>(); break; case Node.RightNode: Node_Manager.nodeRight = this; m_NodePCStatusEnum = pcStatus.InRightNode; m_defendAvoidButtonImage = GameObject.Find("UI_Player_RightNode_DefendAvoid").GetComponent <Image>(); break; default: Debug.Log("Error: No such node index"); break; } }
// Todo: remove the need for this function // Currently used to solve bug when spawning too fast on a mobile with both buttons. public void CalculateChildCount() { int childCountInNode = 0; pcStatus node = (pcStatus)((int)m_NodeEnum + 1); for (int i = 0; i < Constants.s_nPlayerMaxChildCount; i++) { if (PlayerChildFSM.s_playerChildStatus[i] == node) { childCountInNode++; } } nChildrenInNode = childCountInNode; }
private static int[] ChildrenPoolIdInStatus(pcStatus _selectedStatus) { int[] children = new int[Constants.s_nPlayerMaxChildCount + 1]; int count = 0; for (int i = 0; i < Constants.s_nPlayerMaxChildCount; i++) { if (s_playerChildStatus[i] == _selectedStatus) { children[count] = i; count++; } } children[count] = -1; return(children); }
private void sendStatus(pcStatus status, string idleTime = "") { if (!status.Equals(currentStatus)) { try { string message = status.ToString(); if (!String.IsNullOrEmpty(idleTime)) { message += " " + idleTime; } mqttSendMessage(mainTopic + "/status", message); currentStatus = status; } catch (Exception e) { Log(e.Message); } } }
void Awake() { nChildrenInNode = 0; m_rectTransform = GetComponent<RectTransform>(); m_rotationVec = Vector3.zero; switch (m_NodeEnum) { case Node.LeftNode: Node_Manager.nodeLeft = this; m_NodePCStatusEnum = pcStatus.InLeftNode; m_defendAvoidButtonImage = GameObject.Find("UI_Player_LeftNode_DefendAvoid").GetComponent<Image>(); break; case Node.RightNode: Node_Manager.nodeRight = this; m_NodePCStatusEnum = pcStatus.InRightNode; m_defendAvoidButtonImage = GameObject.Find("UI_Player_RightNode_DefendAvoid").GetComponent<Image>(); break; default: Debug.Log("Error: No such node index"); break; } }
private static int[] ChildrenPoolIdInStatus(pcStatus _selectedStatus) { int[] children = new int[Constants.s_nPlayerMaxChildCount + 1]; int count = 0; for (int i = 0; i < Constants.s_nPlayerMaxChildCount; i++) { if (s_playerChildStatus[i] == _selectedStatus) { children[count] = i; count++; } } children[count] = -1; return children; }