public void SetNormalAtk(float _damage, float _waitingTimeForAtk) { waitingTimeForAtk = _waitingTimeForAtk; objTr = this.transform; GameObject atkMesh = Instantiate <GameObject>(atkMeshObj, this.objTr.position, Quaternion.identity); normalAtkMeshObjCtrl = atkMesh.gameObject.GetComponent <WeaponMeshCtrl>(); if (normalAtkMeshObjCtrl == null) { Debug.LogError("웨폰메쉬컨트롤 Null"); } //아래로는 웨폰 메쉬 크기를 설정하는 코드 objRotY_AtFirst = objTr.transform.rotation.eulerAngles.y; normalAtkMeshObjCtrl.Damage = _damage; float[] tmpAngle = new float[] { this.objTr.rotation.eulerAngles.y - (normalAtkWidth / 2), this.objTr.rotation.eulerAngles.y + (normalAtkWidth / 2) }; //끝에 false는 노멀어택이 추가되면서 웨폰인지 노멀인지를 감별하기 위한 변수 normalAtkMeshObjCtrl.MakeFanShape(tmpAngle, attackRange, false); //Attack 함수 실행때만 잠시 켜지도록 off normalAtkMeshObjCtrl.gameObject.SetActive(false); }
public override void SetForWeapon(Transform _objTr, bool _isSpecialAtking) { this.objTr = _objTr; base.isSpecialAtking = _isSpecialAtking; GameObject weaponMesh = Instantiate <GameObject>(weaponMeshObj, this.objTr.position, Quaternion.identity); weaponMeshObjCtrl = weaponMesh.gameObject.GetComponent <WeaponMeshCtrl>(); if (weaponMeshObjCtrl == null) { Debug.LogError("웨폰메쉬컨트롤 Null"); } if (!base.isSpecialAtking) { SetForNormalAtk(); } else { SetForSpecialAtk(); } //Enemy가 무기의 내구도를 깍을 수 있도록 무기의 충돌체에다가 무기의 정보를 넣는 코드 weaponMeshObjCtrl.WeaponGameObject = this.gameObject.GetComponent <Weapon>(); //atkSpeed과 높을 수록 어택 이후 재공격 시간이 짧아지도록 만듬. //0.8밑으로 내려가면 두 번 공격하는 현상이 생겨서 고정시킴. waitingTimeForAtk = 3.0f - attackSpeed; if (waitingTimeForAtk <= 0.8f) { waitingTimeForAtk = 0.8f; } }
private void Start() { player = GameObject.FindGameObjectWithTag("Player"); specialAtkGageBar = GameObject.FindGameObjectWithTag("SpecialAtkGageBar"); weaponMesh = gameObject.GetComponentInChildren <WeaponMeshCtrl>(); specialAtkGageBarTr = specialAtkGageBar.GetComponent <RectTransform>(); specialAtkGageBarImg = specialAtkGageBar.GetComponent <Image>(); }
private void OnTriggerEnter(Collider other) { if (!isDead) { if (opponentObjAtkTagName == null) { Debug.LogError("WeaponTag Name is null"); } if (other.tag == opponentObjAtkTagName) { float weaponDamage = other.gameObject.GetComponent <NeedWeaponThingsForSystem>().Damage; CharacterStat objStat = this.gameObject.GetComponent <CharacterStat>(); WeaponMeshCtrl meshCtrl = other.GetComponent <WeaponMeshCtrl>(); //Weapon의 메쉬일 경우 if (meshCtrl.IsWeaponMesh) { Weapon weapon = null; if (meshCtrl) { weapon = meshCtrl.WeaponGameObject; } else { weapon = other.GetComponent <ProjectileCtrl>().WeaponGameObject; } Vector3 newPos = tr.position; newPos.y += 1f; // Paticle Instantiate(ParticleMng.GetInstance().EffectBulletImpactWood(), newPos, tr.rotation); Instantiate(ParticleMng.GetInstance().EffectBulletImpactMetal(), newPos, tr.rotation); if (weapon.listSoundName.Capacity > 0) { int rand = Random.Range(0, weapon.listSoundName.Count); AudioMng.GetInstance().PlaySound(weapon.listSoundName[rand], this.transform.position, 120f); } if (!isAttacked && meshCtrl) { isAttacked = true; weapon.SubtractDurability(); } // Combo ComboSystemMng.GetInstance().AddCombo(50f); // Taking Damage objStat.TakeDamage(weaponDamage); } //노멀 어택의 메쉬인 경우 else { NormalAtkCtrl normalAtkCtrl = other.GetComponent <NormalAtkCtrl>(); Vector3 newPos = tr.position; newPos.y += 1f; // Paticle Instantiate(ParticleMng.GetInstance().EffectBulletImpactWood(), newPos, tr.rotation); Instantiate(ParticleMng.GetInstance().EffectBulletImpactMetal(), newPos, tr.rotation); //경훈이가 만들었는데 사운드 부분이여서 일단 자름 //if (normalAtkCtrl.listSoundName.Capacity > 0) //{ // int rand = Random.Range(0, normalAtkCtrl.listSoundName.Count); // AudioMng.GetInstance().PlaySound(normalAtkCtrl.listSoundName[rand], this.transform.position, 120f); //} if (!isAttacked) { isAttacked = true; } // Combo ComboSystemMng.GetInstance().AddCombo(50f); // Taking Damage objStat.TakeDamage(weaponDamage); } } } }