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

public class MapBoard_Animator : MonoBehaviour {

    public Animator[] animators;

    public void SetAnimator(bool active)
    {
        animators = GetComponentsInChildren<Animator>();
        foreach (Animator animator in animators)
        {
            if (animator != null)
            {
                animator.enabled = active;
            }
        }
    }

    public void SetItem(bool active)
    {
        ItemShow_ClickToAddCase[] itemShow_ClickToAddCases = GetComponentsInChildren<ItemShow_ClickToAddCase>();
        foreach (ItemShow_ClickToAddCase itemShow_ClickToAddCase in itemShow_ClickToAddCases)
            itemShow_ClickToAddCase.isShow = active;

        ItemShow_ClickToAddStory[] itemShow_ClickToAddStorys = GetComponentsInChildren<ItemShow_ClickToAddStory>();
        foreach (ItemShow_ClickToAddStory itemShow_ClickToAddStory in itemShow_ClickToAddStorys)
            itemShow_ClickToAddStory.isShow = active;

        ItemShow_ClickToChangeObject[] itemShow_ClickToChangeObjects = GetComponentsInChildren<ItemShow_ClickToChangeObject>();
        foreach (ItemShow_ClickToChangeObject itemShow_ClickToChangeObject in itemShow_ClickToChangeObjects)
            itemShow_ClickToChangeObject.isShow = active;

        ItemShow_ClickToChangeSprite[] itemShow_ClickToChangeSprites = GetComponentsInChildren<ItemShow_ClickToChangeSprite>();
        foreach (ItemShow_ClickToChangeSprite itemShow_ClickToChangeSprite in itemShow_ClickToChangeSprites)
            itemShow_ClickToChangeSprite.isShow = active;

        ItemShow_ClickToDestoryObject[] itemShow_ClickToDestoryObjects = GetComponentsInChildren<ItemShow_ClickToDestoryObject>();
        foreach (ItemShow_ClickToDestoryObject itemShow_ClickToDestoryObject in itemShow_ClickToDestoryObjects)
            itemShow_ClickToDestoryObject.isShow = active;

        ItemShow_ClickToMove[] itemShow_ClickToMoves = GetComponentsInChildren<ItemShow_ClickToMove>();
        foreach (ItemShow_ClickToMove itemShow_ClickToMove in itemShow_ClickToMoves)
            itemShow_ClickToMove.isShow = active;

        ItemShow_ClickToShowMoreInfo[] itemShow_ClickToShowMoreInfos = GetComponentsInChildren<ItemShow_ClickToShowMoreInfo>();
        foreach (ItemShow_ClickToShowMoreInfo itemShow_ClickToShowMoreInfo in itemShow_ClickToShowMoreInfos)
            itemShow_ClickToShowMoreInfo.isShow = active;

        ItemShow_PlayAnimator[] itemShow_PlayAnimators = GetComponentsInChildren<ItemShow_PlayAnimator>();
        foreach (ItemShow_PlayAnimator itemShow_PlayAnimator in itemShow_PlayAnimators)
            itemShow_PlayAnimator.isShow = active;

        ItemShow_ChangeObjectByItems[] itemShow_ChangeObjectByItems = GetComponentsInChildren<ItemShow_ChangeObjectByItems>();
        foreach (ItemShow_ChangeObjectByItems itemShow_ChangeObjectByItem in itemShow_ChangeObjectByItems)
            itemShow_ChangeObjectByItem.UpdateState();
    }
}
