void Attack() // 공격(애니메이션 재생, 서버에 정보 전송) { enemyAtk.AtkPoss(true); idleAni = false; string atkName = ""; if (atkAni == 0) { atkName = "Attack01"; } else if (atkAni == 1) { atkName = "Attack02"; } else if (atkAni == 2) { atkName = "Critical01"; } else if (atkAni == 3) { atkName = "Critical02"; } playerAniCon.PlayAtkDmg(atkName); StartCoroutine(EndAni(playerAniCon.GetAniLength(atkName))); sAtk atk = new sAtk(atkAni); SocketServer.SingleTonServ().SendMsg(atk); if (weaponNum == (int)eWEAPON.em_BOW) { effSound.PlayEff((int)eEFFSOUND.em_ARROW); } else { if (atkAni % 2 == 0) { effSound.PlayEff((int)eEFFSOUND.em_SWING1); } if (atkAni % 2 == 1) { effSound.PlayEff((int)eEFFSOUND.em_SWING2); } } atkAni++; if (atkAni >= 4) { atkAni = 0; } }
private void FixedUpdate() { if (Input.GetMouseButton(2)) //회전 { transform.Rotate(0, Input.GetAxisRaw("Mouse X") * sensibilityX, 0); } if (Input.GetMouseButtonDown(0) && idleAni == true) //공격 { idleAni = false; string atkName = ""; if (atkAni == 0) { atkName = playerAniCon.GetAniName("Attack01"); } else if (atkAni == 1) { atkName = playerAniCon.GetAniName("Attack02"); } else if (atkAni == 2) { atkName = playerAniCon.GetAniName("Critical01"); } else if (atkAni == 3) { atkName = playerAniCon.GetAniName("Critical02"); } animation.Play(atkName); StartCoroutine(EndAni(animation[atkName].length - 0.1f)); sAtk atk = new sAtk((int)eMSG.em_ATK, atkAni); atkAni++; if (atkAni >= 4) { atkAni = 0; } } else if ((Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.D) || Input.GetKey(KeyCode.A))) { //움직임, 움직이는 애니 if (Input.GetKey(KeyCode.W)) { transform.Translate(Vector3.forward * 0.1f); } else if (Input.GetKey(KeyCode.S)) { transform.Translate(Vector3.back * 0.1f); } if (Input.GetKey(KeyCode.D)) { transform.Translate(Vector3.right * 0.1f); } else if (Input.GetKey(KeyCode.A)) { transform.Translate(Vector3.left * 0.1f); } animation.CrossFade(playerAniCon.GetAniName("Move")); } else //가만히 있는 애니 { animation.CrossFade(playerAniCon.GetAniName("Idle")); } if (Input.GetKey(KeyCode.Space) && transform.position.y <= 0.6f) //점프 { playerRigidBody.AddForce(new Vector3(0, 150, 0)); } if (aniEnd == true) { aniEnd = false; if (weaponNum >= 3) { shotMgr.Shooting(); } else { enemyAtk.AtkPoss(); } } }