IEnumerator Start(){ soundManager=SoundManager._instance; uiManager=UIManager._instance; saveDataManager=SaveDataManager.instance_; volcanoEyeManager=VolcanoEyeManager._instance; endText.SetActive(false); yield return new WaitForSeconds (0.5f); while( true ){ if (Input.GetMouseButtonDown (0)) { print("preiosno"); break; } yield return 0; } instance = this; for( int i = 0; i < spawnPointsParent.transform.childCount; i++){ spawnPoints.Add( spawnPointsParent.transform.GetChild(i)); } currentLives = lives; personPrefab = Resources.Load ("PersonPrefab") as GameObject; loadGame(); }
void Awake() { player = FindObjectOfType<PlayerPhysicsBehaviour>(); soundManager = FindObjectOfType<SoundManager>(); // clean cache GetComponentCache.ClearCache(); }
public MainWindow() { InitializeComponent(); _samples = new ValueHolder<short[]>(); _samplingRate = new ValueHolder<int>(); _soundManager = new SoundManager(); _soundManager.NewSamples += HandleNewSamples; _soundManager.StartRecording(0, 30); _samplingRate.Value = _soundManager.SamplingRate; _soundVisualizerVM = new SoundVisualizerVM(_samples, _samplingRate); _soundVisualizer = new SoundVisualizerControl(_soundVisualizerVM); //MainGrid.Children.Add(_soundVisualizer); _scene = new WPF3DScene(); MainGrid.Children.Add(_scene); _model = Create3DModel(); _scene.AddModel(_model); AddUIP3DPlane(); _soundVisualizerVM.AverageAmplitudeFromLastSampling.PropertyChanged += HandleAverageAmplitudeChanged; DeviceButton.Click += DeviceButton_Click; DeviceButton.Content = _soundManager.GetAvailableDevices().Keys.First().ProductName; }
//private bool destroyed = false; void Start(){ soundManager = gameObject.GetComponentInChildren<SoundManager>(); energy = maxEnergy; score = FindObjectOfType(typeof(ScoreKeeper)) as ScoreKeeper; playerControl = gameObject.GetComponentInChildren<PlayerControl>(); playerGUI = gameObject.GetComponentInChildren<PlayerGUI>(); playerHealth = gameObject.GetComponentInChildren<PlayerHealth>(); thrust = gameObject.GetComponentInChildren<Thrust>(); shield = gameObject.AddComponent<Shield>() as Shield; shield.PDelegate = this; foreach(Weapon weapon in gameObject.GetComponentsInChildren(typeof(IWeapon))){ if(weapon.gameObject.name == "Left weapon"){ leftWeapon = weapon; leftWeapon.soundManager = soundManager; }else if(weapon.gameObject.name == "Right weapon"){ rightWeapon = weapon; rightWeapon.soundManager = soundManager; } } StartCoroutine("RegenerateEnergy"); }
void Start() { m_SoundManager = SoundManager.Instance; if (m_PlayOnStart) PlayMusic(); }
// Use this for initialization void Start() { DontDestroyOnLoad(gameObject); mutebutton = null; _SoundManager = this; }
public SoundConnection(string lvl, SoundManager.PlayMethod method, params AudioClip[] audioList) { level = lvl; isCustomLevel = false; playMethod = method; switch(playMethod) { case SoundManager.PlayMethod.ContinuousPlayThrough: case SoundManager.PlayMethod.OncePlayThrough: case SoundManager.PlayMethod.ShufflePlayThrough: break; default: Debug.LogWarning("No delay was set in the constructor so there will be none."); break; } minDelay = 0f; maxDelay = 0f; delay = 0f; soundsToPlay = new List<AudioClip>(); baseVolumes = new List<float>(); foreach(AudioClip audio in audioList) { if(!soundsToPlay.Contains(audio)) { soundsToPlay.Add(audio); baseVolumes.Add(1f); } } }
public static SoundManager GetInstance() { if (_instance == null) { _instance = GameObject.FindObjectOfType<SoundManager>(); } return _instance; }
void Awake() { if (ins == null) { ins = this; DontDestroyOnLoad(gameObject); } else { Destroy(gameObject); } if (audioSource == null) audioSource = gameObject.GetComponent<AudioSource>(); }
// Use this for initialization void Awake () { audio = this.gameObject.GetComponents<AudioSource>(); playMainTheme(); _instance=this; }
// Use this for initialization void Start() { curtain = GameObject.Find ("Curtain").GetComponent<Curtain> (); isSelected = false; maxStageIndex = SaveData.GetAvailableStage () - 1; stageNameText = GameObject.Find ("StageName").GetComponent<Text> (); stageNumberText = GameObject.Find ("StageNumber").GetComponent<Text> (); bestTimeText = GameObject.Find ("BestTime").GetComponent<Text> (); rightText = GameObject.Find ("Right").GetComponent<Text> (); leftText = GameObject.Find ("Left").GetComponent<Text> (); newStageNoticeText = GameObject.Find ("NewStageNotice").GetComponent<Text> (); soundManager = GameObject.Find ("Sounds").GetComponent<SoundManager> (); keyConfig = KeyConfig.Current; mainCamera = GameObject.Find("Main Camera"); skyboxes = new Material[] { GalaxySkybox, NightSkybox, GalaxySkybox, PinkSkybox, BlueSkybox }; stages = new Stage[] { new Stage1(), new Stage2(), new Stage3(), new Stage4(), new Stage5() }; courses = new Mesh[] { stages [0].CreateFloorsFactory ().CreateFloorList (null).Mesh, stages [1].CreateFloorsFactory ().CreateFloorList (null).Mesh, stages [2].CreateFloorsFactory ().CreateFloorList (null).Mesh, stages [3].CreateFloorsFactory ().CreateFloorList (null).Mesh, stages [4].CreateFloorsFactory ().CreateFloorList (null).Mesh }; if (UserInterface.IsAvailableStageInclemented) { stageIndex = SaveData.GetAvailableStage () - 1; newStageNoticeText.enabled = true; } else { stageIndex = 0; newStageNoticeText.enabled = false; } isSelected = false; isReturn = false; changeStage(); }
void Start() { buttonReleaseScript = GameObject.Find("ButtonRelease").GetComponent<ButtonReleased>(); inGameUI = GameObject.Find("InGameUIManager").GetComponent<InGameUIManager>(); nappyPadSpawnerObj = GameObject.Find("NappyPadSpawner"); if(nappyPadSpawnerObj != null) { nappyPadSpawnerScript = nappyPadSpawnerObj.GetComponent<NappyPadSpawner>(); } nappyPadSpawnerScript.nappyPadCount++; if(!inGameUI.firstNappy) { if(inGameUI.isLevel1) { inGameUI.Enable("PlayerButtonTutorialLabel5"); inGameUI.Enable("LeftArrow"); inGameUI.firstNappy = true; } } sm = GameObject.Find("SoundManager").GetComponent<SoundManager>(); }
void Awake() { instance = this; if (PlayerPrefs.HasKey(IS_SOUND_ENABLED_KEY)) IsSoundEnabled = (bool) SaveTools.LoadFromPlayerPrefs(IS_SOUND_ENABLED_KEY); else IsSoundEnabled = true; }
// Use this for initialization void Awake () { if (instance == null) instance = this; else if (instance != this) Destroy(gameObject); DontDestroyOnLoad(gameObject); }
void Awake() { if(instance != null) { if(this.gameAudio) { Game.soundManager = instance; instance.PlayLoopingTheme(1); } else instance.PlayLoopingTheme(0); Destroy(this.gameObject); } else { instance = this; DontDestroyOnLoad(this); if(this.gameAudio) { Game.soundManager = instance; PlayLoopingTheme(1); } else PlayLoopingTheme(0); } }
public void Enable() { enabled = (PrefabUtility.GetPrefabType(proxy.target) != PrefabType.Prefab); script = proxy.target as SoundManager; mObject = new SerializedObject(proxy.target); mCrossDuration = mObject.FindProperty("crossDuration"); mShowDebug = mObject.FindProperty("showDebug"); mOffBGM = mObject.FindProperty("offTheBGM"); mSoundConnectionsCount = mObject.FindProperty(mListCountPath); if(script.GetComponent<Transform>().hideFlags != HideFlags.HideInInspector) script.GetComponent<Transform>().hideFlags = HideFlags.NotEditable | HideFlags.HideInInspector; if(script.storage == null) { script.storage = ScriptableObject.CreateInstance<EditorVariableStorage>(); script.storage.hideFlags = HideFlags.HideAndDontSave; } CheckNullMonoBehaviours(); EnableSFX(); init(); if(!script.storage.titleBar) script.storage.titleBar = Resources.LoadAssetAtPath ("Assets/Gizmos/TitleBar.png", typeof(Texture2D)) as Texture2D; if(!script.storage.footer) script.storage.footer = Resources.LoadAssetAtPath ("Assets/Gizmos/AntiLunchBox Logo.png", typeof(Texture2D)) as Texture2D; if(!script.storage.icon) script.storage.icon = Resources.LoadAssetAtPath ("Assets/Gizmos/SoundManager Icon.png", typeof(Texture2D)) as Texture2D; HideVariables(); }
void Awake() { player = GameObject.Find("Player(Goliath)").GetComponent<Transform>(); PlayerAnim = GameObject.Find("Player(Goliath)").GetComponent<PlayerMovement>(); sound = GameObject.Find("Handeler").GetComponent<SoundManager>(); }
/*=========================== Methods ===================================================*/ /*=========================== Awake() ===================================================*/ void Awake(){ // to make sure only one version of SoundManager exisits // to enforce singleton patern if (soundManager == null) { // don't destroy gameobject when moving scenes DontDestroyOnLoad (gameObject); // set the reference to this object soundManager = this; } else if (soundManager != this) { // if the singleton already exists // destroy this object Destroy(gameObject); } // if // get a reference to the audio source source = GameObject.Find("MusicPlayer").GetComponentInChildren<AudioSource> (); // set its volume source.volume = sourceVol; // reference clips } // Awake()
// Use this for initialization void Start() { player = GameObject.FindGameObjectWithTag("Player").transform; soundManager = GameObject.FindObjectOfType<SoundManager>(); world = GameObject.FindGameObjectWithTag("World").GetComponent("World") as World; currentClip = -1; newAudio = null; timeTransitioning = false; wallTransitioning = false; timerTimeTransition1 = 0.0f; timerWallTransition1 = 0.0f; timerTimeTransition2 = 0.0f; timerWallTransition2 = 0.0f; transitionToDay = false; transitionToNight = false; transitionToDayFiltered = false; transitionToNightFiltered = false; endingTransition = false; canEndTransition = false; otherLayerMask = ~otherLayerMask; transitionFrom = TRANSITION_FROM_DAY; defaultSource = GetComponents<AudioSource>()[0]; transitionSource = GetComponents<AudioSource>()[1]; }
// Setting up references void Awake() { obstacleSpawner = GameObject.FindGameObjectWithTag("ObstacleSpawner").GetComponent<ObstacleSpawner>(); pickupSpawner = GameObject.FindGameObjectWithTag("PickupSpawner").GetComponent<PickupSpawner>(); soundManager = GameObject.FindGameObjectWithTag("SoundManagerGO").GetComponent<SoundManager>(); playerControls = player.GetComponent<CharacterUserControls>(); }
public static SoundManager getInstance() { if (instance == null) { instance = GameObject.Find("MainCamera").GetComponent<SoundManager>(); } return instance; }
// Use this for initialization void Start() { soundManager = GameObject.FindGameObjectWithTag("SoundManager").GetComponent<SoundManager>(); AudioSource audioSources = GetComponent<AudioSource>(); soundManager.PlaySound(audioSources); timer = Time.time + secondsToLive; }
void Awake() { gameManager = GameObject.Find("GameManager").GetComponent<GameManager>(); soundManager = GameObject.Find("SoundManager").GetComponent<SoundManager>(); effectManager = GameObject.Find("EffectManager").GetComponent<EffectManager>(); common = GameObject.Find("Common").GetComponent<Common>(); }
void Start() { var id = GetComponent<Identificationer>().id; hp = FindObjectOfType<AirFrameParameter>().GetMaxHP(id); MAX_HP = hp; sound_manager_ = FindObjectOfType<SoundManager>(); }
void Awake() { if (instance == null) instance = this; else if (instance != null) Destroy(gameObject); }
// Use this for initialization void Start() { soundmanager = GameObject.Find("SoundManager").GetComponent<SoundManager>(); IntroAnimation = GameObject.Find("IntroAnimation"); GUIManager = GameObject.Find("GUIManager").GetComponent<GUIScript>(); soundmanager.PlayAudioClip(soundmanager.IntroBGM, soundmanager.Volum_IntroBGM); }
// Use this for initialization void Start() { curtain = GameObject.Find ("Curtain").GetComponent<Curtain> (); soundManager = GameObject.Find ("Sounds").GetComponent<SoundManager> (); GameObject.Find ("MaoudamasiiLink").GetComponent<Button> ().onClick.AddListener(() => { Application.OpenURL("http://maoudamashii.jokersounds.com/"); }); GameObject.Find ("JapaneseSushiLink").GetComponent<Button> ().onClick.AddListener(() => { Application.OpenURL("https://www.assetstore.unity3d.com/jp/#!/content/37401"); }); GameObject.Find ("NebulaLink").GetComponent<Button> ().onClick.AddListener(() => { Application.OpenURL("https://www.assetstore.unity3d.com/jp/#!/content/2967"); }); GameObject.Find ("ToonySkiesLink").GetComponent<Button> ().onClick.AddListener(() => { Application.OpenURL("https://www.assetstore.unity3d.com/jp/#!/content/11020"); }); GameObject.Find ("FurnitureLink").GetComponent<Button> ().onClick.AddListener(() => { Application.OpenURL("https://www.assetstore.unity3d.com/jp/#!/content/11859"); }); GameObject.Find ("HorseLink").GetComponent<Button> ().onClick.AddListener(() => { Application.OpenURL("https://www.assetstore.unity3d.com/jp/#!/content/16687"); }); GameObject.Find ("AkibaLink").GetComponent<Button> ().onClick.AddListener(() => { Application.OpenURL("https://www.assetstore.unity3d.com/jp/#!/content/20359"); }); GameObject.Find ("UnityLink").GetComponent<Button> ().onClick.AddListener(() => { Application.OpenURL("http://unity3d.com/"); }); GameObject.Find ("MyLink").GetComponent<Button> ().onClick.AddListener(() => { Application.OpenURL("https://twitter.com/ye_ey"); }); keyConfig = KeyConfig.Current; isFinished = false; }
void Awake() { appManager = GetComponent<AppManager>(); guiManager = GetComponent<GUIManager>(); gameplayManager = GetComponent<GameplayManager>(); soundManager = GetComponent<SoundManager>(); }
// Use this for initialization void Awake () { //DontDestroyOnLoad(this); instance = this; if (mAudioClips.Length != (int)SoundClips.soundMax) { Debug.Log("sound manager not synced !!"); } }
public void Initialize( SoundManager.ClipData data ) { refAudioSource = GetComponent<AudioSource>(); refAudioSource.clip = data.clip; var soundManager = SoundManager.Instance; refAudioSource.volume = data.volume * soundManager.masterVolume * soundManager.SEVolume; }
// Main Ingame Menu Functions // ================================================== /// <summary> /// Opens a specific menu panel. /// </summary> /// <param name="nextMenuPanel">Menu panel to open</param> public void OpenMenuPanel(GameObject nextMenuPanel) { SoundManager.Play(SingletonSOSounds.Instance.Click01); Logger.Log("Opening " + nextMenuPanel.name + " menu", Category.UI); nextMenuPanel.SetActive(true); }
void Awake() { soundManager = SoundManager.Get(); }
public void GameOver() { m_SceneHandler.LoadSceneByNameSingle("Game Over"); SoundManager.Instance().StopMusic(); }
private void OnMassDisenchantButtonOver(UIEvent e) { this.m_highlight.ChangeState(ActorStateType.HIGHLIGHT_MOUSE_OVER); SoundManager.Get().LoadAndPlay("Hub_Mouseover"); }
public WaveLoader(SoundManager manager) { _manager = manager; }
void LateStart() { sm = FindObjectOfType <SoundManager>(); }
public MeleeAttackApplication(MeleeAttackEntity meleeAttackEntity, SoundManager soundManager) { this.meleeAttackEntity = meleeAttackEntity; this.soundManager = soundManager; }
protected override void Initialize() { base.Initialize(); this.IsMouseVisible = true; //Map Related enumMapData = new EnumMapData(); demoLevelMapData25x25 = new MapData(GameLevel.DEMO25x25); demoLevelMapData25x25.InitializeMapData(); demoMapTileWidth = demoLevelMapData25x25.GetMapTileWidth(); demoMapTileHeight = demoLevelMapData25x25.GetMapTileHeight(); //Camera cameraView = new Camera2D(); cameraView.SetBoundary(0, 0, ((demoMapTileWidth - squaresAcross) * pixelWidthPerTile), ((demoMapTileHeight - squaresDown) * pixelHeightPerTile)); //Key And Locks staticObjectHandler = new StaticObjectHandler(demoLevelMapData25x25); key = staticObjectHandler.GetKeys(); doorLock = staticObjectHandler.GetLocks(); spellItem = staticObjectHandler.GetSpellItems(); //Player player = new Player(); player.SetMapReference(demoLevelMapData25x25); player.SetTilePosition(1, 1); player.SetUpLockInformation(doorLock); //Wizard wizard = new Wizard(); wizard.SetMapReference(demoLevelMapData25x25); wizard.SetTilePosition(12, 4); //Minions array minions = new Minion[5]; int[][] minionsInitialPatrolData = new int[5][] { new int[] { 4, 1, 5, 6 }, new int[] { 4, 15, 5, 6 }, new int[] { 16, 1, 10, 10 }, new int[] { 20, 15, 4, 5 }, new int[] { 11, 8, 7, 7 } }; for (int i = 0; i < minions.Length; i++) { minions[i] = new Minion(); minions[i].SetMinionId(i); minions[i].SetMapReference(demoLevelMapData25x25); minions[i].SetPatrolStartPos(minionsInitialPatrolData[i]); minions[i].SetTilePosition(minionsInitialPatrolData[i][0], minionsInitialPatrolData[i][1]); } gameIsOver = false; minutesPlaying = 0; secondsPlaying = 0.0f; //Sound soundManager = new SoundManager(this.Content); playGameBGMOnlyOnce = true; playGameOverOnlyOnce = true; playButtonOnlyOnce = true; playPickUpOnlyOnce = true; playUnlockDoorOnlyOnce = new bool[] { true, true, true, true }; playerPickUpSomething = false; footStepTimer = 0.0f; }
public override void ButtonEffect() { print("Volume Up Button"); SoundManager.volumeUp(); }
/// <returns>Damage in excess of the tile's current health, 0 if tile was not destroyed or health equaled /// damage done.</returns> private float DoDamageInternal(Vector3Int cellPos, float dmgAmt, Vector3 worldPos, AttackType attackType) { MetaDataNode data = metaDataLayer.Get(cellPos); //look up layer tile so we can calculate damage var layerTile = metaTileMap.GetTile(cellPos); if (layerTile is BasicTile basicTile) { //TODO: Incorporate more resistance, not just indestructible //determine damage resistance if (basicTile.Resistances.Indestructable) { return(0); } dmgAmt = basicTile.Armor.GetDamage(dmgAmt, attackType); } if (Layer.LayerType == LayerType.Walls) { if (metaTileMap.HasTile(cellPos, LayerType.Walls, true)) { // SoundManager.PlayNetworkedAtPos( "WallHit", worldPos, Random.Range( 0.9f, 1.1f ) ); return(AddWallDamage(dmgAmt, data, cellPos, worldPos, attackType)); } } if (Layer.LayerType == LayerType.Windows) { if (metaTileMap.HasTile(cellPos, LayerType.Windows, true)) { SoundManager.PlayNetworkedAtPos("GlassHit", worldPos, Random.Range(0.9f, 1.1f)); return(AddWindowDamage(dmgAmt, data, cellPos, worldPos, attackType)); } } if (Layer.LayerType == LayerType.Grills) { //Make sure a window is not protecting it first: if (!metaTileMap.HasTile(cellPos, LayerType.Windows, true)) { if (metaTileMap.HasTile(cellPos, LayerType.Grills, true)) { SoundManager.PlayNetworkedAtPos("GrillHit", worldPos, Random.Range(0.9f, 1.1f)); return(AddGrillDamage(dmgAmt, data, cellPos, worldPos, attackType)); } } } if (Layer.LayerType == LayerType.Objects) { if (metaTileMap.GetTile(cellPos, LayerType.Objects)?.TileType == TileType.Table) { // SoundManager.PlayNetworkedAtPos( "TableHit", worldPos, Random.Range( 0.9f, 1.1f ) ); return(AddTableDamage(dmgAmt, data, cellPos, worldPos, attackType)); } } if (Layer.LayerType == LayerType.Floors) { if (metaTileMap.HasTile(cellPos, LayerType.Floors, true)) { // SoundManager.PlayNetworkedAtPos( "FloorHit", worldPos, Random.Range( 0.9f, 1.1f ) ); return(AddFloorDamage(dmgAmt, data, cellPos, worldPos, attackType)); } } if (Layer.LayerType == LayerType.Base) { if (metaTileMap.HasTile(cellPos, LayerType.Base, true)) { // SoundManager.PlayNetworkedAtPos( "FloorHit", worldPos, Random.Range( 0.9f, 1.1f ) ); return(AddPlatingDamage(dmgAmt, data, cellPos, worldPos, attackType)); } } return(dmgAmt); }
private IEnumerator DelayLandingSFX() { yield return(WaitFor.Seconds(TRAVEL_TIME - 1)); SoundManager.PlayAtPosition("RocketLand", WorldPosition, sourceObj: gameObject); }
public override void Initialize() { base.Initialize(); m_SoundManager = Game.Services.GetService(typeof(SoundManager)) as SoundManager; }
private Vector3 cameraPosition; // 5 // Start is called before the first frame update void Awake() { Instance = this; // 1 cameraPosition = Camera.main.transform.position; // 2 }
/// <summary> /// Closes a specific menu panel. /// </summary> /// <param name="thisPanel">The menu panel to close.</param> public void CloseMenuPanel(GameObject thisPanel) { SoundManager.Play(SingletonSOSounds.Instance.Click01); Logger.Log("Closing " + thisPanel.name + " menu", Category.UI); thisPanel.SetActive(false); }
public void OnHit(Hammer hammer) { Debug.Log("Hit Nail"); if (_nailState == NailStates.Holding && _stateHolding) { if (!Game.instance.board.IsOnBoard(transform)) { Debug.Log("Nail needs to be on board"); _nailState = NailStates.Destroyed; Game.instance.boardStatus.RemoveNail(this); SoundManager.PlaySound(SoundEffects.NAILBROKE); return; } if (Physics.Raycast(rigid.position, -transform.up, out RaycastHit hit, 1000.0f, movementMask)) { hit.transform.gameObject.GetComponent <Plank>().AddNail(this); Debug.Log("First Hit on Nail"); _hitCounter++; _nailState = NailStates.ABitInWall; //Push Nail in Wall gameObject.transform.localPosition += nailStep; return; } Debug.Log("No Plank behind!"); _nailState = NailStates.Destroyed; Game.instance.boardStatus.RemoveNail(this); return; } if (_nailState == NailStates.ABitInWall && _stateHolding) { _hitCounter++; if (_hitCounter >= timesToHit) { Debug.Log("Nail fixed in wall"); _nailState = NailStates.Fixed; //Push Nail in Wall SoundManager.PlaySound(SoundEffects.SUCCESS); gameObject.transform.localPosition += nailStep; Game.instance.boardStatus.RemoveNail(this); } else { Debug.Log("Nail got punshed more into wall"); } return; } if (_nailState == NailStates.Destroyed) { Debug.Log("Can't hit a destroyed nail"); Game.instance.boardStatus.RemoveNail(this); SoundManager.PlaySound(SoundEffects.NAILBROKE); } if (_nailState == NailStates.Fixed) { Debug.Log("Already in wall!"); } }
/// <summary> /// Get selected component from game /// </summary> void GetComponents() { sound = FindObjectOfType <SoundManager>(); }
public override void ActivateItem(Player player) { player.Health.AddArmorHP(m_ArmorValue); SoundManager.GetInstance().photonView.RPC("PlaySFXNetworked", PhotonTargets.All, "ArmorGain", player.transform.position); }
private void Start() { sfx = GameObject.FindGameObjectWithTag("SoundManager").GetComponent <SoundManager>(); }
/// <summary> /// Buy the selected item /// </summary> public void BuySelectedItem() { PersistanceManager pm = PersistanceManager.GetInstance(); PlayerController player = GameObject.FindWithTag("Player").GetComponent <PlayerController>(); switch (selectedItemIndex) { case 0: // Refill health if (player.hitpoints < player.hitpointsMax && player.coins >= 2) { player.AddCoins(-2); player.AddHealth(1); SoundManager.GetInstance().Play(purchaseClip); } else { SoundManager.GetInstance().Play(errorClip); } break; case 1: // Health upgrade if (pm.playerStatHealth < 5 && player.coins >= GetNextLevelPrice(pm.playerStatHealth)) { player.AddCoins(-GetNextLevelPrice(pm.playerStatHealth)); pm.playerStatHealth++; player.UpdateStats(); player.AddHealth(1); SoundManager.GetInstance().Play(purchaseClip); } else { SoundManager.GetInstance().Play(errorClip); } break; case 2: // Strength upgrade if (pm.playerStatStrength < 5 && player.coins >= GetNextLevelPrice(pm.playerStatStrength)) { player.AddCoins(-GetNextLevelPrice(pm.playerStatStrength)); pm.playerStatStrength++; player.UpdateStats(); SoundManager.GetInstance().Play(purchaseClip); } else { SoundManager.GetInstance().Play(errorClip); } break; case 3: // Speed upgrade if (pm.playerStatSpeed < 5 && player.coins >= GetNextLevelPrice(pm.playerStatSpeed)) { player.AddCoins(-GetNextLevelPrice(pm.playerStatSpeed)); pm.playerStatSpeed++; player.UpdateStats(); SoundManager.GetInstance().Play(purchaseClip); } else { SoundManager.GetInstance().Play(errorClip); } break; case 4: // Tenacity upgrade if (pm.playerStatTenacity < 5 && player.coins >= GetNextLevelPrice(pm.playerStatTenacity)) { player.AddCoins(-GetNextLevelPrice(pm.playerStatTenacity)); pm.playerStatTenacity++; player.UpdateStats(); SoundManager.GetInstance().Play(purchaseClip); } else { SoundManager.GetInstance().Play(errorClip); } break; case 5: // Luck upgrade if (pm.playerStatLuck < 5 && player.coins >= GetNextLevelPrice(pm.playerStatLuck)) { player.AddCoins(-GetNextLevelPrice(pm.playerStatLuck)); pm.playerStatLuck++; player.UpdateStats(); SoundManager.GetInstance().Play(purchaseClip); } else { SoundManager.GetInstance().Play(errorClip); } break; } UpdateShop(); }
private void Start() { soundManager = SoundManager.instance; audioSource = GetComponent <AudioSource> (); player = PlayerManager.instance.player.transform; }
// 優化インターフェース void Scan() { SoundManager.DisableOverAudio();// }
/// <summary> /// Show the previous item in the shop catalogue /// </summary> public void ShowPreviousItem() { SoundManager.GetInstance().Play(selectClip); selectedItemIndex = (selectedItemIndex + imagesItems.Length - 1) % imagesItems.Length; UpdateShop(); }
void Start() { sManager = (SoundManager)GameManagerBase.instance.getSFX().script; }
private void OnTriggerEnter2D(Collider2D collision) { Score.score++; SoundManager.PlaySound("score"); }
protected virtual void PlayAudio(string audioID) { SoundManager.PlayAudioWithDistance(audioID, null, transform, 24.0f, -1.0f, 1.0f, false); }
public override void Enter() { SoundManager.PlayMusic(m_MenuMusic); StartCoroutine(BlinkRoutine()); }
public override void PlayLaunchSound() { SoundManager.PlaySound(SoundManager.Sound.Fluffy, transform.position); }
public void ServerPerformMeleeAttack(GameObject victim, Vector2 attackDirection, BodyPartType damageZone, LayerType layerType) { if (Cooldowns.IsOnServer(playerScript, CommonCooldowns.Instance.Melee)) { return; } var weapon = playerScript.playerNetworkActions.GetActiveHandItem(); var tiles = victim.GetComponent <InteractableTiles>(); if (tiles) { //validate based on position of target vector if (!Validations.CanApply(playerScript, victim, NetworkSide.Server, targetVector: attackDirection)) { return; } } else { //validate based on position of target object if (!Validations.CanApply(playerScript, victim, NetworkSide.Server)) { return; } } if (!playerMove.allowInput || playerScript.IsGhost || !victim || !playerScript.playerHealth.serverPlayerConscious ) { return; } var isWeapon = weapon != null; ItemAttributesV2 weaponAttr = isWeapon ? weapon.GetComponent <ItemAttributesV2>() : null; var damage = isWeapon ? weaponAttr.ServerHitDamage : fistDamage; var damageType = isWeapon ? weaponAttr.ServerDamageType : DamageType.Brute; var attackSound = isWeapon ? weaponAttr.ServerHitSound : null; LayerTile attackedTile = null; bool didHit = false; ItemAttributesV2 weaponStats = null; if (isWeapon) { weaponStats = weapon.GetComponent <ItemAttributesV2>(); } // If Tilemap LayerType is not None then it is a tilemap being attacked if (layerType != LayerType.None) { var tileChangeManager = victim.GetComponent <TileChangeManager>(); if (tileChangeManager == null) { return; //Make sure its on a matrix that is destructable } //Tilemap stuff: var tileMapDamage = victim.GetComponentInChildren <MetaTileMap>().Layers[layerType].gameObject .GetComponent <TilemapDamage>(); if (tileMapDamage != null) { if (isWeapon && weaponStats != null && weaponStats.hitSoundSettings == SoundItemSettings.OnlyObject) { attackSound = null; } var worldPos = (Vector2)transform.position + attackDirection; attackedTile = tileChangeManager.InteractableTiles.LayerTileAt(worldPos, true); tileMapDamage.ApplyDamage((int)damage, AttackType.Melee, worldPos); didHit = true; } } else { //a regular object being attacked LivingHealthBehaviour victimHealth = victim.GetComponent <LivingHealthBehaviour>(); var integrity = victim.GetComponent <Integrity>(); var meleeable = victim.GetComponent <Meleeable>(); if (integrity != null) { if (meleeable.GetMeleeable()) { //damaging an object if (isWeapon && weaponStats != null && weaponStats.hitSoundSettings == SoundItemSettings.Both) { AudioSourceParameters audioSourceParameters = new AudioSourceParameters(pitch: Random.Range(0.9f, 1.1f)); SoundManager.PlayNetworkedAtPos(integrity.soundOnHit, gameObject.WorldPosServer(), audioSourceParameters, sourceObj: gameObject); } else if (isWeapon && weaponStats != null && weaponStats.hitSoundSettings == SoundItemSettings.OnlyObject && integrity.soundOnHit == null) { AudioSourceParameters audioSourceParameters = new AudioSourceParameters(pitch: Random.Range(0.9f, 1.1f)); SoundManager.PlayNetworkedAtPos(integrity.soundOnHit, gameObject.WorldPosServer(), audioSourceParameters, sourceObj: gameObject); attackSound = null; } integrity.ApplyDamage((int)damage, AttackType.Melee, damageType); didHit = true; } } else { //damaging a living thing var rng = new System.Random(); // This is based off the alien/humanoid/attack_hand punch code of TGStation's codebase. // Punches have 90% chance to hit, otherwise it is a miss. if (isWeapon || 90 >= rng.Next(1, 100)) { if (victimHealth == null || gameObject == null) { return; } // The attack hit. victimHealth.ApplyDamageToBodypart(gameObject, (int)damage, AttackType.Melee, damageType, damageZone); didHit = true; } else { // The punch missed. string victimName = victim.Player()?.Name; SoundManager.PlayNetworkedAtPos(SingletonSOSounds.Instance.PunchMiss, transform.position, sourceObj: gameObject); Chat.AddCombatMsgToChat(gameObject, $"You attempted to punch {victimName} but missed!", $"{gameObject.Player()?.Name} has attempted to punch {victimName}!"); } } } //common logic to do if we hit something if (didHit) { if (attackSound != null) { SoundManager.PlayNetworkedAtPos(attackSound, transform.position, sourceObj: gameObject); } if (damage > 0) { Chat.AddAttackMsgToChat(gameObject, victim, damageZone, weapon, attackedTile: attackedTile); } if (victim != gameObject) { RpcMeleeAttackLerp(attackDirection, weapon); //playerMove.allowInput = false; } } Cooldowns.TryStartServer(playerScript, CommonCooldowns.Instance.Melee); }
public void LevelComplete() { m_SceneHandler.LoadSceneByNameSingle("Level Complete"); SoundManager.Instance().StopMusic(); }
public void Upgrade_Delete() { SoundManager.Get().PlaySoundCue("MenuClick"); GameState.Get().DeleteSelectedTower(); }