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

public class shipMenu : MonoBehaviour{
    public bool size, into;
    public float x,y,i;
    void Start(){
        i = 1f;
        StartCoroutine("wait");
    }
    void Update(){
        if(size){
            i += 0.01f;
            x = 1f * Time.deltaTime;
            y = x;
            if(transform.localScale.x < 1.4f){
                transform.localScale = new Vector2(i+x, i+y);
            }else{
                size = false;
                into = true;
                x = 0f;
                x = y;
            }
        }
        if(into){
            i -= 0.02f;
            x = 1f * Time.deltaTime;
            y = x;
            transform.position = new Vector2(transform.position.x, transform.position.y + 250f * Time.deltaTime);
            if(transform.localScale.x >= 0.1f){
                transform.localScale = new Vector2(i-x, i-y);
            }
            if(transform.position.y >= 400.2f){
                SceneManager.LoadScene("Game");
            }
        }
    }
    public IEnumerator wait(){
        yield return new WaitForSeconds(0.7f);
        size = true;
    }
}