public static FindWithTag ( string tag ) : |
||
tag | string | |
return |
private void Start() { _mainCamera = GameObject.FindWithTag("MainCamera"); _uiCamera = GameObject.FindWithTag("UICamera").GetComponent <Camera>(); _canvas = GameObject.FindWithTag("Canvas"); _musicManager = GameObject.FindWithTag("MusicManager").GetComponent <MusicManager>(); if (_mainCamera == null || _uiCamera == null || _canvas == null || _musicManager == null) { Debug.LogError("SIGHT-JACK ERROR: Could not find required objects."); GetComponentInParent <SightJackController>().Deactivate(); } _enemies = new List <GameObject>(); CreateView(GetComponent <Camera>()); // Get white noise from canvas _noise = _canvas.transform.Find("Noise").gameObject; _noise.SetActive(true); _previousCondition = _musicManager.Condition; _musicManager.Condition = MusicManager.Conditions.SightJack; _noiseEvent = RuntimeManager.CreateInstance(_noiseEventPath); _noiseEvent.set3DAttributes(gameObject.transform.To3DAttributes()); _noiseEvent.start(); }
private System.Collections.IEnumerator recachePlayer() { float wait = 1.0f; do { float curWait = 0.0f; this.followed = GO.FindWithTag("Player"); if (this.followed != null) { while (curWait < wait && !this.forceReset) { yield return(new UnityEngine.WaitForSeconds(0.1f)); curWait += 0.1f; } if (wait < 10.0f) { wait += 1.0f; } } } while (this.followed != null && !this.forceReset); this.forceReset = false; }
void Update() { _timerBetweenNullChecks += Time.deltaTime; if (_timerBetweenNullChecks < 1.0f) { return; } _timerBetweenNullChecks = 0.0f; if (mainCanvas == null) { mainCanvas = GameObject.Find("MainCanvas_NEW"); } if (gameOverCanvas == null) { gameOverCanvas = GameObject.FindWithTag("GameOverCanvas"); } if (pauseMenuCanvas == null) { pauseMenuCanvas = GameObject.FindWithTag("PauseMenuCanvas"); } }
public override IGameObject Perform() { var player = GameObject.FindWithTag("Player").GetComponent <Player>(); var path = Owner.Pathing.ShortestPath(Owner.Position, player.Position); if (path == null) { return(null); } NewPos = path.GetStep(0); return(base.Perform()); }
static public void setMusicVolume(float val) { Global.Sfx._musicVolume = val; GO music = GO.FindWithTag("Music"); if (music != null) { foreach (AudioSource src in music.GetComponentsInChildren <AudioSource>()) { if (src.isPlaying) { src.volume = Global.Sfx._musicVolume * 0.5f; } } } }