You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

71 lines
1.3 KiB

using UnityEngine;
using System.Collections;
public class titleScript : MonoBehaviour {
public float finishScale;
public float scaleTime;
public GameObject confetti;
public GameObject title;
public GameObject fractTitle;
public GameObject pressButtText;
public GameObject menu;
private bool onTitle = true;
private bool finishExplosion = false;
// Use this for initialization
void Start () {
title.SetActive (true);
pressButtText.SetActive (true);
title.transform.localScale = Vector3.one;
StartCoroutine(scaleTitle(finishScale,scaleTime));
}
// Update is called once per frame
void Update () {
if (onTitle)
newconfetti ();
if (Input.anyKeyDown) {
onTitle = false;
title.SetActive(false);
fractTitle.SetActive(true);
pressButtText.SetActive(false);
fractTitle.GetComponent<fracExplosion>().triggerExplos = true;
//menu.SetActive(true);
}
}
public void newconfetti ()
{
Vector3 pos = new Vector3 (Random.Range (-5, 5), 3.88f, 0);
Instantiate (confetti, pos, title.transform.rotation);
}
IEnumerator scaleTitle (float finishScale,float scaleTime) {
float startScale = title.transform.localScale.x;
for (float i = 0; i < 1; i += Time.deltaTime/scaleTime) {
title.transform.localScale = Vector3.one * Mathf.Lerp(startScale,finishScale,i);
yield return null;
}
}
}