void Awake() { btn = GetComponent <Button>(); hatImg = GetComponent <RawImage>(); persistentAudioSource = FindObjectOfType <PersistentAudioSource>(); btn.onClick.AddListener(() => persistentAudioSource.PlayEffect(buttonSound)); }
void Awake() { AudioSource myAudio = GetComponent <AudioSource>(); if (instance != null && instance != this) { // If there's a persistent audio source with a different audio clip, // destroy the current instance of the persistent audio source if (myAudio.clip != instance.GetComponent <AudioSource>().clip) { Destroy(instance.gameObject); } // Else, destroy the second instance of a persistent audio source // that plays the same audio clip else { Destroy(this.gameObject); return; } } // Overwrite the current instance of the persistent audio source instance = this; DontDestroyOnLoad(this.gameObject); }
private void Start() { info = new Info(); audioManager = GetComponent <PersistentAudioSource>(); allObjs.Add(this); objsDict.Add(info.key, this); }
private void Start() { audioSource = FindObjectOfType <PersistentAudioSource>(); comboText.text = ""; comboString = comboText.text; }
void Awake() { btn = GetComponent <Button>(); face = GetComponent <Image>(); image = btn.GetComponentInChildren <RawImage>(); persistentAudioSource = FindObjectOfType <PersistentAudioSource>(); btn.onClick.AddListener(() => persistentAudioSource.PlayEffect(buttonSound)); }
// Start is called before the first frame update void Start() { gemPool = FindObjectOfType <GemPool>(); audioSource = FindObjectOfType <PersistentAudioSource>(); gemsLeft = availableGems; UpdateGemColorInOre(); }
// Start is called before the first frame update void Start() { boxColliders = GetComponents <BoxCollider>(); audioSource = FindObjectOfType <PersistentAudioSource>(); androidInputs = FindObjectOfType <AndroidInputs>(); EnableCollisions(false); }
// Start is called before the first frame update void Start() { avatar = GetComponent <PlayerAvatar>(); //Si es el jugador local //if(GameManager.isLocalGame || GameManager.isHost) androidInputs = FindObjectOfType <AndroidInputs>(); networkPlayer = GetComponent <NetworkPlayer>(); gameUIManager = FindObjectOfType <GameUIManager>(); gemPool = FindObjectOfType <GemPool>(); audioSource = FindObjectOfType <PersistentAudioSource>(); if (!PlayerSpawnerManager.isInHub) { gameUIManager.ActivatePlayerUI(playerNumber, userInfo.id); } rb = gameObject.GetComponent <Rigidbody>(); horizontalSpeed = startingHorizontalSpeed; verticalSpeed = startingVerticalSpeed; maxHorizontalSpeed = startingMaxHorizontalSpeed; maxVerticalSpeed = startingMaxVerticalSpeed; currentTier = gemPouchTiers[0]; ChangePouchSize(); if (!GameManager.isLocalGame) { if (GameManager.isHost) { animator.runtimeAnimatorController = hostAnimator; } else if (GameManager.isClient) { animator.runtimeAnimatorController = clientAnimator; } } groundMeshOrientation = playerMesh.transform.right; }
private void Start() { rb = GetComponent <Rigidbody>(); if (GameManager.isClient) { rb.isKinematic = true; var colliders = GetComponentsInChildren <Collider>(); foreach (var c in colliders) { c.enabled = false; } } gemPool = FindObjectOfType <GemPool>(); audioSource = FindObjectOfType <PersistentAudioSource>(); currentTier = tiers[0]; SpawnnForce(); }