public void ApplyDamage( DamageData _damageData ) { if( m_timerGodMode <= 0 ) { m_timerGodMode = GodModeTimer; m_lastDamageData = _damageData; //AudioSource.PlayClipAtPoint(SoundLibController.GetInstance().GetSound("hurtEnemy_00"), transform.position); Health-=_damageData.Quantity; if( Health <= 0 ) { Destroy( gameObject ); if( FXDeathPrefab ) { GameObject fxDeath = Instantiate( FXDeathPrefab, transform.position, FXDeathPrefab.transform.rotation ) as GameObject; Destroy( fxDeath, 3f); } if( RandomDrop ) { Instantiate( RandomDrop, transform.position, transform.rotation ); } } } }
public static void ApplyDamage( GameObject _obj, float _quantity, Vector2 _force = default(Vector2), eDmgType _type = eDmgType.NORMAL ) { DamageData damageData = new DamageData(){ Quantity = _quantity, Force = _force, Type = _type }; damageData.ApplyDamage( _obj ); }