void Update_ReadyState() { GetMouse GM = gameObject.GetComponent <GetMouse>(); if (GM.IsPressedMouseButton == false) { vecPos = GM.GetTargetPos; vecPos.y = transform.position.y; if (!Mathf.Approximately(vecPos.x, 0) || !Mathf.Approximately(vecPos.z, 0)) { vecPos.x = vecPos.x - (vecPos.x % 5); vecPos.z = vecPos.z - (vecPos.z % 5); if (Mathf.Approximately(vecPos.x % 10, 0)) { vecPos.x += 5; } if (Mathf.Approximately(vecPos.z % 10, 0)) { vecPos.z += 5; } transform.position = vecPos; } } if (GM.IsPressedMouseButton == true) { UnitAttribute myAttribute = gameObject.GetComponent <UnitAttribute>(); myAttribute.HP = myAttribute.HpMAX; SetState(State.MOVE); AlphaChange(1f); //gameObject.GetComponent<Collider>().enabled = true; gameObject.GetComponent <GetMouse>().enabled = false; } }
void Start() { Health = maxHealth; anime = GetComponent <Animator>(); gameObject.GetComponent <Collider>().enabled = false; Mat = new Material[3]; col = new Color[3]; GM = gameObject.AddComponent <GetMouse>(); now = Now.Ready; Renderer[] Rd = GetComponentsInChildren <Renderer>(); for (int i = 0; i < Rd.Length; i++) { Mat[i] = Rd[i].material; col[i] = Mat[i].color; } RDL = Rd.Length; AlphaChange(0.4f); }