public void StartNewFlight() { GameState.CoinValue = 1; GameState.DifficultyLevel = 1; Player.State.Refresh(); Player.Revive(); potionEffects.RefreshButtonInteractable(); CanvasCoordinator.SetHudInteractable(true); AudioClipPlayer.FadeFromMenuToInGameMusic(); manaBarConstructor.UpdateManaBarSize(); UnityAction onHudShown = () => { if (PlayerSettings.HasSeenControlsTutorial) { GameState.IsPaused = false; isFlightActive = true; } else { TutorialCoordinator.ActivateTiltTutorial(); } }; CanvasCoordinator.HideMenuesAndShowHud(onHudShown); }
public void DowngradeSkill(Upgrade upgrade) { UpgradeViewModel upgradeViewModel; switch (upgrade) { case Upgrade.ManaAmount: upgradeViewModel = manaAmount; break; case Upgrade.VerticalSpeed: upgradeViewModel = verticalSpeed; break; case Upgrade.BoostSpeed: upgradeViewModel = boostSpeed; break; case Upgrade.ManaRegenRate: upgradeViewModel = manaRegen; break; default: throw new ArgumentOutOfRangeException("upgrade", upgrade, null); } if (upgradeViewModel.CurrentLevel == 1) { AudioClipPlayer.PlayIncorrect(); return; } upgradeViewModel.SetCurrentLevel(upgradeViewModel.CurrentLevel - 1); UpdateGUI(upgrade); }
private void OnTriggerEnter2D(Collider2D col) { #if DEBUG Debug.Log(name + " entered trigger " + col.name); #endif if (col.name == "Currency") { sessionData.CherriesThisRun++; CloudVariables.TotalCollectedCherries++; sessionData.Cherries++; AudioClipPlayer.PlayCherry(); points.transform.position = col.transform.position; points.Play(); objectPooler.Recycle(col.gameObject); } else if (col.name.StartsWith("Jump") || col.name.StartsWith("Slide")) { if (!obstacleCollisionOn) { return; } AudioClipPlayer.PlayDeath(); deathEffect.transform.position = transform.position; deathEffect.Play(); gameManager.PlayerDeath(); } }
// Token: 0x0600010B RID: 267 RVA: 0x00011FDC File Offset: 0x000103DC private void Update() { if (!this.Done) { float num = Vector3.Distance(this.Yandere.transform.position, base.transform.root.position); if (num < 5f) { if (!this.Hunting) { this.Timer += Time.deltaTime; if (this.VoiceClip == null) { this.Subtitle.text = string.Empty; } if (this.Timer > 5f) { this.Timer = 0f; this.Subtitle.text = this.MutterTexts[this.ID]; AudioClipPlayer.PlayAttached(this.Mutters[this.ID], base.transform.position, base.transform, 1f, 5f, out this.VoiceClip, this.Yandere.transform.position.y); this.ID++; if (this.ID == this.Mutters.Length) { this.ID = 1; } } } else if (!this.Began) { if (this.VoiceClip != null) { UnityEngine.Object.Destroy(this.VoiceClip); } this.Subtitle.text = "Do it."; AudioClipPlayer.PlayAttached(this.DoIt, base.transform.position, base.transform, 1f, 5f, out this.VoiceClip, this.Yandere.transform.position.y); this.Began = true; } else if (this.VoiceClip == null) { this.Subtitle.text = "...kill...kill...kill..."; AudioClipPlayer.PlayAttached(this.KillKillKill, base.transform.position, base.transform, 1f, 5f, out this.VoiceClip, this.Yandere.transform.position.y); } float num2 = Mathf.Abs((num - 5f) * 0.2f); num2 = ((num2 <= 1f) ? num2 : 1f); this.Subtitle.transform.localScale = new Vector3(num2, num2, num2); } else { this.Subtitle.transform.localScale = Vector3.zero; } } Vector3 eulerAngles = this.TwintailR.eulerAngles; Vector3 eulerAngles2 = this.TwintailL.eulerAngles; eulerAngles.x = this.PermanentAngleR.x; eulerAngles.z = this.PermanentAngleR.z; eulerAngles2.x = this.PermanentAngleL.x; eulerAngles2.z = this.PermanentAngleL.z; this.TwintailR.eulerAngles = eulerAngles; this.TwintailL.eulerAngles = eulerAngles2; }
private static void UnlockCharacter(int characterIndex) { AudioClipPlayer.PlayNewCharacter(); switch (characterIndex) { case 1: CloudVariables.Char2Unlocked = true; return; case 2: CloudVariables.Char3Unlocked = true; return; case 3: CloudVariables.Char4Unlocked = true; return; case 4: CloudVariables.Char5Unlocked = true; return; case 5: CloudVariables.Char6Unlocked = true; return; } }
public void SkipInstructions() { timerActive = false; currentCountdownValue = 0; instructionsGuiHandler.DisableArrows(); AudioClipPlayer.StopCountdown(); panelAnimator.HidePanel(); }
public void DrinkMidasPotion() { if (State.MidasPotions > 0) { AudioClipPlayer.PlayPotion(); State.MidasPotions--; s_instance.potionEffects.ActivateMidasEffect(); Cloud.Storage.Save(); } }
private void Start() { _launched = true; _rigidbody2D.AddForce(LaunchVector); DelayCollisions(); if (_playSpawnSound) { AudioClipPlayer.PlayAudioAtLocation(soundSpawn, _transform.position, 0.5f); } }
private void OnTriggerEnter(Collider other) { if (other.gameObject.layer == 19 && !this.Destroyed) { UnityEngine.Object.Instantiate <GameObject>(this.DestroyedCandlestick, base.transform.position, Quaternion.identity).transform.localScale = base.transform.localScale; this.Destroyed = true; AudioClipPlayer.Play2D(this.Break, base.transform.position); UnityEngine.Object.Destroy(base.gameObject); } }
public void SetFrame(int f, Vector2 position) { currentFrame = f; spriteRenderer.sprite = frames[f]; if (playFootstepFrames[f]) { AudioClipPlayer.Play(footstepClip, Random.Range(0.9f, 1.1f), footstepVolume, position, audioClipPlayerPrefab); } }
public static void PlayEffect(AudioClip clip) { if (clip == null) { return; } AudioClipPlayer player = Instantiate(m_Instance.AudioClipPlayerPrefab, m_Instance.transform).GetComponent <AudioClipPlayer>(); player.Play(clip); }
// Token: 0x06001DE3 RID: 7651 RVA: 0x00175FD0 File Offset: 0x001741D0 private void SpinLeft() { if (!this.SpunLeft) { AudioClipPlayer.Play2D(this.WhipSound, base.transform.position, UnityEngine.Random.Range(0.9f, 1.1f)); this.StraightenWhip(); this.TargetRotation = -360f; this.Rotation = 0f; this.SpunLeft = true; } this.Character.GetComponent <Animation>().CrossFade("f02_yanvaniaWhip_Left", 0.1f); }
void Start() { input = GetComponent <PlayerInput>(); invincibilityAlternator = GetComponent <SpriteAlternator>(); spriteChanger = GetComponent <PlayerSpriteChanger>(); hurtboxes = GetComponentsInChildren <Hurtbox>(); health = GetComponent <Health>(); movement = GetComponent <PlayerMovement> (); audioPlayer = GetComponent <AudioClipPlayer>(); pickupController = GetComponent <PickupController>(); makeVulnerable(); }
public static void PlayEffect(EffectType type) { AudioClip clip = m_Instance.GetAudioClipForType(type); if (clip == null) { return; } AudioClipPlayer player = Instantiate(m_Instance.AudioClipPlayerPrefab, m_Instance.transform).GetComponent <AudioClipPlayer>(); player.Play(clip); }
private void ResetAndGoToShop() { isFlightActive = false; const float fadeDuration = 0.4f; AudioClipPlayer.FadeOutInGameMusic(fadeDuration * 0.5f); CanvasCoordinator.FadeOutAndIn(fadeDuration, () => { s_instance.ResetGame(); CanvasCoordinator.HideHudAndShowShopMenu(); AudioClipPlayer.FadeInMenuMusic(fadeDuration * 0.5f); }); }
void Awake() { feet = GetComponentInChildren<Feet>(); legs = GetComponentsInChildren<Leg>(); rbody = GetComponent<Rigidbody2D>(); face = GetComponentInChildren<Face>(); hat = GetComponentInChildren<Hat>(); _audio = GetComponent<AudioClipPlayer>(); _collider = GetComponent<CapsuleCollider2D>(); squishHitbox = GetComponentInChildren<SquishHitbox>(); achievementMgr = GetComponent<PlayerAchievementMgr>(); _transform = transform; }
/// <summary> /// Creates an AudioClipPlayer and plays it in a given world space. /// </summary> /// <param name="toPlay">The audio clip to be played.</param> /// <param name="position">The position in world space to play the audio from.</param> /// <param name="minVolume">The minimum volume of the clip. (To be combined with the audio managers volume modifier)</param> /// <param name="maxVolume">The maximum volume of the clip. (To be combined with the audio managers volume modifier)</param> /// <param name="minPitch">The minimum pitch of the clip.</param> /// <param name="maxPitch">The maximum pitch of the clip.</param> /// <param name="minPan">The minimum left to right pan of the clip.</param> /// <param name="maxPan">The maximum left to right pan of the clip.</param> public void PlayClipWorldSpace(AudioClip toPlay, Vector3 position, float minVolume = 1f, float maxVolume = 1f, float minPitch = 1f, float maxPitch = 1f, float minPan = 0f, float maxPan = 0f) { if (toPlay == null) { Debug.LogError("AudioManager cannot play a null clip in the world space position " + position.ToString()); return; } PooledObject obj = ObjectPoolingManager.instance.CreateObject(audioClipPlayer); obj.transform.position = position; AudioClipPlayer clipPlayer = obj.GetComponent <AudioClipPlayer>(); clipPlayer.PlaySoundRandom(toPlay, minVolume, maxVolume, minPitch, maxPitch, minPan, maxPan); }
/// <summary> /// Creates an AudioClipPlayer and plays it in local space. /// </summary> /// <param name="toPlay">The audio clip to be played.</param> /// <param name="minVolume">The minimum volume of the clip. (To be combined with the audio managers volume modifier)</param> /// <param name="maxVolume">The maximum volume of the clip. (To be combined with the audio managers volume modifier)</param> /// <param name="minPitch">The minimum pitch of the clip.</param> /// <param name="maxPitch">The maximum pitch of the clip.</param> /// <param name="minPan">The minimum left to right pan of the clip.</param> /// <param name="maxPan">The maximum left to right pan of the clip.</param> public void PlayClipLocalSpace(AudioClip toPlay, float minVolume = 1f, float maxVolume = 1f, float minPitch = 1f, float maxPitch = 1f, float minPan = 0f, float maxPan = 0f) { if (toPlay == null) { Debug.LogError("AudioManager cannot play a null clip in local space."); return; } PooledObject obj = ObjectPoolingManager.instance.CreateObject(audioClipPlayer, Camera.main.transform, -1); obj.transform.Reset(); AudioClipPlayer clipPlayer = obj.GetComponent <AudioClipPlayer>(); clipPlayer.PlaySoundRandom(toPlay, minVolume, maxVolume, minPitch, maxPitch, minPan, maxPan); }
// Token: 0x06001DEA RID: 7658 RVA: 0x00176210 File Offset: 0x00174410 private void OnTriggerEnter(Collider other) { if (other.gameObject.layer == 19 && !this.Destroyed) { UnityEngine.Object.Instantiate <GameObject>(this.Explosion, base.transform.position + Vector3.up * 0.5f, Quaternion.identity); this.Destroyed = true; AudioClipPlayer.Play2D(this.Break, base.transform.position); for (int i = 1; i < 11; i++) { UnityEngine.Object.Instantiate <GameObject>(this.Shard, base.transform.position + Vector3.up * UnityEngine.Random.Range(0f, 1f) + Vector3.right * UnityEngine.Random.Range(-0.5f, 0.5f), Quaternion.identity); } UnityEngine.Object.Destroy(base.gameObject); } }
private void Awake() { _camera = Camera.main; _rigidbody = GetComponent <Rigidbody2D>(); _playerHealth = GetComponent <IHealthSystem>(); _playerHealth.OnWaveDeath += playerHealth => { AudioClipPlayer.PlayAudioAtLocation(deathClip, transform.position); if (playerHealth.IsPermaDead) { StartCoroutine(nameof(SlowAndDeath)); } }; }
public void SetSessionScore() { targetScore = sessionData.Score; animateScore = true; if (targetScore > 0) { AudioClipPlayer.PlayScoreFill(); } #if DEBUG Debug.Log("Setting session score to " + targetScore); #endif }
public static void OnPlayerDeath(bool payRespects = true) { CanvasCoordinator.SetHudInteractable(false); AudioClipPlayer.PlayDeath(); s_instance.cameraShake.Shake(); if (payRespects) { var coroutine = PayRespects(2f, s_instance.ResetAndGoToShop); s_instance.StartCoroutine(coroutine); } else { s_instance.ResetAndGoToShop(); } }
void Start() { trailParticles = transform.Find("Trail").GetComponent <MultiParticleHandler>(); animator = transform.Find("Sprite").GetComponent <Animator>(); rigidbody = GetComponent <Rigidbody2D>(); sprite = transform.Find("Sprite").GetComponent <SpriteRenderer>(); gunSprite = sprite.transform.GetChild(0).GetComponentInChildren <SpriteRenderer>(); cam = Camera.main; animatorAudio = animator.GetComponent <AudioClipPlayer>(); if (trailActive) { SetTrailActive(false); } Invoke("DelayedStart", 0.1f); }
public void BuyMidasPotion() { const int price = 100; if (Player.State.Coins < price) { AudioClipPlayer.PlayIncorrect(); return; } Player.State.Coins -= price; Player.State.MidasPotions++; Cloud.Storage.Save(); AudioClipPlayer.PlayPotion(); midasCount.text = Player.State.MidasPotions.ToString(); }
IEnumerator Start() { particle = GetComponent <ParticleSystem>(); if (_onPlaySE) { audio = GetComponent <AudioClipPlayer>(); audio.Play(_clip); } // エフェクト再生が完了するまで待機 while (particle.isPlaying) { yield return(null); } Destroy(gameObject); }
private void OnToggleValueChanged(bool isOn) { switch (audioType) { case AudioType.Music: AudioClipPlayer.MuteMusic(isOn); break; case AudioType.Sfx: AudioClipPlayer.MuteSfx(isOn); break; default: throw new ArgumentOutOfRangeException(); } AudioClipPlayer.Instance.PlayClick(); PlayerSettings.Save(); }
private void OnTriggerEnter2D(Collider2D other) { string otherColliderTag = other.gameObject.tag; if ("Wall" == otherColliderTag) { Destroy(gameObject); AudioClipPlayer.PlayAudioAtLocation(soundWall, _transform.position, 0.5f); return; } if (_isDisabled) { return; } switch (otherColliderTag) { case "Player": case "Enemy": IHealthSystem otherHealthSystem = other.GetComponent <IHealthSystem>(); otherHealthSystem.DealDamage(damage); Destroy(gameObject); AudioClipPlayer.PlayAudioAtLocation(soundDamage, _transform.position); break; case "Mirror" when canBeDeflected: Transform mirrorTransform = other.transform; if (IsProjectileCollidingWithFrontOfMirror(mirrorTransform, _transform.position)) { Vector2 reflectionVector = Vector2.Reflect(transform.right, mirrorTransform.right); _transform.right = reflectionVector.normalized; _rigidbody2D.velocity = Vector2.zero; _rigidbody2D.AddForce(LaunchVector); DelayCollisions(); AudioClipPlayer.PlayAudioAtLocation(soundReflection, _transform.position, 0.5f); } break; } }
public static void PlayAudioAtLocation(AudioClip audioClip, Vector2 position, float volume = 1f) { if (!_initialized) { throw new InvalidOperationException($"{nameof(AudioClipPlayer)} has not been initialized"); } try { float _ = audioClip.length; } catch (Exception) { // Provided audio clip is 'null' (Unity AudioClips do not compare to null normally) return; } AudioClipPlayer player = Instantiate(_prefab, position, Quaternion.identity).GetComponent <AudioClipPlayer>(); player._audioClip = audioClip; player._volume = volume; }
private IEnumerator LoadNextWave() { AudioClipPlayer.PlayAudioAtLocation(waveDeathClip, transform.position); foreach (GameObject projectile in GameObject.FindGameObjectsWithTag("Projectile")) { Destroy(projectile); } yield return(new WaitForEndOfFrame()); print("Freezing Time"); Time.timeScale = 0; if (_waveCounter < gameObjectsToDisableOnEachWaveEnd.Count) { GameObject shellToFade = gameObjectsToDisableOnEachWaveEnd[_waveCounter]; SpriteRenderer shellSpriteRenderer = shellToFade.GetComponent <SpriteRenderer>(); Color color = shellSpriteRenderer.color; for (float alpha = 1; alpha >= 0; alpha -= 0.05f) { shellSpriteRenderer.color = new Color(color.r, color.g, color.b, alpha); yield return(new WaitForSecondsRealtime(0.1f)); } shellToFade.SetActive(false); } _waveCounter++; yield return(new WaitForSecondsRealtime(0.25f)); print("Resuming time"); Time.timeScale = 1f; ScheduleCurrentWaveAttackPatterns(); StopCoroutine(nameof(LoadNextWave)); }
private void OnValueChanged(float volume) { if (ignoreValueChanged) { return; } switch (audioType) { case AudioType.Music: AudioClipPlayer.SetMusicVolume(volume); break; case AudioType.Sfx: AudioClipPlayer.SetSfxVolume(volume); break; default: throw new ArgumentOutOfRangeException(); } PlayerSettings.Save(); }
// Use this for initialization void Start() { theseusTributes = 0; minotaurTributes = 0; spawner.SpawnTributes(numTributes); StartPoint start = startingPoints[Random.Range(0,startingPoints.Length-1)]; HeroController theseus = ((GameObject)Instantiate(theseusPrefab, start.startingNavPoint.position, Quaternion.identity)).GetComponent<HeroController>(); theseus.startPoint = start; theseusGetSounds = theseus.transform.FindChild("GetSounds").GetComponent<AudioClipPlayer>(); }