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 OnTriggerEnter(Collider other) { name = this.gameObject.name; GameObject obj = other.gameObject; if (obj.tag == "Shootable" || obj.tag == "floor" || obj.tag == "Enemy" || obj.tag == "Player") { particle.Play(); StartCoroutine(Delay()); sound.PlayEff((int)eEFFSOUND.em_BOMB); if (name == "HitEffect" && obj.tag == "Enemy" && getAtkMgr == true) { atkMgr.HitSucc((int)eATKTYPE.em_OBJTHROW); Debug.Log("send itemHitSucc"); } } }
private void OnEnable() { StartCoroutine(PosDelay()); //0.35초 후 이동 effSound.PlayEff((int)eEFFSOUND.em_WIND); }
private void Update() { if (enemyHp != nowHp) { enemyHp = nowHp; enemyHpBar.changeHpBar(enemyHp); hpText.text = "Enemy Hp: " + enemyHp; if (enemyHp <= 0) { playerAniCon.PlayDeath("Death"); } } if (MoveLimit(enemyPos.x, transform.position.x) || MoveLimit(enemyPos.y, transform.position.y) || MoveLimit(enemyPos.z, transform.position.z)) //움직임 { transform.position = Vector3.Lerp(transform.position, enemyPos, 0.5f); } if (atkAni == true) //공격 { atkAni = false; string atkName = ""; if (atkAniNum == 0) { atkName = "Attack01"; } else if (atkAniNum == 1) { atkName = "Attack02"; } else if (atkAniNum == 2) { atkName = "Critical01"; } else if (atkAniNum == 3) { atkName = "Critical02"; } playerAniCon.PlayAtkDmg(atkName); if (weaponType == (int)eWEAPON.em_BOW) { effSound.PlayEff((int)eEFFSOUND.em_ARROW); } else { if (atkAniNum % 2 == 0) { effSound.PlayEff((int)eEFFSOUND.em_SWING1); } if (atkAniNum % 2 == 1) { effSound.PlayEff((int)eEFFSOUND.em_SWING2); } } StartCoroutine(EndAni(playerAniCon.GetAniLength(atkName))); } else if (MoveLimit(enemyPos.x, transform.position.x) || MoveLimit(enemyPos.z, transform.position.z)) { playerAniCon.PlayAnimation("Move");//움직임 애니메이션(점프일때 적용x) Debug.Log("enemy Move"); } else //가만히 있을 때 애니메이션 { playerAniCon.PlayAnimation("Idle"); } if (enemyRot != transform.rotation) //회전 { transform.rotation = Quaternion.Slerp(transform.rotation, enemyRot, 0.5f); } if (objGet == true)//물건 들기 { objGet = false; getObj = s_itemSpawn2.GetObj(objNum); getObj.GetComponent <Rigidbody>().useGravity = false; Vector3 newPos = transform.position; newPos.y += 5; getObj.transform.position = newPos; } if (objThrow == true)//물건 던지기 { objThrow = false; itemCntrl cntrl = getObj.GetComponent <itemCntrl>(); cntrl.isDestroyOK = true; cntrl.TransferItem(targetPos); } }
void Start() { effSound = transform.parent.GetChild(1).GetComponent <EffSoundController>(); effSound.PlayEff((int)eEFFSOUND.em_WIND); }
private void OnEnable() { StartCoroutine(PosDelay()); //0.35초 후 이동 transform.Rotate(new Vector3(0, -90, 0)); effSound.PlayEff((int)eEFFSOUND.em_WIND); }