private void Start() { levelManager = LevelManager.getInstance(); charM = CharacterManager.getInstance(); if (!charM.solo) { if (levelManager.winner == 0) { winText.text = "Well done, Fighter 1! \n You win!"; } else { winText.text = "Well done, Fighter 2! \n You win!"; } } else { winText.text = "Well done, Champion! \n You win!"; } audioManager = AudioManagerScript.getInstance(); audioManager.soundPlay("Effect_Win"); StartCoroutine(LoadScene()); }
private void FixedUpdate() { float jetpackImpulse = 0f; if (jumping && Input.GetKey("space") && jetpackChargeLeft > 0f) { jetpackImpulse = jetpackForce; jetpackChargeLeft -= Time.fixedUnscaledDeltaTime; body.AddForce(new Vector2(0, jetpackForce)); jetpackParticles.Emit(new ParticleSystem.EmitParams(), 5); if (!AudioManagerScript.audioSrc.isPlaying) { AudioManagerScript.PlaySound("Jump", jetpackTime); } } else { AudioManagerScript.audioSrc.Stop(); } body.velocity = new Vector2(horizontal * runSpeed, body.velocity.y); if (body.position.y < -100) { GameManager.Instance.ReloadLevel(); } }
private void Start() { Time.timeScale = 1f; _audioManager = GameObject.FindWithTag("AudioManager").GetComponent <AudioManagerScript>(); SFXVolumeSlider.value = _audioManager.SFXVolume; MusicVolumeSlider.value = _audioManager.MusicVolume; }
public void ReStart() { if (Application.loadedLevelName == "Stage_01") { Application.LoadLevel("Stage_01"); Time.timeScale = 1.0f; AudioManagerScript.Instance().bgm.enabled = true; } if (Application.loadedLevelName == "Stage_02") { Application.LoadLevel("Stage_02"); Time.timeScale = 1.0f; AudioManagerScript.Instance().bgm.enabled = true; } if (Application.loadedLevelName == "Stage_03") { Application.LoadLevel("Stage_03"); Time.timeScale = 1.0f; AudioManagerScript.Instance().bgm.enabled = true; } if (Application.loadedLevelName == "Stage_04") { Application.LoadLevel("Stage_04"); Time.timeScale = 1.0f; AudioManagerScript.Instance().bgm.enabled = true; } }
void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); foreach (Sound s in sounds) { if (s.type == 0) { s.source = backgroundMusicSource; } else if (s.type == 1) { s.source = soundEffectSource; } } }
public void ExitLobby() { Application.LoadLevel("Lobby"); Time.timeScale = 1.0f; AudioManagerScript.Instance().bgm.enabled = true; LobbyScript.Instance().UIChagner(); }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); return; // To ensure no more code executed before we destroyed gameObj } // Should prevent Music from restarting after Scene Load DontDestroyOnLoad(gameObject); foreach (SoundsStoringScript _item in allSounds) { _item.aSource = gameObject.AddComponent <AudioSource>(); _item.aSource.clip = _item.clip; _item.aSource.volume = _item.volume; _item.aSource.pitch = _item.pitch; _item.aSource.loop = _item.loop; } }
// Use this for initialization void Start() { myCanvas = GameObject.Find("Canvas"); canInstantiate = true; myAnimator = GetComponent <Animator> (); audioManager = GameObject.Find("AudioManager").GetComponent <AudioManagerScript> (); }
void Start() { // reference to character manager charManager = CharacterManager.getInstance(); audioManager = AudioManagerScript.getInstance(); numberOfPlayers = charManager.numberOfUsers; charManager.solo = (numberOfPlayers == 1); //create grid charGrid = new PotraitInfo[maxX, maxY]; int x = 0; int y = 0; potraitPrefabs = potraitCanvas.GetComponentsInChildren <PotraitInfo>(); // enter all portraits and assign grid for (int i = 0; i < potraitPrefabs.Length; i++) { potraitPrefabs[i].posX += x; potraitPrefabs[i].posY += y; charGrid[x, y] = potraitPrefabs[i]; if (x < maxX - 1) { x++; } else { x = 0; y++; } } }
public void Damage(float dmg, Vector3 enemyPos, string sound) { if (TimeBetweenDamage <= 0) { Health -= dmg; AudioManagerScript.PlaySound(sound); if (Health <= 0) { KillPlayer(); } if (Health > 0) { CinemachineCamera.GetComponent <CameraShake>().StartCameraShake(0.3f); PostProcessing.GetComponent <PostProcessControl>().ShowVignetteEffect(true, false); PlayerAC.SetTrigger("Damage"); HandleColor(); } var playerPos = GetComponent <Transform>().position; var direction = new Vector2(playerPos.x - enemyPos.x, 1).normalized; var velocity = direction * KnockBackForce; RB.velocity = velocity; TimeBetweenDamage = StartTimeBetweenDamage; } }
private void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); return; } //Para no destruir el AudioManager al cambiar de escena. DontDestroyOnLoad(gameObject); foreach (Sound_Class s in sounds) { s.source = gameObject.AddComponent <AudioSource>(); s.source.clip = s.clip; s.source.volume = s.volume; s.source.pitch = s.pitch; s.source.loop = s.loop; } }
private void Awake() { if (AudioManagerScript.instance == null) { AudioManagerScript.instance = this; } else if (AudioManagerScript.instance != this) { Destroy(this.gameObject); } // initializing Walking sounds playerIsWalking = false; sources[4].Stop(); sources[4].clip = walkingSound; sources[4].loop = true; // ensuring all point clips are not set to loop for (int x = 0; x < 3; x++) { sources[x].loop = false; } // setting loop and playing bg music sources[3].loop = true; sources[3].clip = bgMusic; if (SceneManager.GetActiveScene().name != "StartMenu") { sources[3].Play(); } }
// Use this for initialization private void Awake() { #region SINGELTON if (instance == null) { instance = this; } else { Destroy(gameObject); } #endregion foreach (Sound sound in sounds) { sound.audioSource = gameObject.AddComponent <AudioSource>(); sound.audioSource.clip = sound.clip; sound.audioSource.volume = sound.volume; sound.audioSource.pitch = sound.pitch; sound.audioSource.dopplerLevel = sound.doplerEffect; sound.audioSource.spatialBlend = sound.spatialBlend; sound.audioSource.loop = sound.loop; sound.audioSource.rolloffMode = sound.RollOffMode; sound.audioSource.playOnAwake = false; } DontDestroyOnLoad(gameObject); }
void Awake() { if (_instance == null) { _instance = this; //設定單例 } }
void Awake() { if (instance == null) { instance = this; } }
// Use this for initialization void Start() { scaleY = false; id = index; index += 1; color = COLOR.GREY; //get the script associated with the object GameObject g = GameObject.Find("GameManager"); globalObj = g.GetComponent <GameScript>(); GameObject g2 = GameObject.Find("AudioManager"); audioManager = g2.GetComponent <AudioManagerScript> (); //Make color based on boundary if (id == 1 || id == globalObj.boardSize + 2 || id == ((globalObj.boardSize + 2) * (globalObj.boardSize + 2)) || id == ((globalObj.boardSize + 1) * (globalObj.boardSize + 2) + 1)) { rise(2); } else if (id <= globalObj.boardSize + 2 || id > (globalObj.boardSize + 1) * (globalObj.boardSize + 2)) { rise(0); } else if ((id % (globalObj.boardSize + 2) == 0) || (id % (globalObj.boardSize + 2) == 1)) { rise(1); } }
//Método Awake é o primeiro código a ser executado pela nossa instância private void Awake() { //Se ao inicializar a instância estiver vazia //atribuimos o objeto atual a nossa instância e definimos que o objeto não //poderá ser destruido if (Instance == null) { Instance = this; DontDestroyOnLoad(gameObject); //Adicionando as trilhas de som BackingTrackSoundSource = gameObject.AddComponent <AudioSource>(); HelicopterSoundSource = gameObject.AddComponent <AudioSource>(); AttackSoundSource = gameObject.AddComponent <AudioSource>(); ExplosionSoundSource = gameObject.AddComponent <AudioSource>(); BackingTrackSoundSource.clip = Resources.Load <AudioClip>("Sounds/BackgroundTheme"); HelicopterSoundSource.clip = Resources.Load <AudioClip>("Sounds/HelicopterSoundEffect"); AttackSoundSource.clip = Resources.Load <AudioClip>("Sounds/MachineGunSoundEffect"); ExplosionSoundSource.clip = Resources.Load <AudioClip>("Sounds/ExplosionSoundEffect"); } else { //Se a instância já estiver em execução, destruímos qualquer objeto que tentar //instânciar novamente Destroy(gameObject); Debug.Log("Não é possível criar uma nova instância do objeto: " + this.name); } }
private void Start() { _currentState = EnemyState.Patrolling; SetTimers(_idleDuration, _idleDuration); _player = GameObject.FindGameObjectWithTag("Player").GetComponent <playerController>(); _soundManager = _player.GetComponent <AudioManagerScript>(); _rb = gameObject.GetComponent <Rigidbody2D>(); _spriteRenderer = gameObject.GetComponent <SpriteRenderer>(); _heldKey = gameObject.GetComponentInChildren <ChestKeyScript>(); _enemyWidth = _spriteRenderer.bounds.extents.x; _enemyHeight = _spriteRenderer.bounds.extents.y; /* WHY was this a thing? I'm permanently encasing this snippet here in resin for future generations. * A curse upon the bloodline of whoever inflicted this upon me. * /-----------------------------------------------\ | //flip sprite | | Vector3 Scaler = transform.localScale; | | Scaler.x *= -1; | | transform.localScale = Scaler; | \_______________________________________________/ | ----- ----- */ }
void Start() { audioManager = AudioManagerScript.getInstance(); rb = GetComponent <Rigidbody2D>(); states = GetComponent <StateManager>(); anim = GetComponent <HandleAnimations>(); rb.freezeRotation = true; }
// Start is called before the first frame update void Start() { _killCounter = GameObject.FindWithTag("KillCounter").GetComponent <KillCounter>(); _stageComplete = GetComponent <TextMeshProUGUI>(); _stageComplete.enabled = false; _audioManager = GameObject.FindWithTag("AudioManager").GetComponent <AudioManagerScript>(); _menu = GameObject.FindWithTag("IGMenu").GetComponent <MenuCanvasScript>(); }
// Use this for initialization void Start() { am = GameObject.Find("AudioManager").GetComponent <AudioManagerScript>(); player = GameObject.Find("Player"); bp = Owner.GetComponent <BallProperties>(); _bombPower = bp.BombPower; }
// Start is called before the first frame update void Start() { instance = this; characterCanvas = transform.Find("CharacterCanvas").gameObject; characterImage = characterCanvas.transform.Find("Image").GetComponent <RawImage>(); audioManager = this.transform.parent.GetComponentInChildren <AudioManagerScript>(); }
// Use this for initialization void Start() { xpText.text = "0 lumen"; gameIsPlaying = true; audioManager = GameObject.FindGameObjectWithTag("AudioManager").GetComponent <AudioManagerScript>(); startedSpawning = false; ToggleHelp(help1); }
void Awake() { lost = false; Time.timeScale = 1f; gameState = GameState.Menu; audioManager = GameObject.Find("_AudioManager").GetComponent <AudioManagerScript>(); backgroundMusic = GameObject.Find("_BackgroundMusic").GetComponent <AudioSource>(); }
protected void Awake() { InitializeCardPoints(); InitializeAllCardDeck(); ServeTheCards(); thisAudioManager = (AudioManagerScript)FindObjectOfType(typeof(AudioManagerScript)); }
// Use this for initialization void Start() { audioManager = GameObject.FindGameObjectWithTag("AudioManager").GetComponent <AudioManagerScript>(); pos = Camera.main.WorldToScreenPoint(transform.position); laser = GetComponentInChildren <LineRenderer>(true); lazerParticleSystem = GetComponentInChildren <ParticleSystem>(true); laser.enabled = false; }
public void spawn(float TimeToEnd = 10.0f) { if (manage == null) { manage = GameObject.Find("AudioManager").GetComponent <AudioManagerScript>(); } manage.Spawn(clip, position, TimeToEnd); }
/* * * In every frame check * - if any prefab is clicked or not. * - if clicked, do the required operation. * **/ void Update() { if (firebaseManager.updated) { if (!isInputLocked) { sentScore = false; currentAdjacentCount = 0; for (int i = 0; i < columnLength * rowLength; ++i) { PrefabManager prefabManager = objects[i].GetComponent <PrefabManager>(); if (prefabManager.isClicked) { visited = new bool[columnLength * rowLength]; disposables = new HashSet <GameObject>(); for (int j = 0; j < columnLength; ++j) { newInColumn[j] = 0; } Propagate(i); } } } else // Need this frame to update the UI. can't take input { if (taskStatus == 0) { print("Disposing objects"); DisposeObjects(); AudioManagerScript.PlayScoreSound(); } else if (taskStatus == 1) { if (taskOneClear()) { taskStatus++; } else { for (int i = 0; i < columnLength * rowLength; ++i) { if (objectCurrentPosition[objects[i]] != objectNewPosition[objects[i]]) { MoveObject(objects[i], objectNewPosition[objects[i]]); } } } } else { isInputLocked = false; } } } }
public void BgmReStart() { bgmStopSprite.SetActive(false); if (bgmStopSprite.activeSelf == false) { Debug.Log("bgm오픈"); AudioManagerScript.Instance().bgm.enabled = true; } }
public void Setup(int size) { this.size = size; hp = size * 2; transform.localScale = new Vector3(size, size, 1); prestige = size + Random.Range(0f, 1f); timer = size; manager = GameObject.Find("SoundManager").GetComponent <AudioManagerScript>(); }
// Update is called once per frame void Update() { /*if(Input.GetKeyDown ("e")){ GameObject cust = (GameObject)Instantiate (customerPrefab); cust.GetComponent<CustomerScript>().InitializeCustomer("StreetNav"); }*/ audioManager = GameObject.FindGameObjectWithTag("AudioManager").GetComponent<AudioManagerScript>(); if(customers.Count > 0 && !((GameObject)customers[0]).GetComponent<CustomerScript>().IsFocus ()){ ((GameObject)customers[0]).GetComponent<CustomerScript>().SendToRegister (); } }
// Use this for initialization void Start() { GameObject g = GameObject.Find ("GameManager"); globalObj = g.GetComponent< GameManagerScript >(); GameObject a = GameObject.Find ("AudioManager"); AudioManager = a.GetComponent<AudioManagerScript>(); property = BallProperty.Normal; }
// Use this for initialization void Start() { scaleY = false; id = index; index += 1; color = COLOR.GREY; //get the script associated with the object GameObject g = GameObject.Find ("GameManager"); globalObj = g.GetComponent< GameScript >(); GameObject g2 = GameObject.Find ("AudioManager"); audioManager = g2.GetComponent< AudioManagerScript> (); //Make color based on boundary if (id == 1 || id == globalObj.boardSize + 2 || id == ((globalObj.boardSize + 2) * (globalObj.boardSize + 2)) || id == ((globalObj.boardSize + 1) * (globalObj.boardSize + 2) + 1)) { rise (2); } else if ( id <= globalObj.boardSize + 2 || id > (globalObj.boardSize + 1) * (globalObj.boardSize + 2) ) { rise(0); } else if ( (id % (globalObj.boardSize+2) == 0) || (id % (globalObj.boardSize+2) == 1) ) { rise(1); } }
// Use this for initialization void Start() { audio = GameObject.FindGameObjectWithTag("GameManager").GetComponent<AudioManagerScript>(); StartCoroutine(InitiateArrow()); audio.Play("arrowShoot"); }
// Use this for initialization void Start() { slides = GetComponent<SlidesScript>(); slides.starting = false; familyManager = GameObject.FindGameObjectWithTag("FamilyManager").GetComponent<FamilyManagerScript>(); itemPosManager = GameObject.FindGameObjectWithTag("ItemPositions").GetComponent<ItemPositionManagerScript>(); transition = GameObject.FindGameObjectWithTag("Transition").GetComponent<TransitionScript>(); walkHome = GameObject.FindGameObjectWithTag("WalkHome").GetComponent<SideScrollWalkScript>();; audioManager = GameObject.FindGameObjectWithTag("AudioManager").GetComponent<AudioManagerScript>(); baking = GetComponent<BakingScript>(); finances = GetComponent<FinancesScript>(); customerManager = GetComponent<CustomerManagerScript>(); conversationManager = GetComponent<ConversationManagerScript>(); inventory = GetComponent<InventoryScript>(); input = GetComponent<InputManagerScript>(); phase = "setup"; dailyTransactions = new Transaction[customersToday]; }
// Use this for initialization void Start() { fms = GameObject.FindGameObjectWithTag("FamilyManager").GetComponent<FamilyManagerScript>(); eventManager = GetComponent<EventManagerScript>(); input = GameObject.FindGameObjectWithTag("EventManager").GetComponent<InputManagerScript>(); audioManager = GameObject.FindGameObjectWithTag("AudioManager").GetComponent<AudioManagerScript>(); }
//AudioConversationScript acsManager = GameObject.FindGameObjectWithTag("AudioConversationManager").GetComponent<AudioConversationScript>(); // Use this for initialization void Start() { /*currentConv = new Conversation(); currentConv.currentText = "thisisawholelotofreallylongtextbuddyiknowitsgonnagotothenextlineisupertotallybetcha"; // Still greatest line of code in the game. currentConv.options = new string[5]; currentConv.options[0] = "first"; currentConv.options[1] = "secondy"; currentConv.options[2] = "third"; currentConv.options[3] = "fourth"; currentConv.options[4] = "fifth"; numResponses = 5; currentConv.currentInteractionType = "respond"; minResponse = 0; maxResponse = 4;*/ audioManager = GameObject.FindGameObjectWithTag ("AudioManager").GetComponent<AudioManagerScript>();; eventManager = GetComponent<EventManagerScript>(); inventory = GetComponent<InventoryScript>(); barter = GetComponent<BarterScript>(); TextAsset[] files = Resources.LoadAll<TextAsset> ("Conversations"); for(int i = 0; i < files.Length; i++){ Conversation temp = ParseConversationFile(files[i]); if(temp.name != null){ conversations[temp.name] = temp; } } }
void Start() { mapManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent<MapManager>(); audio = GameObject.FindGameObjectWithTag("GameManager").GetComponent<AudioManagerScript>(); Rigidbody rb = gameObject.AddComponent<Rigidbody>(); rb.isKinematic = true; rb.useGravity = false; _animator = gameObject.GetComponentInChildren<Animator>(); gameObject.AddComponent<Controls>(); if (!(this is King)) { gameObject.tag = "UnitNeutral"; } else { _animator.SetBool("bobbing", true); } InitialMaxSpeed = MaxSpeed; InitialAcceleration = _acceleration; }
// Use this for initialization void Start() { instance = this; StartHomeMusic(); }