// Use this for initialization void Start() { movementVelocity = new Vector2 (Random.Range (-1f, 1f), -fallSpeed); GetComponent<Rigidbody2D>().velocity = movementVelocity; enemySounds = GameObject.FindObjectOfType<SoundController>(); scoreKeeper = GameObject.FindObjectOfType<ScoreKeeper>(); }
void Awake () { if(_instance == null) { _instance = this; DontDestroyOnLoad (this); } else { if(this != _instance) Destroy (this.gameObject); } }
public GraphicComponent() { sc = new SoundController(); this.Tap += GraphicPart_Tap; AI.Instance.CurrentNumber.ValueChanged += Update; this.Loaded += GraphicComponent_Loaded; dt = new DispatcherTimer(); dt.Tick += dt_Tick; }
//public AudioSource scoreCount,bgSound ; void Awake () { Static = this; isSound = PlayerPrefs.GetInt ("Sound", 1); audio.clip = bgMusics[Random.Range (0, bgMusics.Length - 1)]; audio.Play (); if(isSound != 1) { pauseAudio (); } }
void Start() { this.ball = GameObject.FindWithTag("Ball"); this.player = GetComponent<PlayerController>(); this.cylinderController = GameObject.Find("Cylinders").GetComponent<CylinderController>(); this.soundController = GetComponent<SoundController>(); GameObject charSprite = transform.GetChild(0).FindChild("Character Sprite").gameObject; anim = charSprite.GetComponent<Animator>(); }
void Awake () { if (Instance != null && Instance != this) { DestroyImmediate(gameObject); return; } Instance = this; DontDestroyOnLoad(gameObject); }
void Awake () { if (instance != null) { Destroy(this.gameObject); return; } instance = this; DontDestroyOnLoad(this.gameObject); }
void Awake() { if(Instance) DestroyImmediate(gameObject); else { DontDestroyOnLoad(gameObject); Instance = this; } }
void Start() { this.player = GetComponent<PlayerController>(); this.soundController = GetComponent<SoundController>(); this.ballTransform = GameObject.FindWithTag("Ball").transform; this.ballInteraction = GetComponent<BallInteraction>(); this.cameraController = Camera.main.GetComponent<CameraController>(); GameObject charSprite = transform.GetChild(0).FindChild("Character Sprite").gameObject; anim = charSprite.GetComponent<Animator>(); }
void Start() { if (Instance == null) { Instance = this; } else { Destroy(gameObject); } }
void Start() { cultistController = FindObjectOfType<CultistController>(); levelAndClockController = FindObjectOfType<LevelAndClockController>(); soundController = FindObjectOfType<SoundController>(); pentaMonsta = GameObject.Find("PentaMonsta"); if (pentaMonsta != null) { pentaMonsta.GetComponent<SpriteRenderer>().sortingOrder = -10; } }
// Use this for initialization void Start () { _morreu = false; facada = 0; voodoo = GameObject.FindGameObjectWithTag("voodoo"); _sound = GameObject.FindGameObjectWithTag("SoundController").GetComponent<SoundController>(); for (int i=0; i< faca.Length; i++) { faca[i].SetActive(false); } }
public AudioSource audiosource; // audio source void Awake() { if (Sound == null) { DontDestroyOnLoad(gameObject); Sound = this; } else if (Sound != this) { Destroy(gameObject); } }
/////////////////////////////////// /** * Initialise les attributs. */ void Start () { tData = this.GetComponent<Terrain>().terrainData; hMapTmp = null; inCreation = false; canAddTexture = false; player = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerController>(); soundController = GameObject.FindGameObjectWithTag("Music").GetComponent<SoundController>(); InitTerrain(); }
// Use this for initialization void Start() { tacoCounter = GameObject.FindObjectOfType<TacoCounter>(); upgradeButtonController = GetComponent<UpgradeButtonController>(); soundController = GameObject.FindObjectOfType<SoundController>(); tapPowLevel = ProgressController.GetTapPowerLevel(); CalculateTapPower(); UpdateLevelUpData(); UpdateUI(); }
void Awake() { Instance = this; Load("Coin", "Sound/coin"); Load("Jump", "Sound/jump"); Load("Jump2", "Sound/jump2"); Load("Die", "Sound/die"); Load("Explosion", "Sound/explosion"); Load("Pipe", "Sound/pipe"); Load("Weight", "Sound/weight"); Load("Block", "Sound/block"); Load("Goal", "Sound/goal"); }
void Awake() { if(soundcontroller != null && soundcontroller != this) { Destroy(gameObject); } soundcontroller = this; DontDestroyOnLoad(gameObject); //since Notemanager is being overtaken in the start sequence LoadSounds(); }
void Start () { wheels = new Wheel[frontWheels.Length + rearWheels.Length]; sound = transform.GetComponent<SoundController>(); // Measuring 1 - 60 accelerationTimer = Time.time; topSpeed = Convert_Miles_Per_Hour_To_Meters_Per_Second(topSpeed); SetupWheelColliders(); SetupCenterOfMass(); SetupGears(); SetUpSkidmarks(); initialDragMultiplierX = dragMultiplier.x; Initialise(); }
protected void Awake() { instance = this; // Play baseline music baselineMusic = this.music[(int)MusicType.MusicBaseline]; baselineMusic.volume = 0f; baselineMusic.Play(); // Tween volume baselineMusic .DOFade(1.0f, 3f) .SetEase(Ease.InSine); // Start all sfx in the background so they stay on beat sounds[(int)SfxType.FxCreeper1].volume = 0; sounds[(int)SfxType.FxCreeper2].volume = 0; sounds[(int)SfxType.FxTams1].volume = 0; sounds[(int)SfxType.FxKickSlow].volume = 0; sounds[(int)SfxType.FxDistortedHat].volume = 0; sounds[(int)SfxType.FxWeirdDrummish].volume = 0; sounds[(int)SfxType.FxKickBassFast].volume = 0; sounds[(int)SfxType.FxMetal1].volume = 0; sounds[(int)SfxType.FxMelodicDistorted1].volume = 0; sounds[(int)SfxType.FxMelodic2].volume = 0; sounds[(int)SfxType.FxTams2].volume = 0; sounds[(int)SfxType.FxMelodic1].volume = 0; sounds[(int)SfxType.FxWubBassSlow].volume = 0; sounds[(int)SfxType.FxCreeper1].Play(); sounds[(int)SfxType.FxCreeper2].Play(); sounds[(int)SfxType.FxTams1].Play(); sounds[(int)SfxType.FxKickSlow].Play(); sounds[(int)SfxType.FxDistortedHat].Play(); sounds[(int)SfxType.FxWeirdDrummish].Play(); sounds[(int)SfxType.FxKickBassFast].Play(); sounds[(int)SfxType.FxMetal1].Play(); sounds[(int)SfxType.FxMelodicDistorted1].Play(); sounds[(int)SfxType.FxMelodic2].Play(); sounds[(int)SfxType.FxTams2].Play(); sounds[(int)SfxType.FxMelodic1].Play(); sounds[(int)SfxType.FxWubBassSlow].Play(); }
public void Shoot() { //The Bullet instantiation happens here. GameObject Temporary_Bullet_Handler; GameObject Temporary_Particle_Handler; Temporary_Bullet_Handler = Instantiate(Bullet_Prefab, Bullet_Emitter.transform.position, Bullet_Emitter.transform.rotation) as GameObject; Temporary_Particle_Handler = Instantiate(FireCannon_Particle, Bullet_Emitter.transform.position, Bullet_Emitter.transform.rotation) as GameObject; //Sometimes bullets may appear rotated incorrectly due to the way its pivot was set from the original modeling package. //This is EASILY corrected here, you might have to rotate it from a different axis and or angle based on your particular mesh. Temporary_Bullet_Handler.transform.Rotate(Vector3.left * 90); //Retrieve the Rigidbody component from the instantiated Bullet and control it. Rigidbody Temporary_RigidBody; Temporary_RigidBody = Temporary_Bullet_Handler.GetComponent <Rigidbody>(); //animation _animator.SetTrigger("Fire Cannon"); //sound SoundController.RandomizeSfx(.95f, 1.05f, _cannonShootAudioSource, _audioClipsArrayShoot); //Tell the bullet to be "pushed" forward by an amount set by Bullet_Forward_Force. Temporary_RigidBody.AddForce(transform.forward * Bullet_Forward_Force); Temporary_RigidBody.AddForce(transform.up * Bullet_Up_Force); //Basic Clean Up, set the Bullets to self destruct after 10 Seconds, I am being VERY generous here, normally 3 seconds is plenty. Destroy(Temporary_Bullet_Handler, 2.0f); Destroy(Temporary_Particle_Handler, 2.0f); _animator.SetBool("Reload Cannon", false); }
public void OnMouseUp() { transform.localScale = new Vector3(0.75f, 0.75f); if (bt == BtnPlay.ButtonType.Playbtn) { SoundController.PlaySound(soundsGame.play); SceneManager.LoadScene("PlayMode"); } if (bt == BtnPlay.ButtonType.Optionbtn) { SoundController.PlaySound(soundsGame.option); SceneManager.LoadScene("OptionMode"); } if (bt == BtnPlay.ButtonType.Aboutbtn) { SoundController.PlaySound(soundsGame.about); SceneManager.LoadScene("AboutMode 1"); } if (bt == BtnPlay.ButtonType.Exitbtn) { SoundController.PlaySound(soundsGame.exit); Application.Quit(); } }
public Map() { this.InitializeComponent(); ControllerGame.AdjustFullScreenMode(_Canvas, this); Window.Current.CoreWindow.KeyDown += CoreWindow_KeyDown; Window.Current.CoreWindow.KeyUp += CoreWindow_KeyUp; this.NavigationCacheMode = NavigationCacheMode.Enabled; StartAnimation(); //Startar a animação SetCollision(); //Inicialização das colisões pré-definidas SetChetsInMap(); //Inicialização dos baús pré-definidos AddImageOnList(); //Inicializa as imagens do Inventário do mapa em um List SetEnemiesPosition(); //Inicializa os inimigos SetKeyOnMap(); Generator.ChestPopulate(ChestControl); //Método para gerar os itens randomicamente dentro do baú WidthRatio = _Canvas.Width / 800; HeightRatio = _Canvas.Height / 600; SoundController.PlaySound(VoiceSound, "CaioAbraOBaivis.mp4"); }
public void Drop() { if (isLanded) { return; } bool fall = Move(Vector2Int.down); Vector2Int lastPosition = matrixPosition; SetPosition(matrixPosition + Vector2Int.down); if (!PlayfieldController.ValidPosition(this)) { landed = StartCoroutine(LockDelay()); if (fall) { SoundController.PlaySfx(GameData.GetAudioClip("Land")); } } SetPosition(lastPosition); }
void Awake() { body = rigidbody; originalCenterOfMass = body.centerOfMass; myTransform = transform; drivetrain = GetComponent <Drivetrain>(); axisCarController = GetComponent <AxisCarController>(); mouseCarcontroller = GetComponent <MouseCarController>(); mobileCarController = GetComponent <MobileCarController>(); brakeLights = GetComponent <BrakeLights>(); dashBoard = myTransform.GetComponentInChildren <DashBoard>(); steeringWheel = transform.GetComponentInChildren <SteeringWheel>(); soundController = GetComponent <SoundController>(); SetController(controller.ToString()); axles = GetComponent <Axles>(); //frontWheels=axles.frontAxle.wheels; //rearWheels=axles.rearAxle.wheels; //otherWheels=axles.otherWheels; //axles.allWheels=axles.axles.allWheels; invAllWheelsLength = 1f / axles.allWheels.Length; //Debug.LogWarning("inv= " + invAllWheelsLength); fixedTimeStepScalar = 0.02f / Time.fixedDeltaTime; invFixedTimeStepScalar = 1 / fixedTimeStepScalar; }
/// <summary> Initialization </summary> private void Setup() { // Create all managers dataManager = this.GetComponent <DataManager>(); if (dataManager != null) { dataManager.Initialize(); } screenManager = this.GetComponent <ScreenManager>(); if (screenManager != null) { screenManager.Initialize(); } soundManager = this.GetComponent <SoundManager>(); if (soundManager != null) { soundManager.Initialize(); } soundController = this.GetComponent <SoundController>(); if (soundController != null) { soundController.Initialize(); } }
public void InitGame(string level) { // Find components heartsText = GameObject.Find("HeartsText").GetComponent <Text>(); coinsText = GameObject.Find("CoinsText").GetComponent <Text>(); endLevelPanel = GameObject.FindObjectOfType <Canvas>().GetComponent <CanvasContainer>().EndLevelPanel; gameOverPanel = GameObject.FindObjectOfType <Canvas>().GetComponent <CanvasContainer>().GameOverPanel; player = GameObject.FindGameObjectWithTag("Player").GetComponent <Dude2D>(); playerSpawn = GameObject.Find("Spawn").transform; mainCamera = GameObject.FindObjectOfType <Camera>(); stateData = GameObject.FindObjectOfType <GameState>(); soundController = GameObject.FindObjectOfType <SoundController>(); // Configure camera mainCamera.GetComponent <CameraFollow>().enabled = true; mainCamera.GetComponent <CameraFollow>().m_Player = player.gameObject.transform; endLevelPanel.gameObject.SetActive(false); gameOverPanel.gameObject.SetActive(false); // Set state Debug.Log("Initing with level " + level); this.currentLevel = level; activeState = States.running; }
private void PlayMusicOnLoad(string _levelString) { SoundController _controller = FindObjectOfType <SoundController>(); switch (_levelString) { case "MainMenu": { SoundManager.Instance.PlayMusic(_controller["ecranTitre"]); } break; case "MainScene": { SoundManager.Instance.PlayMusic(_controller["inGame"]); } break; case "LoseScene": { SoundManager.Instance.PlayMusic(_controller["loseMenu"]); } break; case "WinScene": { SoundManager.Instance.PlayMusic(_controller["WinMenu"]); } break; default: { } break; } }
public int Attack(ArenaObj obj) { int buffAttack = 0; foreach (StatEffect effect in Effects) { buffAttack += effect.AttackBuff; } int buffDefence = 0; foreach (StatEffect effect in obj.Effects) { buffDefence += effect.DefenceBuff; } int resDmg = Math.Max(1, (int)MathHelper.Lerp( MinAttack + buffAttack, MaxAttack + 1 + buffAttack, (float)GameplayController.Random.NextDouble() ) - (obj.Defence + buffDefence) ); obj.Health -= resDmg; if (obj.Health <= 0) { obj.Health = 0; SoundController.PlaySound(SoundController.Death); } else { SoundController.PlaySound(SoundController.Hit); } obj.DmgAnim = true; return(resDmg); }
public void Collide() { animator.SetBool(AC_KEY_IS_DEAD, true); //Debug.Log("BOOM " + collision.gameObject.name); LeanTween.cancel(gameObject); rigidBody2D.bodyType = RigidbodyType2D.Static; audioSource.Stop(); SoundController.PlaySound(ESound.Curie_Truck_Explode, audioSource, false); Collider2D[] collisions = Physics2D.OverlapCircleAll(transform.position, radius); ICollisionHandler ownerHandler = owner.GetComponent <ICollisionHandler>(); foreach (var c in collisions) { ICollisionHandler handler = c.GetComponent <ICollisionHandler>(); if (handler == null) { continue; } if (handler == ownerHandler) { Debug.Log("SpecialCurieTruck Collision with myself " + handler); continue; } handler.OnCollision(damage, owner, gameObject, GetPush(c.transform)); Debug.Log("SpecialCurieTruck Collision with " + handler); } Photon.Send(EPhotonMsg.Special_Curie_Collide); canCollide = false; }
/// <summary> /// 核心内容,初始化网络NetWork,游戏配置数据初始化 /// </summary> void InitGame() { Container = gameObject; DontDestroyOnLoad(Container); Controller = Container.GetComponent <GameController>(); PlayerManager = Container.GetComponent <PlayerManager>(); GameMode = Container.GetComponent <GameMode>(); SoundManager = Container.GetComponent <SoundManager>(); SoundController = Container.GetComponent <SoundController>(); NonStopTime = Container.GetComponent <NonStopTime>(); GameTime = Container.GetComponent <GameTime>(); RankManager = Container.GetComponent <RankManager>(); IOManager = Container.GetComponent <IOManager>(); SettingManager = Container.GetComponent <SettingManager>(); //添加调试输出面板 //Panel = Container.AddComponent<DebugConsole>(); //Panel.Init(); //主摄像机 MainCamera = GameObject.Find("Main Camera"); // 初始化随机种子 UnityEngine.Random.seed = System.Environment.TickCount; UnityEngine.Random.seed = System.DateTime.Today.Millisecond; // 初始化动画插件(需要注意,这是全局的动画系统,全局设置时不会自动消耗 // 所有需要主要在游戏切换的时候记得统一销毁 DOTween.Init(true, true, LogBehaviour.Verbose).SetCapacity(1000, 10); // 初始化输入设备 IOManager.Init(GameConfig.GAME_CONFIG_PLAYER_COUNT); Controller.Init(GameController.InputType.External); PlayerManager.Init(); }
// Start is called before the first frame update void Start() { soundController = this; audioSource = GetComponent <AudioSource>(); enemyDeathSounds = Resources.LoadAll <AudioClip>("Audio/EnemyDeathSounds"); // get all clips from a folder and store them in an array of type AudioClip enemyDeathSoundsCount = enemyDeathSounds.Length; // get the size of the audio clip array once @load time and use it later for random enemyScreamSounds = Resources.LoadAll <AudioClip>("Audio/EnemyScreamSounds"); enemyScreamSoundsCount = enemyScreamSounds.Length; playerDamageSounds = Resources.LoadAll <AudioClip>("Audio/PlayerDamageSounds"); playerDamageSoundsCount = playerDamageSounds.Length; playerDashSounds = Resources.LoadAll <AudioClip>("Audio/PlayerDashSounds"); playerDashSoundsCount = playerDashSounds.Length; playerShootSounds = Resources.LoadAll <AudioClip>("Audio/PlayerShootSounds"); playerDashReadySound = Resources.Load <AudioClip>("Audio/sfx_sounds_powerup6"); menuButtonSound = Resources.Load <AudioClip>("Audio/sfx_menu_move3"); gameOverSound = Resources.Load <AudioClip>("Audio/GameOver"); menuMusic = Resources.Load <AudioClip>("Audio/Blipotron"); nextWaveSound = Resources.Load <AudioClip>("Audio/sfx_sound_poweron"); }
public void OnClickNumberBtn(int number) { ShipmentsAnswerCell cell = GetCurrentAnswerCell(); if (cell.Type == AnswerCellType.Numeric) { Text uiText = cell.GetComponentInChildren <Text>(); if (uiText.text.Length > 2) { SoundController.GetController().PlayDropSound(); } else { if (cell.Value == -1) { uiText.text = ""; } SoundController.GetController().PlayTypingSound(); uiText.text += number; cell.Value = int.Parse(uiText.text); } } UpdateTotalKm(); }
void Awake() { // Setting up the references. anim = GetComponent <Animator>(); playerController = GetComponent <PlayerController>(); playerShooting = GetComponentInChildren <PlayerShooting>(); soundController = GameObject.FindGameObjectWithTag("SoundController"); audio = soundController.GetComponent <SoundController>(); // Set the initial health of the player. numOfHearts = startingHealth / 2; currentHealth = startingHealth; for (int i = 0; i < startingHealth / 2; i++) { if (i < numOfHearts) { hearts[i].enabled = true; } else { hearts[i].enabled = false; } } }
public override void Ignite() { SoundController.PlayWhoosh(); if (curElement == Element.ice) { curElement = null; sr.sprite = originalSprite; col.sharedMaterial = originalMaterial; col.enabled = false; col.enabled = true; rb2d.mass = 300; } else if (curElement == null) { curElement = Element.fire; sr.sprite = onFire; col.sharedMaterial = originalMaterial; col.enabled = false; col.enabled = true; burnRoutine = BurnRoutine(burnTime); StartCoroutine(burnRoutine); } }
void Start() { // Store current window size for restoration after fullscreen // will remain at default (640x480) if already fullscreen if (!Screen.fullScreen) { width = Screen.width; height = Screen.height; } // Set static prefab array references hexprefabs = hexprefabcontainer; hexelprefabs = hexelprefabcontainer; sounds = soundcontainer; numbers = numbercontainer; hexelpreviews = hexelpreviewcontainer; // Create controllers gamecontroller = (GameController)gameObject.AddComponent <GameController>(); boardcontroller = (BoardController)gameObject.AddComponent <BoardController>(); rowcontroller = (RowController)gameObject.AddComponent <RowController>(); savecontroller = (SaveController)gameObject.AddComponent <SaveController>(); soundcontroller = (SoundController)gameObject.AddComponent <SoundController>(); }
// Use this for initialization. public void OnEnable() { Debug.IsLogEnabled = true; if (Instance != null) { Debug.ULogErrorChannel("WorldController", "There should never be two world controllers."); } Instance = this; new FunctionsManager(); new PrototypeManager(); new CharacterNameManager(); new SpriteManager(); new AudioManager(); // FIXME: Do something real here. This is just to show how to register a C# event prototype for the Scheduler. PrototypeManager.ScheduledEvent.Add( new ScheduledEvent( "ping_log", (evt) => Debug.ULogChannel("Scheduler", "Event {0} fired", evt.Name))); modsManager = new ModsManager(); if (SceneController.loadWorldFromFileName != null) { CreateWorldFromSaveFile(SceneController.loadWorldFromFileName); SceneController.loadWorldFromFileName = null; } else { CreateEmptyWorld(); } soundController = new SoundController(World); }
public override void Shoot(Transform ship, Transform leftFire, Transform rightFire) { GameObject leftProjectile; GameObject rightProjectile; // Creating a temp object just to set the isRightSide variable // Offset to match the enemy ship sprite float rotationAngle = ship.transform.eulerAngles.z - 90.0f; if (leftFire != null) { leftProjectile = Instantiate(this.gameObject, leftFire.position, leftFire.rotation); leftProjectile.GetComponent <Weapon>().launchAngle = rotationAngle; } if (rightFire != null) { rightProjectile = Instantiate(this.gameObject, rightFire.position, rightFire.rotation) as GameObject; rightProjectile.GetComponent <Weapon>().launchAngle = rotationAngle; } SoundController.Play((int)SFX.ShipLaserFire, 0.2f); }
// Use this for initialization void OnEnable() { string dataPath = System.IO.Path.Combine(Application.streamingAssetsPath, "Data"); modsManager = new ModsManager(dataPath); if (Instance != null) { Debug.LogError("There should never be two world controllers."); } Instance = this; if (loadWorldFromFile != null) { CreateWorldFromSaveFile(); loadWorldFromFile = null; } else { CreateEmptyWorld(); } soundController = new SoundController(world); }
internal void PlaySoundClick() { SoundController.GetController().PlayClickSound(); }
// Use this for initialization void Start() { sc = Camera.main.GetComponent<SoundController> (); }
public void ShowEndPanel() { SoundController.GetController().PlayLevelCompleteSound(); ShowStars(); }
void Start () { instance = this; }
public void Start() { collisionController = GetComponent <CollisionController>(); soundController = GameObject.FindGameObjectWithTag("GameController").GetComponent <SoundController>(); UpdateKinematics(); }
public override bool ActivateEffect() { FindObjectOfType <Player>().AddStatusEffect(Status.ElementalDamage, elemental); SoundController.Play((int)SFX.Potion, 0.5f); return(true); }
void Update() { Enemy closestEnemy = GetClosestEnemy(); if (closestEnemy != null && barrel != null) { barrel.AimAt(closestEnemy.transform.position); } if (shootCooldownCounter > 0) { shootCooldownCounter -= Time.deltaTime; if (shootCooldownCounter < 0) { shootCooldownCounter = 0; } } else { if (autoAim) { if (closestEnemy != null && Vector2.Distance(transform.position, closestEnemy.transform.position) < 18) { RequestAutoFire(closestEnemy.transform.position); } } } if (shotQueued && shootCooldownCounter <= 0) { shotQueued = false; shootCooldownCounter = fireRate[upgradeTier]; if (!Physics2D.Raycast(projectileSpawn.position, queuedShotCrosshair - new Vector2(projectileSpawn.position.x, projectileSpawn.position.y), 40, friendlyLayers)) { switch (projectileType) { case ProjectileType.BULLET: Bullet bullet = Instantiate(bulletPrefab, projectileSpawn.position, Quaternion.identity); bullet.Initiate(queuedShotCrosshair - new Vector2(projectileSpawn.position.x, projectileSpawn.position.y), damage[upgradeTier], bulletSpeed[upgradeTier]); SoundController.PlayShoot(); break; case ProjectileType.LASER: RaycastHit2D hit = Physics2D.Raycast(projectileSpawn.position, queuedShotCrosshair - new Vector2(projectileSpawn.position.x, projectileSpawn.position.y), 40, enemyLayers); Vector2 end = Vector2.zero; SoundController.PlayLaser(); if (hit) { Enemy enemy = hit.collider.gameObject.GetComponent <Enemy>(); if (enemy != null) { enemy.Damage(damage[upgradeTier]); } end = hit.point; Laser laser = Instantiate(laserPrefab, projectileSpawn.position, Quaternion.identity); laser.Initiate(new Vector2(projectileSpawn.position.x, projectileSpawn.position.y), end); } else { end = queuedShotCrosshair - new Vector2(projectileSpawn.position.x, projectileSpawn.position.y); end.Normalize(); //max laser distance end *= 40; Laser laser = Instantiate(laserPrefab, projectileSpawn.position, Quaternion.identity); laser.Initiate(new Vector2(projectileSpawn.position.x, projectileSpawn.position.y), new Vector2(projectileSpawn.position.x, projectileSpawn.position.y) + end); } break; case ProjectileType.MISSLE: Missle missle = Instantiate(misslePrefab, projectileSpawn.position, Quaternion.identity); missle.Initiate(queuedShotCrosshair - new Vector2(projectileSpawn.position.x, projectileSpawn.position.y), new Vector2(projectileSpawn.position.x, projectileSpawn.position.y), queuedShotCrosshair, damage[upgradeTier], bulletSpeed[upgradeTier], explosionRadius[upgradeTier]); SoundController.PlayShoot(); break; } } } }
void OnApplicationQuit() { // Ensure that the instance is destroyed when the game is stopped in the editor. instance = null; }
// Use this for initialization void Start () { playerController =player.GetComponent<PacmanController>(); soundCtrl = gameObject.transform.FindChild("SoundController").GetComponent<SoundController>(); }
void Start() { _sound = GameObject.FindGameObjectWithTag("SoundController").GetComponent<SoundController>(); }
void Start() { if (instance){ Destroy (gameObject); }else{ instance = this; DontDestroyOnLoad (gameObject); } AddChannels(); DontDestroyOnLoad (transform.gameObject); LoadClips(); }
private void Awake() { if (Instance != null) { DestroyImmediate(gameObject); return; } Instance = this; DontDestroyOnLoad(gameObject); aud = GetComponent<AudioSource>(); soundDB = GetComponent<Sound_Music_Holder>(); aud.pitch = 1f; }
// Use this for initialization void Start() { Audio = GetComponent<AudioSource>(); instance = this; }
void Awake() { Instance = this; }
internal void ExitGame() { ViewController.GetController().LoadMainMenu(); SoundController.GetController().PlayMusic(); }
private void Play_Click(object sender, RoutedEventArgs e) { _controller = new SoundController(); //controller.TestSoundPlayer(); _controller.LoadAndPlay(); }
void Start() { sc = GameObject.FindObjectOfType <SoundController>(); sc.RunGeneralSound(); rb = GetComponent <Rigidbody>(); }
//for audio sources void OnEnable() { Time.timeScale = 1; Static = this; }
void Awake() { if (instance){ Destroy (gameObject); }else{ instance = this; DontDestroyOnLoad (gameObject); } DontDestroyOnLoad (transform.gameObject); _SOUND = GetComponent<SoundController>(); _GUI = GetComponent<GUIController>(); }
private void Start() { gameController = FindObjectOfType <GameController>(); soundController = SoundController.FindSoundController(); }
// Use this for initialization void Start() { instance = this; }
void Awake() { // Measuring 1 - 60 // accelerationTimer = Time.time; EngineForceFactor = 1.0f; SetupRigidBody(); backgroundSoundController = FindObjectOfType(typeof(BackgroundSoundController)) as BackgroundSoundController; dragMultiplier = MyCarSettings.dragMultiplier; centerOfMass = MyCarSettings.centerOfMass; frontWheels = MyCarSettings.frontWheels; rearWheels = MyCarSettings.rearWheels; gearSpeeds = MyCarSettings.gearSpeeds; gearTime = MyCarSettings.gearTime; gearAcc = MyCarSettings.gearAcc; ForceFactor = MyCarSettings.ForceFactor; BrakeForceFactor = MyCarSettings.BrakeForceFactor; DriftXDrag = MyCarSettings.DriftXDrag; wheels = new Wheel[frontWheels.Length + rearWheels.Length]; MassMultiForceFactor = rigidbody.mass * ForceFactor; sound = transform.GetComponent<SoundController>(); timer = transform.GetComponent<Timer>(); SetupWheelColliders(); SetupCenterOfMass(); topSpeed = Convert_Miles_Per_Hour_To_Meters_Per_Second(topSpeed); SetupGears(); SetUpSkidmarks(); initialDragMultiplierX = dragMultiplier.x; dragMultiplier.x = initialDragMultiplierX * handbrakeXDragFactor; IsEngineStart = false; // if(HoldTest){ // Wait(true); // }else{ // Wait(false); // } //StartEngine(); //SetBackgroundMusic(true); }