// Update is called once per frame void FixedUpdate() { if (second) { return; } if (activated && !elevatorPlayed) { elevator.PlayOneShot(elevatorClip); elevatorPlayed = true; } if (activated) { Vector3 temp = transform.position; transform.position = Vector3.MoveTowards(transform.position, goalPos.position, 0.01f); if (cf != null) { cf.follow(transform.position - temp); fellow.follow((transform.position - temp) / 1.5f); } } if (Vector3.Distance(transform.position, goalPos.position) < 0.25f) { if (cf != null) { Destroy(cf.gameObject); } } if (Vector3.Distance(transform.position, goalPos.position) < 0.01f && !first) { ShuttleWindow.activateRot(); transform.parent = shuttle.transform; AILibrary.playAI(AIWelcome); MonitorScript.monitor.sprite = welcome; engineAmbient.Play(); first = true; } if (glassClosed && !second) { AILibrary.playAI(AIDecouple); MonitorScript.monitor.sprite = decouple; shuttle.GetComponent <Animator>().enabled = true; shuttle.GetComponent <EntryDirector>().enabled = true; rockets.Play(); second = true; } }
void EndAnimation() { rockets.Stop(); wind.Stop(); wind.volume = 0.5f; wind.clip = windClip; wind.Play(); AILibrary.playAI(AILanding); MonitorScript.monitor.sprite = landing; Destroy(GetComponent <Animator>()); }
private void Start() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); _ai = GetComponent <AILibrary>(); _currentPlayerText = _currentPlayerUIGameObject.GetComponent <Text>(); _currentPlayerAnimator = _currentPlayerUIGameObject.GetComponent <Animator>(); _audioManager = GetComponentInChildren <AudioManager>(); }
private bool scan() { RaycastHit hit; RaycastHit[] hits = Physics.RaycastAll(ps.transform.position, ps.transform.forward); for (int i = 0; i < hits.Length; i++) { GameObject scanned = hits[i].collider.gameObject; Debug.LogWarning("HIT: " + scanned.name); if (scanned.tag.Equals("Target")) { Debug.LogWarning("Target hit: " + scanned.name); Target ts = scanned.GetComponent <Target>(); AILibrary.playAI(ts.getAudio()); MonitorScript.setMonitor(ts.getMonitorSprite()); } return(true); } AILibrary.playAI(scanFailure); MonitorScript.setMonitor(monitorScanFailure); return(false); }
void playEntry() { AILibrary.playAI(AIEntry); MonitorScript.monitor.sprite = entry; }