/*void Update() * { * }*/ void Start() { // Destroy (GameObject.Find ( "Main Camera Menu")); arrowManager = GetComponentInChildren <ArrowManager>(); endUIScript = GetComponentInChildren <EndUIScript>(); timerScript = GetComponentInChildren <TimerManager>(); soundScript = GetComponent <SoundScript>(); HorsePowerApplied = horsePower; GetComponent <Rigidbody>().centerOfMass = Vector3.down * 1.5f; currentSpeed = 0.0f; //Compute the vertical and horizontal distance between the wheels in order to make some trigonometry for //wheels steer angles dv = Mathf.Abs(WheelLF.transform.position.x - WheelRB.transform.position.x); dh = Mathf.Abs(WheelLF.transform.position.z - WheelRB.transform.position.z); //Save the base position of both axle in order to modifiy it according to the suspension offsetAxleB = AxleBack.localPosition; offsetAxleF = AxleFront.localPosition; GameObject respawn = (GameObject)GameObject.FindGameObjectsWithTag("Respawn").GetValue(0); transform.position = respawn.transform.position; transform.rotation = respawn.transform.rotation; GetComponent <Rigidbody>().angularVelocity = Vector3.zero; timerScript.LaunchTimer(); endUIScript.ResetTime(); }
//Big red funny bullet void Shoot() { GameObject newBullet; if (!powerups.redPlanetState) { newBullet = Instantiate(pBulletPrefab, transform.position, transform.rotation); SoundScript.PlaySound("player_shoot_single"); } else { SoundScript.PlaySound("player_shoot_big"); newBullet = Instantiate(pBiggerBulletPrefab, transform.position, transform.rotation); } if (p.lookingLeft) { //Finds the GameObject "RightFacing", under the parent of Player //Player has two gameObject children and gets the transform.position of them newBullet.transform.position = leftFace.transform.position; newBullet.transform.right = -1 * transform.right.normalized; } else { newBullet.transform.position = rightFace.transform.position; newBullet.transform.right = transform.right.normalized; } }
private void Start() { playerAnimator = GetComponent <Animator>(); rb2d = GetComponent <Rigidbody2D>(); audioManager = SoundScript.instance; }
void ObjetoQueSeAbre() //Cuando el objeto del escenario SÍ tiene una interacción solo para abrirlo (Que no dropea item la primer interacción) { if (Input.GetKeyDown(KeyCode.E) && countItem < itemSprites.Length) //Si presiona E y aún quedan items disponibles, entonces cambia de sprite { if (countSprite == 0) //Para la primera vez que interactúa con el objeto (interacción #0) { SoundScript.playSound(audioSFX); //Audio que se va a reproducir al interactuar la primera vez con el objeto this.gameObject.GetComponent <SpriteRenderer>().sprite = objetoSprites[countSprite]; countSprite++; } else if (!inventory.isFull) //Para cuando ya pasó de la interacción #0 y verifica si tiene espacio en el inventario { if (objetoSprites.Length > 1) { //Solo en caso de que el objeto contenga más de un sprite en el array this.gameObject.GetComponent <SpriteRenderer>().sprite = objetoSprites[countSprite]; countSprite++; } PickItem(); } } else if (countItem == itemSprites.Length) //Cuando ya se acabaron las interacciones, se desbloquean las siguientes secuencias de interacción { GameManager.secuenciaActual++; countItem++; } }
// Start is called before the first frame update void Start() { if (SceneManager.GetActiveScene().buildIndex == 0) { if (instance != null) { Destroy(gameObject); } else { instance = this; DontDestroyOnLoad(gameObject); } } button_nextlevel.onClick.AddListener(NextLevel); button_quit.onClick.AddListener(Cikis); rigidbody = GetComponent <Rigidbody2D>(); game = new Game(); Time.timeScale = 1; firsttouch = false; stick_size = 0; stick_type = 0; soundScript = soundManager.GetComponent <SoundScript>(); GameObject go = GameObject.FindGameObjectWithTag("ball"); if (go == null) { Instantiate(ball, new Vector2(0f, -2.32f), Quaternion.identity); } }
// attack for the kendo sword void KendoSwing() { if (Kendo) { time += Time.deltaTime; // waiting for the kendo stick's swinging animation if (time > KendoTiming) { time = 0; // casting a raycast Vector3 pos = Vector3.zero; Ray inputRay = cam.ScreenPointToRay(Input.mousePosition); pos = inputRay.GetPoint(KendoStickRange); // instantiating a hit box Instantiate(KendoHit, pos, LaserHit.transform.rotation); // kendo stick hit sound FX SoundScript.PlaySound("Kendo"); Kendo = false; } } }
void Start() { backgroundMusic = GetComponent <AudioSource>(); Debug.Log("Game : " + PlayerPrefs.GetInt("musicGame")); SoundScript.Play(gameMusic); //if (PlayerPrefs.HasKey("Music")) //{ // if (PlayerPrefs.GetInt("Music") == 0) // { // musicButton.sprite = musicOffSprite; // SoundScript.Pause(gameMusic, 0); // } // else // { // musicButton.sprite = musicOnSprite; // SoundScript.Play(gameMusic); // } //} //else //{ // musicButton.sprite = musicOnSprite; // SoundScript.Play(gameMusic); //} }
// Start is called before the first frame update void Start() { if (SceneManager.GetActiveScene().buildIndex == 0) { if (instance != null) { Destroy(gameObject); } else { instance = this; DontDestroyOnLoad(gameObject); } } tryagain_button.onClick.AddListener(TryAgain); cont_ads_button.onClick.AddListener(Cont_Ads); quit_button.onClick.AddListener(QuitGame); game = new Game(); sS = soundManager.GetComponent <SoundScript>(); play = new Play(); health = 2; if (health == 0) { gameOver.SetActive(true); } }
public void MusicButton() { if (PlayerPrefs.HasKey("Music")) { if (PlayerPrefs.GetInt("Music") == 0) { musicButton.sprite = musicOnSprite; SoundScript.Play(gameMusic); PlayerPrefs.SetInt("Music", 1); } else { musicButton.sprite = musicOffSprite; //SoundScript.Pause(gameMusic, 0); PlayerPrefs.SetInt("Music", 0); } } else { musicButton.sprite = musicOnSprite; SoundScript.Play(gameMusic); PlayerPrefs.SetInt("Music", 1); } Debug.Log("music" + PlayerPrefs.GetInt("Music")); }
void Start() { Bird = GetComponent <Rigidbody2D>(); SS = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <SoundScript>(); Fnished = false; Statik.PipeSpeed = 1; }
// Start is called before the first frame update private void OnTriggerEnter2D(Collider2D collision) { carController.fuel = 1; carController.currentFuel = 1; SoundScript.PlaySound("fuel"); Destroy(gameObject); }
void Start() { game = FindObjectOfType <GameManagerScript>(); Sound = FindObjectOfType <SoundScript>(); for (int i = 0; i < IndicatorHotCard.Length; i++) { IndicatorHotCard[i].enabled = false; } for (int i = 0; i < IndicatorSaveCard.Length; i++) { IndicatorSaveCard[i].enabled = false; } Timer = TimerBegin; PlusTimer = TimerBegin; for (int i = 0; i < game.PlusText.Length; i++) { game.PlusText[i].text = ""; } MusicSound.value = MusicVolume; SoundSound.value = SoundVolume; }
private void Awake() { Instance = GameObject.Find("Incrementor").GetComponent <Incrementor>(); grandmaButton = GameObject.Find("Button_Grandma").GetComponent <Button>(); m_soundScript = GameObject.Find("Sound").GetComponent <SoundScript>(); }
void SpawnSoundPlayer() { GameObject soundPlayerInstance = Instantiate(soundPrefab) as GameObject; soundPlayerInstance.transform.SetParent(transform.root); soundScript = soundPlayerInstance.GetComponent <SoundScript>(); }
void Start() { if (GameObject.FindGameObjectWithTag("SoundManager") != null) { soundScript = GameObject.FindGameObjectWithTag("SoundManager").GetComponent <SoundScript>(); } }
private void OnTriggerEnter2D(Collider2D collision) { //Reset each state to false to prepare for next planet jump if (collision.gameObject.name == "purplePlanet") { resetStates(); purplePlanetState = true; } else if (collision.gameObject.name == "redPlanet") { resetStates(); redPlanetState = true; } else if (collision.gameObject.name == "earth") { resetStates(); earthState = true; SoundScript.PlaySound("player_shield"); } else if (collision.gameObject.name == "orangePlanet") { resetStates(); orangePlanetState = true; } else { return; } }
public void RestartScript() { SpideyScript = GameObject.Find("Spidey").GetComponent <SomeStuff>(); DbScript = GameObject.Find("Main Camera").GetComponent <DataBase>(); PauseScript = GameObject.Find("Pause Button").GetComponent <PauseButton>(); Player.transform.position = SpideyScript.StartPos; GameObject[] PumpkinDestroy; PumpkinDestroy = GameObject.FindGameObjectsWithTag("Block"); for (int i = 0; i < PumpkinDestroy.Length; i++) { Destroy(PumpkinDestroy[i]); } DbScript.PumpkinDistanceses(); DbScript.PlayerMoveUp = true; PauseScript.IsGamePaused = false; Invoke("CountDownClose", 6f); if (gameObject.name == "Restart Button II") { SoundScriptt = GameObject.Find("Sound Button").GetComponent <SoundScript>(); SpideyScript.anim.speed = 1f; PauseScript.IsGamePaused = false; SpideyScript.Score = 0; } }
void FixedUpdate() { Collider[] cols = Physics.OverlapSphere(tran.position, 2.0f); foreach (Collider col in cols) { if ((1 << col.gameObject.layer & check_layer) > 0) { IntObjBase tmp = col.GetComponent <IntObjBase>(); if (tmp != null) { tmp.Damage(); } if (explosive) { Instantiate(GameControl.inst.expl_part, tran.position, tran.rotation); ExplosiveDamage(col); } if (sound != GameSnd.None) { SoundScript.CreateSound(tran, SoundHandler.GetSnd(sound)); } Destroy(gameObject); return; } } }
//Hilarious triple shot void TriShot() { if (powerups.purplePlanetState) { GameObject newBullet2 = Instantiate(pBulletPrefab, transform.position, transform.rotation); GameObject newBullet3 = Instantiate(pBulletPrefab, transform.position, transform.rotation); SoundScript.PlaySound("player_shoot_triple"); if (p.lookingLeft) { newBullet2.transform.position = leftFace.transform.position; newBullet2.transform.right = -1 * transform.right.normalized; newBullet2.transform.rotation *= Quaternion.Euler(0, 0, 30); newBullet3.transform.position = leftFace.transform.position; newBullet3.transform.right = -1 * transform.right.normalized; newBullet3.transform.rotation *= Quaternion.Euler(0, 0, -30); } else { newBullet2.transform.position = rightFace.transform.position; newBullet2.transform.right = transform.right.normalized; newBullet2.transform.rotation *= Quaternion.Euler(0, 0, 30); newBullet3.transform.position = rightFace.transform.position; newBullet3.transform.right = transform.right.normalized; newBullet3.transform.rotation *= Quaternion.Euler(0, 0, -30); } } }
// Call SoundScript on trigger enter and play the sound void OnTriggerEnter2D(Collider2D col) { if (col.gameObject.CompareTag("Player")) { SoundScript.PlaySound2(); } }
public void Start() { string originalRankingTitle = PlayerPrefs.GetString(HighScoreSceneScript.RankingPref, "0,0,0,0,0"); soundScript = SoundManager.GetComponent <SoundScript>(); cursornum = 0; SelectCursor[0].gameObject.SetActive(true); SelectCursor[1].gameObject.SetActive(false); SelectCursor[2].gameObject.SetActive(false); SelectCursor[3].gameObject.SetActive(false); if (originalRankingTitle.Length > 0) { string[] RankingScore = originalRankingTitle.Split(","[0]); HighScoreSceneScript.Ranking = new int[HighScoreSceneScript.RankingNum]; for (int k = 0; k < originalRankingTitle.Length && k < HighScoreSceneScript.RankingNum; k++) { HighScoreSceneScript.Ranking[k] = int.Parse(RankingScore[k]); } } }
private void GetComponents() { player = FindObjectOfType <SimpleKeyboard>().transform; navMeshAgent = GetComponent <NavMeshAgent>(); gamePlayManager = FindObjectOfType <GamePlayManager>(); soundScript = FindObjectOfType <SoundScript>(); }
void Awake() { myCam = GameObject.Find("Main Camera").GetComponent <CameraScript>(); soundRef = GameObject.Find("Sound").GetComponent <SoundScript>(); stayRef = GameObject.Find("StayObj").GetComponent <StayScript>(); lvlManagerRef = GameObject.Find("LevelManager").GetComponent <LevelManager>(); }
// public static bool windowActiveScript = false; // Use this for initialization // Start is called before the first frame update void Start() { BGMSource = GetComponent <AudioSource>(); windowActiveScript = window.GetComponent <WindowActiveScript>(); soundScript = SoundManager.GetComponent <SoundScript>(); deathCamera.SetActive(false); Ready(); }
void Jump() { if (Input.GetButtonDown("Jump") && IsGrounded()) { SoundScript.playeffect("PlayerJumpSound"); gameObject.GetComponent <Rigidbody2D>().AddForce(new Vector2(0f, jumpforce), ForceMode2D.Impulse); } }
public override void ObstacleEvent(GameObject playerObject) { playerObject.GetComponent <PlayerController>().p_slowPercentage = this.p_slowPercentage; coroutine = playerObject.GetComponent <PlayerController>().SetSlowed(p_effectTime); playerObject.GetComponent <PlayerController>().StartCoroutine(coroutine); soundManager = GameObject.FindWithTag("SoundManager").GetComponent <SoundScript>(); soundManager.PlayAudio(FluidAsphaltSound); }
// Use this for initialization void Start() { Sounds = GameObject.FindGameObjectWithTag("Sound").GetComponent <SoundScript>(); bubble.SetActive(false); intcounter = 0; Time.timeScale = 0; Sounds.BGMusic.Play(); }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.CompareTag("Player")) { SoundScript.playeffect("Playerdeath"); player.transform.position = new Vector2(startX, startY); } }
public override void ObstacleEvent(GameObject playerObject) { GameObject.FindGameObjectWithTag("GameController").GetComponent <TimeManager>().AdjustTime(p_timeToAdd); FloatTextController.CreateFloatingText(p_timeToAdd.ToString() + "s", transform, true); base.ObstacleEvent(playerObject); soundManager = GameObject.FindWithTag("SoundManager").GetComponent <SoundScript>(); soundManager.PlayAudio(ClockSound); }
// Start is called before the first frame update void Start() { Debug.Log("start" + PlayerPrefs.GetInt("musicGame")); PlayerPrefs.SetInt("musicGame", 1); backgroundMusic = GetComponent <AudioSource>(); SoundScript.Play(startMusic); settingPanel.SetActive(false); }
void Awake() { if (_instance != null && _instance != this) Destroy(gameObject); else { _instance = this; source = GetComponent<AudioSource>(); DontDestroyOnLoad(gameObject); } }
void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } DontDestroyOnLoad(this.gameObject); }
//void Awake() { // DontDestroyOnLoad(transform.FindChild("Sound")); // DontDestroyOnLoad (transform.FindChild ("Music")); //} // Use this for initialization void Start () { instance = this; if (PlayerPrefs.HasKey ("isSound")) isSound = (PlayerPrefs.GetInt ("isSound") == 1); else { isSound = true; PlayerPrefs.SetInt("isSound", 1); } if (PlayerPrefs.HasKey ("isMusic")) isMusic = (PlayerPrefs.GetInt ("isMusic") == 1); else { isMusic = true; PlayerPrefs.SetInt("isMusic", 1); } bool? m; if (isMusic) m = false; else m = null; PlayMusic (m); }
/// <summary> /// Updates text on the GUIText control to match that in the avatar /// </summary> public void UpdateGuiText() { string textIn = GameObject.Find(avatarGameObjectName).GetComponent<ExtendedZigSkeleton>() .GUIOutputText1; feedbackText1.text = textIn; textIn = GameObject.Find(avatarGameObjectName).GetComponent<ExtendedZigSkeleton>() .GUIOutputText2; //Declare the SoundScript systemSounds = GameObject.Find(soundGameObjectName).GetComponent<SoundScript>(); feedbackText2.text = textIn; }
void Start() { // cache these so they can be accessed by other scripts soundManager = gameObject.GetComponent<SoundScript>(); }
//testing void Awake() { scrptInput = GameObject.FindGameObjectWithTag("GameManager").GetComponent<GameManager>(); soundManagerScript = GameObject.FindGameObjectWithTag("SoundManager").GetComponent<SoundScript>(); FindActivePlayer(); //bLeapIn = Random.Range(0,2) == 1 ? true : false; // if( bLeapIn) // nav.enabled = false; // else nav.SetDestination(gPlayer.transform.position); lmGroundLayer = sGroundLayer;//LayerMask.NameToLayer(sGroundLayer); fYVelocity = rigidbody.velocity.y; fXVelocity = rigidbody.velocity.x; aAnim = gCharacter.GetComponent<Animator>(); fSpeed = fInitSpeed; //Set the current speed of the monk to the "normal", initial speed. //fVerticalSpeed = fJumpHeight; //Set the vertical speed of the monk to its jump height. bGoingLeft = true; bAttacking = true; bIsMonk = true; bIsSwordGuy = false; //bInAir = false; //The monk does not start in the air. bGrounded = false; bGrounded2 = true; bBeenHit = false; //bLeapIn = false;//==========================================================================================================Dont Leave this as always true Component[] components = gCharacter.GetComponentsInChildren(typeof(Rigidbody)); foreach(Component c in components) { (c as Rigidbody).isKinematic = true; } }
// Use this for initialization void Start () { void Start () { //Start in melee type meleeType = true; canMelee = true; canRange = true; meleeCooldownTimer = gameObject.AddComponent<Timer>(); meleeCooldownTimer.initialize(meleeCool, false); delayRangeTimer = gameObject.AddComponent<Timer>(); delayRangeTimer.initialize(rangeDelay, false); swapCooldownTimer = gameObject.AddComponent<Timer>(); swapCooldownTimer.initialize(swapCooldownTime, false); meleeDelayTimer = gameObject.AddComponent<Timer>(); meleeDelayTimer.initialize(meleeDelay, false); anim = transform.GetComponent<Animator>(); soundSource = FindObjectOfType<SoundScript>(); }
// Use this for initialization void Start() { bGoingLeft = false; bAttacking = false; bIsNinja = true; bGrounded = false; fYVelocity = rigidbody.velocity.y; fXVelocity = rigidbody.velocity.x; aAnim = gCharacter.GetComponent<Animator>(); gPlayer = GameObject.FindGameObjectWithTag("Player"); iCurrentBulletsToFire = iBulletsToFire; Jump (); Component[] components = gCharacter.GetComponentsInChildren(typeof(Rigidbody)); foreach(Component c in components) { (c as Rigidbody).isKinematic = true; } soundManagerScript = GameObject.FindGameObjectWithTag("SoundManager").GetComponent<SoundScript>(); }
// Use this for initialization void Start() { //init the countdown timers countdownTimer = new mySimpleTimer.SimpleCountdownTimer(); countdownTimer.StartMethod(gestureHoldLength, new mySimpleTimer.SimpleCountdownTimer.TimerEventHandler(TimerZeroEvent)); demoCountdownTimer = new mySimpleTimer.SimpleCountdownTimer(); demoCountdownTimer.StartMethod(demoDelay, new mySimpleTimer.SimpleCountdownTimer.TimerEventHandler(NextGesture)); systemSounds = GameObject.Find(soundGameObjectName).GetComponent<SoundScript>(); }
void Start() { //Always want to start with the player alive isDead = false; //Always want to start where we can be damaged. canDamage = true; manaRegenTimer = gameObject.AddComponent<Timer>(); manaRegenTimer.initialize(manaRegenTime, false); healthRegenTimer = gameObject.AddComponent<Timer>(); healthRegenTimer.initialize(healthRegenTime, false); delayTimer = gameObject.AddComponent<Timer>(); delayTimer.initialize(delayTime, false); gameOverTimer = gameObject.AddComponent<Timer>(); gameOverTimer.initialize(2, false); flashTimer = gameObject.AddComponent<Timer>(); flashTimer.initialize(.1f, false); anim = GetComponent<Animator>(); soundSource = FindObjectOfType<SoundScript>(); }