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

public class Traps : MonoBehaviour
{

    public List<ConveyorBelt> ConveyorBelts = new List<ConveyorBelt>();
    public List<CrushingBoulder> CrushingBoulders = new List<CrushingBoulder>();
    public List<CubeWithCrystals> CubesWithCrystals = new List<CubeWithCrystals>();
    public List<FloatingOnWater> FloatingOnWater = new List<FloatingOnWater>();
    public List<InGroundTrap> InGroundTraps = new List<InGroundTrap>();
    public List<ShootingCannon> ShootingCannons = new List<ShootingCannon>();

    private void Start()
    {
        ConveyorBelts.AddRange(GameObject.FindObjectsOfType<ConveyorBelt>());
        CrushingBoulders.AddRange(GameObject.FindObjectsOfType<CrushingBoulder>());
        CubesWithCrystals.AddRange(GameObject.FindObjectsOfType<CubeWithCrystals>());
        FloatingOnWater.AddRange(GameObject.FindObjectsOfType<FloatingOnWater>());
        InGroundTraps.AddRange(GameObject.FindObjectsOfType<InGroundTrap>());
        ShootingCannons.AddRange(GameObject.FindObjectsOfType<ShootingCannon>());
    }

    public void environmentTurn()
    {
        if (ConveyorBelts.Count > 0)
        {
            foreach(ConveyorBelt belt in ConveyorBelts)
            {
                belt.Animate();
            }
        }
        if (CrushingBoulders.Count > 0)
        {
            foreach (CrushingBoulder boulder in CrushingBoulders)
            {
                boulder.Animate();
            }
        }
        if (ShootingCannons.Count > 0)
        {
            foreach (ShootingCannon cannon in ShootingCannons)
            {
                cannon.Animate();
            }
        }
    }
    public void environmentRound()
    {
        if (CubesWithCrystals.Count > 0)
        {
            foreach (CubeWithCrystals crystal in CubesWithCrystals)
            {
                crystal.Animate();
            }
        }
        if (FloatingOnWater.Count > 0)
        {
            foreach (FloatingOnWater water in FloatingOnWater)
            {
                water.Animate();
            }
        }
        if (InGroundTraps.Count > 0)
        {
            foreach (InGroundTrap ground in InGroundTraps)
            {
                ground.Animate();
            }
        }
    }
}
