using UnityEngine;
using System.Collections;

public class AnimaAccueil : MonoBehaviour {


    public GameObject screenSub;
    public GameObject helice1;
    public GameObject helice2;
    float BeginTime;
       
    public AudioClip moteurON;
    public AudioSource source1;
    // Use this for initialization
    void Start ()
    {
       
        BeginTime =Time.time;
        source1.clip = moteurON;
        source1.volume = 0.1f;
        source1.Play();
        

    }

    // Update is called once per frame
    void Update()
    {
        Debug.Log(Time.time - BeginTime);
        helice1.transform.Rotate(Vector3.back, 200.0f);
        helice2.transform.Rotate(Vector3.back, 200.0f);
        if (Time.time - BeginTime < 35.0f)
        {
            screenSub.transform.Translate (new Vector3(0, 0, 1) * Time.deltaTime * 200.0f);
        }
        if (Time.time - BeginTime > 3.5f && Time.time - BeginTime < 5.5f)
        {
            screenSub.transform.Rotate(new Vector3(0, 1, 0) * Time.deltaTime*90.0f);
        }
        if (Time.time - BeginTime > 8.0f && Time.time - BeginTime < 10.0f)
        {
            screenSub.transform.Rotate(new Vector3(0, -1, -0.1f) * Time.deltaTime * 70.0f);
            source1.volume += 0.001f;
        }

        if (Time.time - BeginTime > 10.0f && Time.time - BeginTime < 12.0f)
        {
            
            source1.volume += 0.0015f;
        }

        if (Time.time - BeginTime > 12.0f && Time.time - BeginTime < 35.0f)
        {

            source1.volume -= 0.002f;
        }

    }
}
