using UnityEngine;
using System.Collections;

public class EnemyFloating : EnemyController
{

    protected bool bShouldBoost;

    public float FloatingImpetusPerSecond;

    protected override bool UpdateGrounded()
    {
        bShouldBoost = false;
        foreach (GameObject go in collisionFeet)
        {
            BoxCollider2D box = go.GetComponent<BoxCollider2D>();
            Collider2D[] colliders = Physics2D.OverlapAreaAll(box.bounds.min, box.bounds.max, m_whatIsGround); // (groundCollisionCircle.position, fGroundCheckRadius, m_WhatIsGround);
            for (int i = 0; i < colliders.Length; i++)
            {
                if (colliders[i].gameObject != gameObject)
                {
                    bShouldBoost = true;
                }
            }
        }
        return bShouldBoost;
    }

    public override void UpdateMotion()
    {
        base.UpdateMotion();

        if (bShouldBoost)
        {
            m_myBody.AddForce(new Vector2(0, FloatingImpetusPerSecond * Time.deltaTime));
        }
    }

}
