void OnHitObject(Collider _col, Vector3 _hitPoint) { //Debug.Log (this + "OnHitObject" + hit.collider.gameObject.name); IDamageable _scp = _col.GetComponent <IDamageable>(); //Debug.Log (this + " OnHitObject:" + 1); if (_scp != null) { //Debug.Log (12); _scp.TakeHit(damage, _hitPoint, trans.forward); //_scp.TakeDamage(damage); } //EnemyHealth _scp = hit.collider.GetComponent<EnemyHealth> (); //if (_scp != null) { // _scp.TakeDamage (damage); //} //Sound, Particle PoolMaster _p = PoolManager.ins.Instantiate("EffectEnemyHit", _hitPoint, Quaternion.identity).GetComponent <PoolMaster>(); _p.Play(); //Animation Auto > 파티클이 약간 빠름... //PoolReturnAnimation _a = PoolManager.ins.Instantiate ("HitEffectAnim", hit.point, Quaternion.identity).GetComponent<PoolReturnAnimation>(); //_a.Play ("HitEffect"); SoundManager.ins.Play("Enemy death", false); Destroy(); }
//--------------------------------------- //Player -> PlayerBullet -> Enemy //--------------------------------------- //public override void TakeHit(float _damage, Vector3 _hitPoint, Vector3 _hitDir){ // health -= _damage; // hitPoint = _hitPoint; // hitDir = _hitDir; // // if (health <= 0f && !bDead) { // Die (); // } //} //총알 -> Enemy (Ray) //Player -> Enemy (no Damage)? //public override void TakeDamage(float _damage){ // //health -= _damage; // // // //if (health <= 0f && !bDead) { // // Die (); // //} //} protected override void Die() { //Debug.Log (this + " Die:" + 1); bDead = true; //Expire Effect PoolMaster _p = PoolManager.ins.Instantiate("EffectEnemyDeath", hitPoint, Quaternion.identity).GetComponent <PoolMaster>(); _p.Play(); //Sound SoundManager.ins.Play("Enemy attack", false); //Debug.Log (this + ":" + 1); //Message Show Ui_MsgRoot.ins.InvokeShowMessage("UiHitMessage", "[00ff00]Hit[-]", hitPoint, 5f); //등록된 콜백사용... if (callbackDeath != null) { callbackDeath(this); callbackDeath = null; } //강제로 아이템 생성... if (Random.Range(0, 100) < 20) { Debug.Log("#### 아이템 강제로 임의 생성..."); Item _scpItem = PoolManager.ins.Instantiate("Item", hitPoint, Quaternion.identity).GetComponent <Item> (); int _k = Random.Range(0, ((int)ITEM_KIND.PLUS_POWER) + 1); if (_k <= 0) { _scpItem.InitReuse(ITEM_KIND.PLUS_BULLET, 1, 0); } else if (_k <= 1) { _scpItem.InitReuse(ITEM_KIND.PLUS_HEALTH, 1, 0); } else if (_k <= 2) { _scpItem.InitReuse(ITEM_KIND.PLUS_COIN, 1, 0); } else { _scpItem.InitReuse(ITEM_KIND.PLUS_POWER, 0, 0.1f); } } Destroy(); }
void Dead() { //폭발 Effect, Sound PoolMaster _p = PoolManager.ins.Instantiate("EffectPlayerDeath", trans.position, Quaternion.identity).GetComponent <PoolMaster>(); _p.Play(); //Animation Auto > 파티클이 약간 빠름... //PoolReturnAnimation _a = PoolManager.ins.Instantiate ("HitEffectAnim", hit.point, Quaternion.identity).GetComponent<PoolReturnAnimation>(); //_a.Play ("HitEffect"); SoundManager.ins.Play("Player death", false); bDeath = true; }
void OnHitObject(Collider2D _col, Vector3 _hitPoint) { //Debug.Log (this + "OnHitObject" + hit.collider.gameObject.name); //IDamageable _scp = _col.GetComponent<IDamageable>(); //if (_scp != null) { // _scp.TakeDamage(damage); //} //Sound, Particle PoolMaster _p = PoolManager.ins.Instantiate("EffectCollected", _hitPoint, Quaternion.identity).GetComponent <PoolMaster>(); _p.Play(); SoundManager.ins.Play("ItemEat", false); Destroy(); }
//------------------------------------ //Damage -> TakeHit, TakeDamage -> Die //------------------------------------ protected override void Die() { bDead = true; //Expire Effect PoolMaster _p = PoolManager.ins.Instantiate("EffectEnemyDeath", hitPoint, Quaternion.identity).GetComponent <PoolMaster>(); _p.Play(); //Sound //SoundManager.ins.Play ("Enemy attack", false); //Message Show //Ui_MsgRoot.ins.InvokeShowMessage("UiHitMessage", "[00ff00]Hit[-]", hitPoint, 5f); //등록된 콜백사용... if (callbackDeath != null) { callbackDeath(this); callbackDeath = null; } Destroy(); }
void Update() { if (Input.GetKeyDown(KeyCode.Alpha1)) { Vector3 _pos = new Vector3(Random.Range(-x, y), Random.Range(-x, y), 0); Instantiate(prefab, _pos, Quaternion.identity); } else if (Input.GetKeyDown(KeyCode.Alpha2)) { Vector3 _pos = new Vector3(Random.Range(-x, y), Random.Range(-x, y), 0); Instantiate(list[0].prefab, _pos, Quaternion.identity); } else if (Input.GetKeyDown(KeyCode.Alpha3)) { Vector3 _pos = new Vector3(Random.Range(-x, y), Random.Range(-x, y), 0); PoolMaster _scp = PoolManager.ins.Instantiate("HitEffectParticle", _pos, Quaternion.identity).GetComponent <PoolMaster>(); _scp.Play(); } else if (Input.GetKeyDown(KeyCode.Alpha4)) { Vector3 _pos = Vector3.zero; PoolMaster _scp = PoolManager.ins.Instantiate("HitEffectParticle", _pos, Quaternion.identity).GetComponent <PoolMaster>(); _scp.Play(); } else if (Input.GetKey(KeyCode.Alpha5)) { Vector3 _pos = new Vector3(Random.Range(-x, y), Random.Range(-x, y), 0); PoolMaster _scp = PoolManager.ins.Instantiate("HitEffectParticle", _pos, Quaternion.identity).GetComponent <PoolMaster>(); _scp.Play(); } }