Example #1
0
        private void EnemyMain_OnDamaged(object sender, EnemyMain.OnDamagedEventArgs e)
        {
            Vector3 bloodDir = (GetPosition() - e.attacker.GetPosition()).normalized;

            BloodParticleSystemHandler.Instance.SpawnBlood(5, GetPosition(), bloodDir);

            int damageAmount = Mathf.RoundToInt(30 * e.damageMultiplier * UnityEngine.Random.Range(.8f, 1.2f));

            DamagePopup.Create(GetPosition(), damageAmount, false);
            enemyMain.HealthSystem.Damage(damageAmount);

            //Sound_Manager.PlaySound(Sound_Manager.Sound.BodyHit_1, GetPosition());

            if (enemyMain.HealthSystem.IsDead())
            {
                FlyingBody.Create(GameAssets.i.pfEnemyFlyingBody, GetPosition(), bloodDir);
                enemyMain.DestroySelf();
                Sound_Manager.PlaySound(Sound_Manager.Sound.Minion_Dead, GetPosition());
            }
            else
            {
                // Knockback
                enemyMain.EnemyRigidbody2D.MovePosition(transform.position + bloodDir * 5f);
            }
        }
Example #2
0
        private void EnemyMain_OnDamaged(object sender, EnemyMain.OnDamagedEventArgs e)
        {
            Vector3 bloodDir = (GetPosition() - e.attacker.GetPosition()).normalized;

            Blood_Handler.SpawnBlood(5, GetPosition(), bloodDir);

            enemyMain.HealthSystem.Damage(Mathf.RoundToInt(30 * e.damageMultiplier));

            if (enemyMain.HealthSystem.IsDead())
            {
                //FlyingBody.Create(GameAssets.i.pfEnemyFlyingBody, GetPosition(), bloodDir);
                enemyMain.DestroySelf();
            }
        }