using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MoreMountains.CorgiEngine;

public class OrderAttack : MonoBehaviour {


    public GameObject[] rigids;
    int counter = 0;
    public float TimeSequance= 1f;

	private void OnTriggerEnter2D(Collider2D collision)
	{
        if (collision.CompareTag("Player"))
        {

            TriggerRigidBodies();


        }
	}

    void TriggerRigidBodies()
    {
        InvokeRepeating("EnableGravity", TimeSequance , 1f);
    }

    void EnableGravity()
    {
        if (counter<=rigids.Length)
        {
            rigids[counter].GetComponent<Rigidbody2D>().gravityScale = 1f;

            counter++;

        }
    }






}
