using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class EnemyBlackHoleForce : BlackHoleForce
{
    public override void ApplyBlackHoleForce(float appliedForce)
    {
        if (!blackHolePullImmunue)
        {   
            if (_movement)
            {
                if (!_movement.IsGravityImmune())
                {
                    _objectRigidBody.AddForce(-_objectRigidBody.transform.up * appliedForce);
                }
            }
            else
            {
                _objectRigidBody.AddForce(-_objectRigidBody.transform.up * appliedForce);
            }
        }        
    }

    public override void HitBlackHole()
    {        
        ObjectSpawning attachedShared = gameObject.GetComponent<EnemyObjectShared>().Spawner;
        if (attachedShared)
        {
            attachedShared.ReduceSpawnedCount();
        }
        Destroy(gameObject);        
        base.HitBlackHole();
    }
}
