private static eCode[] _GetCodes(string code) { eCode[] codes = new eCode[code.Length]; for (int i = 0; i < code.Length; i++) { codes[i] = (eCode)Enum.Parse(typeof(eCode), code[i].ToString()); } return(codes); }
/*------------------------------------------------------------------------ * Create random codes lenth between m_CodeLenghtMin amd m_CodeLenghtMax * * ------------------------------------------------------------------------*/ private eCode[] GenerateCode() { m_CodeLenght = UnityEngine.Random.Range(m_Data.CodeLenghtMin, m_Data.CodeLenghtMax); eCode[] codes = new eCode[m_CodeLenght]; for (int i = 0; i < m_CodeLenght; i++) { int codeChar = UnityEngine.Random.Range(1, 4); eCode ecode = (eCode)Enum.Parse(typeof(eCode), codeChar.ToString()); codes[i] = ecode; } return(codes); }
private Image CreateArrow(eCode code) { Image codeImg = Instantiate(m_imgArrow, m_arrowRoot); switch (code) { case eCode.Up: codeImg.transform.rotation = Quaternion.Euler(0, 0, 90); break; case eCode.Down: codeImg.transform.rotation = Quaternion.Euler(0, 0, -90); break; case eCode.Left: codeImg.transform.rotation = Quaternion.Euler(0, 0, 180); break; case eCode.Right: codeImg.transform.rotation = Quaternion.Euler(0, 0, 0); break; } return(codeImg); }