package ru.andydevs.astraLaserForce.init;

import ru.andydevs.astraLaserForce.Game;
import ru.andydevs.astraLaserForce.animation.AnimationCanvas;
import ru.andydevs.astraLaserForce.animation.StarAnimationFrame;
import ru.andydevs.astraLaserForce.panels.StartMenu;
import ru.andydevs.astraLaserForce.state.GameStateAction;
import ru.andydevs.astraLaserForce.state.GameStateComponent;
import ru.andydevs.astraLaserForce.state.GameStateManager;

import javax.swing.*;
import java.awt.*;

/**
 * Init all states to GameStateManager. You can add yours
 */
public class GameStateInit {


    public GameStateInit() {


        //start menu
        GameStateManager.add("STATE_GAME_STARTMENU", new GameStateComponent() {
            //panels
            StartMenu startMenu = new StartMenu();
            AnimationCanvas bgStartMenu = new AnimationCanvas(new StarAnimationFrame());

            @Override
            public void action() {
                Game.container.add(startMenu);
                Game.container.add(bgStartMenu);
                bgStartMenu.start();


                //Game.container.add(startMenu);
                System.out.println("STATE_GAME_STARTMENU - Component StartMenu created!");
            }

            @Override
            public void destroy() {
                Game.container.remove(bgStartMenu);
                Game.container.remove(startMenu);
            }
        });


        //game pause
        GameStateManager.add("STATE_GAME_PAUSE", new GameStateAction() {
            @Override
            public void action() {
                System.out.println("STATE_GAME_PAUSE");
            }
        });
    }
}