Nextrek
@ 168
Nextrek / 3DSpace / Assets / SpaceUnity / _Demo / Scrips / SU_CameraAnimazione.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
using UnityEngine; using System.Collections; public class SU_CameraAnimazione : MonoBehaviour { public GameObject dialogo1; public GameObject dialogo2; public GameObject dialogo3; public GameObject thurster; public GameObject thurster2; public GameObject spaceship; public GameObject spaceCamera; public float tempoCamera = 2f; public float tempoCamera2 = 5f; public float tempoCamera3 = 8f; // Use this for initialization void Start () { spaceCamera.SetActive (true); } // Update is called once per frame void Update () { transform.position += new Vector3 ((1*Time.deltaTime), 0, 0); tempoCamera -= Time.deltaTime; tempoCamera2 -= Time.deltaTime; tempoCamera3 -= Time.deltaTime; if (tempoCamera < 0) { ShowDialogo(true); } if (tempoCamera < -3) { ShowDialogo(false); } if (tempoCamera2 < 0) { ShowDialogo1(true); } if (tempoCamera2 < -3) { ShowDialogo1(false); } if (tempoCamera3 < 0) { ShowDialogo2(true); } if (tempoCamera3 < -3) { ShowDialogo2(false); thurster.GetComponent<ParticleSystem>().startSize = 14 ; thurster.GetComponent<ParticleSystem>().startLifetime = 2.5f; thurster.GetComponent<ParticleSystem>().startSpeed = 30; thurster2.GetComponent<ParticleSystem>().startSize = 14; thurster2.GetComponent<ParticleSystem>().startLifetime = 2.5f; thurster2.GetComponent<ParticleSystem>().startSpeed = 30; spaceship.transform.position += new Vector3 (30*Time.deltaTime, 2*Time.deltaTime, 0); } } public void ShowDialogo(bool show) { if(dialogo1.activeSelf!=show) { dialogo1.SetActive(show); } } public void ShowDialogo1(bool show) { if(dialogo2.activeSelf!=show) { dialogo2.SetActive(show); } } public void ShowDialogo2(bool show) { if(dialogo3.activeSelf!=show) { dialogo3.SetActive(show); } } } |