private void Start() { this._layerMask = 1050625; base.enabled = false; this._playerSfx = this._player.GetComponent <PlayerSfx>(); this._placeIconSheen.SetActive(false); }
private IEnumerator ActivateRoutine() { beam.startWidth = beam.endWidth = aimBeamWidth; beam.enabled = true; var fireTime = Conductor.GetNextNote(preFireNoteTime, preFireNoteOffset); StartCoroutine(Aim(fireTime)); StartCoroutine(Spin(fireTime)); yield return(new WaitForNote(preFireNoteTime, preFireNoteOffset - 1)); var waitTime = Conductor.GetNextNote(preFireNoteTime) - Conductor.noteDurations[Note.Thirtysecond]; yield return(new WaitForDspTime(waitTime)); PlayerSfx.PlayShootSfx(); yield return(Fire()); Destroy(gameObject); // if (hits > 0) // { // var hitDetector = hitBuffer[0].collider.gameObject.GetComponent<HitDetector>(); // if (hitDetector != null) hitDetector.Hit(Hit.Shot, direction); // } GameObject.Destroy(gameObject); }
public void PlayBuildingRepair(GameObject building) { if (FMOD_StudioSystem.instance) { Vector3 position = PlayerSfx.FindClosestPoint(building, base.transform.position); FMOD_StudioSystem.instance.PlayOneShot(this.HammerEvent, position, null); } }
private void Update() { if (this.Remote) { return; } PLAYBACK_STATE pLAYBACK_STATE = PLAYBACK_STATE.STOPPED; if (this.musicTrack != null) { UnityUtil.ERRCHECK(this.musicTrack.getPlaybackState(out pLAYBACK_STATE)); } if (pLAYBACK_STATE != PLAYBACK_STATE.STOPPED) { PlayerSfx.MusicPlaying = true; } else { PlayerSfx.MusicPlaying = false; } if (base.transform.hasChanged) { base.transform.hasChanged = false; ATTRIBUTES_3D attributes = UnityUtil.to3DAttributes(this.SfxPlayer, null); PlayerSfx.Set3DAttributes(this.staminaBreathInstance, attributes); PlayerSfx.Set3DAttributes(this.walkyTalkyInstance, attributes); PlayerSfx.Set3DAttributes(this.musicTrack, attributes); PlayerSfx.Set3DAttributes(this.afterStormInstance, this.SfxPlayer.transform.position.to3DAttributes()); } if (this.afterStormInstance != null && !this.afterStormInstance.isValid()) { this.afterStormInstance = null; } Vector3 vector = (base.GetComponent <Rigidbody>().position - this.prevPosition) / Time.deltaTime; this.prevPosition = base.GetComponent <Rigidbody>().position; Vector3 vector2 = new Vector3(vector.x, 0f, vector.z); this.flatVelocity = vector2.magnitude; if (!this.Buoyancy.InWater) { this.immersed = false; } else if (!this.immersed && !LocalPlayer.FpCharacter.Grounded && LocalPlayer.FpCharacter.IsAboveWaistDeep()) { this.immersed = true; float num = Mathf.Clamp(this.SplashSpeedMaximum - this.SplashSpeedMinimum, 0f, this.SplashSpeedMaximum); float num2 = (this.Buoyancy.LastWaterEnterSpeed - this.SplashSpeedMinimum) / num; if (num2 >= 0f) { FMOD.Studio.EventInstance @event = FMOD_StudioSystem.instance.GetEvent(this.SplashEvent); UnityUtil.ERRCHECK(@event.set3DAttributes(UnityUtil.to3DAttributes(this.SfxPlayer, null))); UnityUtil.ERRCHECK(@event.setParameterValue("speed", Mathf.Clamp01(num2))); UnityUtil.ERRCHECK(@event.start()); UnityUtil.ERRCHECK(@event.release()); } } }
private void Start() { this.storeMaxVelocity = this.maximumVelocity; this.headCollider = base.transform.GetComponent <SphereCollider>(); this.fsmClimbBool = LocalPlayer.ScriptSetup.pmControl.FsmVariables.GetFsmBool("climbBool"); this.Stats = base.gameObject.GetComponent <PlayerStats>(); this.Sfx = base.gameObject.GetComponent <PlayerSfx>(); this.animator = this.setup.playerBase.GetComponent <Animator>(); }
//public void Awake() //{ // if (instance == null) // { // instance = this; // } // else // { // if (instance != null) // { // Destroy(gameObject); // } // } // DontDestroyOnLoad(gameObject); //} public void playPlayerSound(PlayerSfx playerSfx, bool isLoop) { for (int i = 0; i < playerSounds.Length; i++) { if (playerSounds[(int)playerSfx] == playerSounds[i]) { playerSource.clip = playerSounds[(int)playerSfx].clip; playerSource.Play(0); playerSource.loop = isLoop; } } }
public void PlayBuildingComplete(GameObject building, bool networkSync = false) { Vector3 position = PlayerSfx.FindClosestPoint(building, base.transform.position); if (networkSync) { this.PlayEvent(this.TwinkleEvent, position); } else { FMOD_StudioSystem.instance.PlayOneShot(this.TwinkleEvent, position, null); } }
private void OnDestroy() { if (LocalPlayer.Transform == base.transform) { LocalPlayer.Transform = null; LocalPlayer.Ridigbody = null; FMOD_StudioEventEmitter.LocalPlayerTransform = null; LocalPlayer.GameObject = null; LocalPlayer.PlayerBase = null; LocalPlayer.HeadTr = null; LocalPlayer.HipsTr = null; LocalPlayer.Inventory = null; LocalPlayer.ReceipeBook = null; LocalPlayer.SpecialActions = null; LocalPlayer.SpecialItems = null; LocalPlayer.MainCamTr = null; LocalPlayer.MainCam = null; LocalPlayer.InventoryCam = null; LocalPlayer.CamFollowHead = null; LocalPlayer.Animator = null; LocalPlayer.AnimControl = null; LocalPlayer.Create = null; LocalPlayer.Tuts = null; LocalPlayer.Sfx = null; LocalPlayer.Stats = null; LocalPlayer.FpCharacter = null; LocalPlayer.FpHeadBob = null; LocalPlayer.CamRotator = null; LocalPlayer.MainRotator = null; LocalPlayer.ScriptSetup = null; LocalPlayer.TargetFunctions = null; LocalPlayer.HitReactions = null; LocalPlayer.Buoyancy = null; LocalPlayer.WaterViz = null; LocalPlayer.AiInfo = null; LocalPlayer.WaterEngine = null; LocalPlayer.ItemDecayMachine = null; LocalPlayer.AnimatedBook = null; LocalPlayer.PassengerManifest = null; LocalPlayer.GreebleRoot = null; LocalPlayer.MudGreeble = null; LocalPlayer.PlayerDeadCam = null; LocalPlayer.PauseMenuBlur = null; LocalPlayer.PauseMenuBlurPsCam = null; LocalPlayer.HeldItemsData = null; LocalPlayer.Vis = null; } }
private void Awake() { LocalPlayer.Transform = this._transform; LocalPlayer.Ridigbody = this._ridigbody; FMOD_StudioEventEmitter.LocalPlayerTransform = LocalPlayer.Transform; LocalPlayer.GameObject = this._playerGO; LocalPlayer.PlayerBase = this._playerBase; LocalPlayer.HeadTr = this._headTr; LocalPlayer.HipsTr = this._hipsTr; LocalPlayer.Inventory = this._inventory; LocalPlayer.ReceipeBook = this._receipeBook; LocalPlayer.SpecialActions = this._specialActions; LocalPlayer.SpecialItems = this._specialItems; LocalPlayer.MainCamTr = this._mainCamTr; LocalPlayer.MainCam = this._mainCam; LocalPlayer.InventoryCam = this._inventoryCam; LocalPlayer.CamFollowHead = this._camFollowHead; LocalPlayer.Animator = this._animator; LocalPlayer.AnimControl = this._animControl; LocalPlayer.Create = this._create; LocalPlayer.Tuts = this._tuts; LocalPlayer.Sfx = this._sfx; LocalPlayer.Stats = this._stats; LocalPlayer.FpCharacter = this._fpc; LocalPlayer.FpHeadBob = this._fphb; LocalPlayer.CamRotator = this._camRotator; LocalPlayer.MainRotator = this._mainRotator; LocalPlayer.ScriptSetup = this._scriptSetup; LocalPlayer.TargetFunctions = this._targetFunctions; LocalPlayer.HitReactions = this._hitReactions; LocalPlayer.Buoyancy = this._buoyancy; LocalPlayer.WaterViz = this._waterViz; LocalPlayer.AiInfo = this._aiInfo; LocalPlayer.WaterEngine = this._waterEngine; LocalPlayer.ItemDecayMachine = this._itemDecayMachine; LocalPlayer.AnimatedBook = this._animatedBook; LocalPlayer.PassengerManifest = this._passengerManifest; LocalPlayer.GreebleRoot = this._greebleRoot; LocalPlayer.MudGreeble = this._mudGreeble; LocalPlayer.PlayerDeadCam = this._PlayerDeadCam; LocalPlayer.PauseMenuBlur = this._pauseMenuBlur; LocalPlayer.PauseMenuBlurPsCam = this._pauseMenuBlurPsCam; LocalPlayer.HeldItemsData = this._heldItemsData; LocalPlayer.Vis = this._vis; base.StartCoroutine(this.OldSaveCompat()); }
public IEnumerator DestroyAfterimages() { var spacingNote = Note.Thirtysecond; var spacingTime = Conductor.noteDurations[spacingNote]; var startNote = Note.Quarter; var start = Conductor.GetNextNote(startNote); var end = start + Conductor.noteDurations[spacingNote] * afterimages.Count; PlayerSfx.PlayDashSfx(start, end); for (int i = 0; i < afterimages.Count; i++) { var targetTime = start + i * spacingTime; afterimages[i].Run(targetTime); } yield return(new WaitForNote(startNote)); Destroy(gameObject); }
// Create a reference set of entities and load necessary assets. public override void Preload(Entity root) { this.root = root; actorList = new List <Entity>(); player = new Entity() .AddRenderComponent(new SpriteComponent(GlobalServices.GlobalSprites.Register("higantour:spirit4"))) .AddChainComponent("control", new Components.PlayerControlComponent(this)); //.AddChainComponent("motion", ) /* * new Entity(0, 0) * .AddRenderComponent(new TextComponent(GlobalServices.GlobalFonts.Register("higantour:sans"), "Player 1")) * .AttachTo(player); */ enemy = new Entity() .AddRenderComponent(new SpriteComponent(GlobalServices.GlobalSprites.Register("higantour:fairy_sm"))) .AddChainComponent("control", new Components.AI.SeekerAIComponent(this)); GlobalServices.GlobalSprites.Register("higantour:enemy"); death = new Entity() .AddRenderComponent(new SpriteComponent(GlobalServices.GlobalSprites.Register("higantour:death_sm"))); warning = new Entity() .AddRenderComponent(new SpriteComponent(GlobalServices.GlobalSprites.Register("higantour:fae_warn"))); bullet = new Entity() .AddRenderComponent(new SpriteComponent(GlobalServices.GlobalSprites.Register("higantour:bullet"))) .AddChainComponent("control", new Components.AI.BulletComponent(this, -200, 0, 0, 0)); Sprite lycorisSprite = GlobalServices.GlobalSprites.Register("higantour:redlily"); lycoris = new Entity() .AddRenderComponent(new SpriteComponent(lycorisSprite)); font = GlobalServices.GlobalFonts.Register("higantour:sans"); // bgm = GlobalServices.GlobalSongs.Register("higantour:Stage"); PlayerSfx = GlobalServices.GlobalSoundEffects.Register("higantour:leaves"); PlayerSfxInstance = PlayerSfx.CreateInstance(); }
//public void ApplyPlayerTankDamage(float damage) //{ // healthCount -= damage; // if (healthCount <= 0) // { // controller.DestroyTankView(this); // } //} private void FixedUpdate() { horizontalInput = Input.GetAxisRaw("Horizontal1"); verticalInput = Input.GetAxisRaw("Vertical1"); if (verticalInput != 0) { if (currentSfx != PlayerSfx.Walk) { controller.PlaySound(PlayerSfx.Walk, true); currentSfx = PlayerSfx.Walk; } } else { if (currentSfx != PlayerSfx.Idle) { controller.PlaySound(PlayerSfx.Idle, true); currentSfx = PlayerSfx.Idle; } } moveTank(); }
private void Start() { EventService.Instance.OnPlayerSpawn(); controller.PlaySound(PlayerSfx.Idle, true); currentSfx = PlayerSfx.Idle; }
private void Awake() { Debug.Assert(inst == null); inst = this; }
private void ExitMoveState() { PlayerSfx.StopMoveSfx(); }
private void Awake() { BleedBehavior.BloodAmount = 0f; BleedBehavior.BloodReductionRatio = 1f; this.explodeHash = Animator.StringToHash("explode"); this.DSpots = GameObject.FindWithTag("DeadSpots").GetComponent<DeadSpotController>(); this.Hud = Scene.HudGui; this.Ocean = GameObject.FindWithTag("Ocean"); this.mutantControl = Scene.MutantControler; this.sceneInfo = Scene.SceneTracker; this.Player = base.gameObject.GetComponent<PlayerInventory>(); this.camFollow = base.GetComponentInChildren<camFollowHead>(); this.hitReaction = base.GetComponent<playerHitReactions>(); this.Atmos = Scene.Atmosphere; this.FrostScript = LocalPlayer.MainCam.GetComponent<Frost>(); this.Tuts = LocalPlayer.Tuts; this.Sfx = LocalPlayer.Sfx; this.animator = LocalPlayer.Animator; this.DyingVision = LocalPlayer.MainCam.GetComponent<Grayscale>(); this.Fullness = 1f; this.bloodPropertyBlock = new MaterialPropertyBlock(); if (!LevelSerializer.IsDeserializing) { CoopPlayerVariations component = base.GetComponent<CoopPlayerVariations>(); this.PlayerVariation = UnityEngine.Random.Range(0, component.Variations.Length); this.PlayerVariationBody = UnityEngine.Random.Range(0, component.BodyMaterials.Length); } if (this.CurrentArmorTypes == null || this.CurrentArmorTypes.Length != this.ArmorModel.Length) { this.CurrentArmorTypes = new PlayerStats.ArmorTypes[this.ArmorModel.Length]; for (int i = 0; i < this.CurrentArmorTypes.Length; i++) { this.CurrentArmorTypes[i] = PlayerStats.ArmorTypes.None; this.ArmorModel[i].SetActive(false); } } if (this.CurrentArmorHP == null || this.CurrentArmorHP.Length != this.ArmorModel.Length) { this.CurrentArmorHP = new int[this.ArmorModel.Length]; } this.CaveDoors = GameObject.FindGameObjectsWithTag("CaveDoor"); }
private void Update() { if (this.Remote) { return; } PLAYBACK_STATE playback_STATE = PLAYBACK_STATE.STOPPED; if (this.musicTrack != null) { UnityUtil.ERRCHECK(this.musicTrack.getPlaybackState(out playback_STATE)); } if (playback_STATE != PLAYBACK_STATE.STOPPED) { PlayerSfx.MusicPlaying = true; } else { PlayerSfx.MusicPlaying = false; } if (base.transform.hasChanged) { base.transform.hasChanged = false; ATTRIBUTES_3D attributes = UnityUtil.to3DAttributes(this.SfxPlayer, null); PlayerSfx.Set3DAttributes(this.staminaBreathInstance, attributes); PlayerSfx.Set3DAttributes(this.walkyTalkyInstance, attributes); PlayerSfx.Set3DAttributes(this.musicTrack, attributes); PlayerSfx.Set3DAttributes(this.TurtleShellSledLoopInstance, attributes); ATTRIBUTES_3D attributes2 = this.SfxPlayer.transform.position.to3DAttributes(); PlayerSfx.Set3DAttributes(this.afterStormInstance, attributes2); PlayerSfx.Set3DAttributes(this.onOceanInstance, attributes2); } if (this.afterStormInstance != null && !this.afterStormInstance.isValid()) { this.afterStormInstance = null; } this.sledOnTerrain = base.GetComponent <FirstPersonCharacter>().terrainContact; if (this.sledIsPlaying) { UnityUtil.ERRCHECK(this.TurtleShellSledLoopSpeedParameter.setValue(LocalPlayer.Rigidbody.velocity.sqrMagnitude / 200f)); } if (this.sledIsPlaying && LocalPlayer.FpCharacter.Grounded) { UnityUtil.ERRCHECK(this.TurtleShellSledLoopAirParameter.setValue(0f)); } else if (this.sledIsPlaying && !LocalPlayer.FpCharacter.Grounded) { UnityUtil.ERRCHECK(this.TurtleShellSledLoopAirParameter.setValue(1f)); } if (this.sledIsPlaying && LocalPlayer.FpCharacter.inSnow) { UnityUtil.ERRCHECK(this.TurtleShellSledLoopSnowParameter.setValue(1f)); } else if (this.sledIsPlaying && !LocalPlayer.FpCharacter.inSnow) { UnityUtil.ERRCHECK(this.TurtleShellSledLoopSnowParameter.setValue(0f)); } Vector3 vector = (base.GetComponent <Rigidbody>().position - this.prevPosition) / Time.deltaTime; this.prevPosition = base.GetComponent <Rigidbody>().position; Vector3 vector2 = new Vector3(vector.x, 0f, vector.z); this.flatVelocity = vector2.magnitude; if (!this.Buoyancy.InWater) { this.immersed = false; } else if (!this.immersed && !LocalPlayer.FpCharacter.Grounded && LocalPlayer.FpCharacter.IsAboveWaistDeep()) { this.immersed = true; float num = Mathf.Clamp(this.SplashSpeedMaximum - this.SplashSpeedMinimum, 0f, this.SplashSpeedMaximum); float num2 = (this.Buoyancy.LastWaterEnterSpeed - this.SplashSpeedMinimum) / num; if (num2 >= 0f) { EventInstance @event = FMOD_StudioSystem.instance.GetEvent(this.SplashEvent); UnityUtil.ERRCHECK(@event.set3DAttributes(UnityUtil.to3DAttributes(this.SfxPlayer, null))); UnityUtil.ERRCHECK(@event.setParameterValue("speed", Mathf.Clamp01(num2))); UnityUtil.ERRCHECK(@event.start()); UnityUtil.ERRCHECK(@event.release()); } } if (this.Buoyancy.InWater && this.Buoyancy.IsOcean) { if (this.onOceanInstance == null) { this.onOceanInstance = FMODCommon.PlayOneshot("event:/ambient/water/on_ocean", base.transform); } } else if (this.onOceanInstance != null) { UnityUtil.ERRCHECK(this.onOceanInstance.stop(STOP_MODE.ALLOWFADEOUT)); UnityUtil.ERRCHECK(this.onOceanInstance.release()); this.onOceanInstance = null; } }
private void EnterMoveState() { PlayerSfx.StartMoveSfx(); }
private void SetPlayerSfx(PlayerSfx sfx) { this.playerSfx = sfx; }
public void PlaySound(PlayerSfx sfxIndex, bool isLoop) { SoundManager.Instance.playPlayerSound(sfxIndex, false); }