private void die() { if (!this.controller) { return; } this.sendDisablePerchTarget(); if (this.controller.initIdealBirds > 0) { this.controller.initIdealBirds--; } if (this.controller.initMaxBirds > 0) { this.controller.initMaxBirds--; } base.StopAllCoroutines(); FMODCommon.PlayOneshot(this.DieEvent, base.transform); Transform transform = this.ragDoll.metgoragdoll(default(Vector3)); if (BoltNetwork.isRunning && BoltNetwork.isServer) { BoltNetwork.Attach(transform.gameObject); } this.controller.Unspawn(base.gameObject); }
private void Start() { if (FMOD_StudioSystem.instance) { this.eventDescription = FMOD_StudioSystem.instance.GetEventDescription(this.eventPath); } if (this.eventDescription == null) { base.enabled = false; return; } float num; UnityUtil.ERRCHECK(this.eventDescription.getMaximumDistance(out num)); this.sqrEventMaximumDistance = num * num; this.windParameterIndex = FMODCommon.FindParameterIndex(this.eventDescription, "wind"); this.compareSources = delegate(AreaEmitter.Source a, AreaEmitter.Source b) { float sqrDistance = a.polygon.GetSegment(a.segment).sqrDistance; float sqrDistance2 = b.polygon.GetSegment(b.segment).sqrDistance; return(Math.Sign(sqrDistance - sqrDistance2)); }; this.inverseTransformDelegate = new Func <Vector3, Vector2>(this.InverseTransformPoint); this.bounds = new Bounds(this.TransformPoint(this.perimeter.points[0]), Vector3.zero); this.perimeter.points.ForEach(delegate(Vector2 point) { this.bounds.Encapsulate(this.TransformPoint(point)); }); for (int i = -1; i < this.voids.Count; i++) { this.GetPolygon(i).Start(num, new Func <Vector2, Vector3>(this.TransformPoint)); } }
private void Light() { if (this._fuel < Time.time) { GameStats.LitWeapon.Invoke(); LocalPlayer.Inventory.DefaultLight.StashLighter(); InventoryItemView component = this._inventoryMirror.transform.parent.GetComponent <InventoryItemView>(); Transform transform = (!this._weaponFireSpawn) ? base.transform : this._weaponFireSpawn.transform; this._weaponFire = (GameObject)UnityEngine.Object.Instantiate(this._weaponFirePrefab, transform.position, transform.rotation); this._weaponFire.transform.parent = transform; if (!this._weaponFire.activeSelf) { this._weaponFire.gameObject.SetActive(true); } this._fireParticleScale = this._weaponFire.GetComponentInChildren <ParticleScaler>(); this._firelight = this._weaponFire.GetComponentInChildren <Light>(); this._fireAudioEmitter = this._weaponFire.GetComponent <FMOD_StudioEventEmitter>(); base.GetComponent <Renderer>().sharedMaterial = this._burningMat; this._fuel = ((this._state != BurnableCloth.States.PutOutLighting) ? this._burnDuration : this._putOutFuel); if (component.ActiveBonus == WeaponStatUpgrade.Types.BurningWeaponExtra) { this._extraBurn = true; this._fuel *= 3f; } else { this._extraBurn = false; } this._state = BurnableCloth.States.Burning; this._player.IsWeaponBurning = true; this._attacking = false; component.ActiveBonus = (WeaponStatUpgrade.Types)(-1); FMODCommon.PlayOneshot("event:/fire/fire_built_start", transform); } }
private void startBossFightMusic() { if (this.bossFightEvent == null && !string.IsNullOrEmpty(this.bossFightMusic)) { this.bossFightEvent = FMODCommon.PlayOneshot(this.bossFightMusic, base.transform); } }
private void doAwake() { this.enemyHitMask = 36841472; this.rootTr = base.transform.root; this.thisCollider = base.transform.GetComponent <Collider>(); if (!this.netPrefab) { this.setup = base.transform.root.GetComponentInChildren <mutantScriptSetup>(); this.ai = base.transform.root.GetComponentInChildren <mutantAI>(); } if (this.netPrefab) { this.hitPrediction = base.transform.root.GetComponent <CoopMutantClientHitPrediction>(); this.ai_net = base.transform.root.GetComponentInChildren <mutantAI_net>(); } this.props = base.transform.root.GetComponentInChildren <mutantPropManager>(); this.animator = base.transform.root.GetComponentInChildren <Animator>(); this.events = base.transform.root.GetComponentInChildren <enemyAnimEvents>(); this.blockHash = Animator.StringToHash("block"); FMODCommon.PreloadEvents(new string[] { this.weaponHitEvent, this.parryEvent, this.blockEvent, this.shellBlockEvent }); this.hasPreloaded = true; }
private IEnumerator HitTree(Vector3 position) { Quaternion rot = (!this.hitPointUpdated) ? base.transform.root.rotation : this.PhysicBody.transform.rotation; yield return(null); if (this.bodyCollider) { this.bodyCollider.isTrigger = true; } if (this.PhysicBody) { this.PhysicBody.transform.position = position; this.PhysicBody.transform.rotation = rot; this.PhysicBody.velocity = Vector3.zero; this.PhysicBody.isKinematic = true; this.PhysicBody.useGravity = false; } if (this.MyPickUp) { this.MyPickUp.SetActive(true); } FMODCommon.PlayOneshotNetworked(this.hitTreeEvent, base.transform, FMODCommon.NetworkRole.Any); this.hitPointUpdated = false; yield break; }
private void Start() { if (!SteamDSConfig.isDedicatedServer) { this.eventDescription = FMOD_StudioSystem.instance.GetEventDescription("event:/ambient/water/water_runoff", true); this.gradientParameterIndex = FMODCommon.FindParameterIndex(this.eventDescription, "gradient"); this.wetnessParameterIndex = FMODCommon.FindParameterIndex(this.eventDescription, "wetness"); UnityUtil.ERRCHECK(this.eventDescription.getMaximumDistance(out this.gridCellSize)); this.gridCellSize /= 10f; int num = this.targetSourceCount - 1; this.sampleGrid = new WaterOnTerrainSFX.GridCell[21, 21]; this.sources = new List <WaterOnTerrainSFX.Source>(num); this.sourcePool = new Stack <WaterOnTerrainSFX.Source>(num); this.centreSource = new WaterOnTerrainSFX.Source(); for (int i = 0; i < num; i++) { this.sourcePool.Push(new WaterOnTerrainSFX.Source()); } FMOD_Listener.DrawWaterOnTerrain = new Action(this.DrawDebug); } else { base.enabled = false; } }
private void Start() { FMODCommon.PreloadEvents(new string[] { this.playerSightedEvent }); }
private void OnEnable() { FMODCommon.PreloadEvents(new string[] { this.dieEvent, this.sharkAttackEvent }); base.transform.rotation = Quaternion.identity; this.diff = base.transform.forward; this.desiredDirection = base.transform.forward; this.desiredRotation = base.transform.rotation; this.lastRotation = base.transform.rotation; this.direction = base.transform.forward; this.hitBool = false; if (!this.initBool) { return; } this.hitBlock = false; this.resetAttack(); this.setupInvokes(); if (this.animator) { this.animator.SetBool("Dead", false); } float num = UnityEngine.Random.Range(0.1f, 3f); }
private void OnDisable() { base.CancelInvoke("updatePlayerTargets"); FMODCommon.UnloadEvents(new string[] { this.dieEvent, this.sharkAttackEvent }); if (this.MyTrigger) { this.MyTrigger.SetActive(false); } destroyAfter component = base.transform.GetComponent <destroyAfter>(); if (component) { component.enabled = false; } if (this.rb) { this.rb.useGravity = false; this.rb.isKinematic = true; this.spearedBool = false; } if (this.col) { this.col.isTrigger = true; this.col.enabled = true; } this.Dead = false; this.exploded = false; base.CancelInvoke("enableGrabTrigger"); }
private void AffirmPowerOnEvent() { if (this.powerOnInstance == null && !CoopPeerStarter.DedicatedHost) { this.powerOnInstance = FMODCommon.PlayOneshot("event:/combat/weapons/artifact/artifact_dropped_loop", base.transform); } }
private void Update() { if (!CoopPeerStarter.DedicatedHost) { FMODCommon.UpdateLoopingEvents(this.loopingEvents, this.animator, base.transform); } base.transform.hasChanged = false; if (this.animator) { AnimatorStateInfo currentAnimatorStateInfo = this.animator.GetCurrentAnimatorStateInfo(0); if (currentAnimatorStateInfo.tagHash == this.idleHash) { if (this.mainWeaponCollider && this.mainWeaponCollider.enabled) { this.mainWeaponCollider.enabled = false; } if (this.leftWeaponCollider && this.leftWeaponCollider.enabled) { this.leftWeaponCollider.enabled = false; } } if (currentAnimatorStateInfo.fullPathHash == this.idleStateHash) { if (!this.inIdleState) { this.idleTimeoutEnd = Time.time + 2f; } this.inIdleState = true; } else { this.inIdleState = false; } } }
private void CheckNextImage() { if (this._lastMaterialNum + 1 < this._slidesMaterials.Length) { if (Time.time - this._lastSwapTime >= this._scrollingDelay) { this._lastMaterialNum++; this._lastSwapTime = Time.time; this._targetRenderer.sharedMaterial = this._slidesMaterials[this._lastMaterialNum]; FMODCommon.PlayOneshot("event:/endgame/sfx_endgame/projector_click", (!this._sfxPosition) ? base.transform : this._sfxPosition); } } else if (this._restartDelay >= 0f) { if (Time.time - this._lastSwapTime >= this._restartDelay) { this._lastMaterialNum = 0; this._lastSwapTime = Time.time; this._targetRenderer.sharedMaterial = this._slidesMaterials[this._lastMaterialNum]; FMODCommon.PlayOneshot("event:/endgame/sfx_endgame/projector_click", (!this._sfxPosition) ? base.transform : this._sfxPosition); } } else { base.enabled = false; } }
private void OnEnable() { FMODCommon.PreloadEvents(new string[] { this.dieEvent, this.sharkAttackEvent }); if (!this.initBool) { return; } this.hitBlock = false; this.resetAttack(); this.setupInvokes(); if (this.animator) { this.animator.SetBool("Dead", false); } float time = UnityEngine.Random.Range(0.1f, 3f); if (!base.IsInvoking("updatePlayerTargets")) { base.InvokeRepeating("updatePlayerTargets", time, 2f); } }
public void loadItemIntoBasket(int type) { if (this._nextItemIndex > 0) { this._nextItemIndex--; int num = this._items[this._nextItemIndex]; this._items[this._nextItemIndex] = -1; this._ammoLoaded[this._anim.ammoCount] = num; this._anim.rockAmmo[this._anim.ammoCount].SetActive(true); if (this._renderSlots[this._nextItemIndex].childCount > 0) { Transform child = this._renderSlots[this._nextItemIndex].GetChild(0); this.TransferItemView(child, this._anim.rockAmmo[this._anim.ammoCount].transform, num); } if (LocalPlayer.Sfx) { FMODCommon.PlayOneshotNetworked(LocalPlayer.Sfx.WhooshEvent, base.transform, FMODCommon.NetworkRole.Server); } if (BoltNetwork.isRunning) { base.entity.Freeze(false); base.state.Items[this._nextItemIndex] = -1; base.state.Ammo[this._anim.ammoCount] = num; } this._anim.ammoCount++; } }
private void Light() { if (this._fuel < Time.time) { GameStats.LitWeapon.Invoke(); LocalPlayer.Inventory.DefaultLight.StashLighter(); Transform transform = (!this._weaponFireSpawn) ? base.transform : this._weaponFireSpawn.transform; this._weaponFire = UnityEngine.Object.Instantiate <GameObject>(this._weaponFirePrefab, transform.position, transform.rotation); this._weaponFire.transform.parent = transform; if (!this._weaponFire.activeSelf) { this._weaponFire.gameObject.SetActive(true); } this._fireParticleScale = this._weaponFire.GetComponentInChildren <ParticleScaler>(); this._firelight = this._weaponFire.GetComponentInChildren <Light>(); this._fireAudioEmitter = this._weaponFire.GetComponent <FMOD_StudioEventEmitter>(); base.GetComponent <Renderer>().sharedMaterial = this._burningMat; this._fuel = this._burnDuration; this._startTime = Time.time; this._state = BurnableItem.States.Burning; this._attacking = false; LocalPlayer.Inventory.IsWeaponBurning = true; FMODCommon.PlayOneshot("event:/fire/fire_built_start", transform); } }
private void OnEnable() { this.tr = base.transform; this.anim = base.gameObject.GetComponent <Animator>(); this.ragDoll = base.GetComponent <clsragdollify>(); this.layerMask1 = 67108864; this.lastPos = this.tr.position; this.smallCircleCheckDelay = Time.time + 5f; this.idleAnimationHash = Animator.StringToHash("Base Layer.Idle"); this.flyTagHash = Animator.StringToHash("flying"); this.hopIntHash = Animator.StringToHash("hop"); this.flyingBoolHash = Animator.StringToHash("flying"); this.peckBoolHash = Animator.StringToHash("peck"); this.ruffleBoolHash = Animator.StringToHash("ruffle"); this.preenBoolHash = Animator.StringToHash("preen"); this.landingBoolHash = Animator.StringToHash("landing"); this.singTriggerHash = Animator.StringToHash("sing"); this.flyingDirectionHash = Animator.StringToHash("flyingDirectionX"); this.anim.SetFloatReflected("IdleAgitated", this.agitationLevel); this.onFire = false; this.health = 1; if (this.anim.enabled) { this.anim.SetBool(this.flyingBoolHash, true); this.anim.SetBool(this.landingBoolHash, false); } if (!base.IsInvoking("groundHeightCheck")) { FMODCommon.PreloadEvents(this.AllEventPaths()); } this.fleeing = false; }
private void OnCollisionEnter(Collision collision) { GameObject gameObject = collision.gameObject; if (PhysicsSfx.IsSlideObject(gameObject)) { this.slideObjects.Add(gameObject); } if (this.waitingForSpawnTimeout) { return; } if (collision.contacts.Length < 1) { return; } if (gameObject.CompareTag("Player")) { return; } if (this.impactEnabled && collision.relativeVelocity.sqrMagnitude > this.sqrImpactSpeedThreshold) { FMODCommon.PlayOneshot(this.impactEvent, collision.contacts[0].point, new object[] { "speed", collision.relativeVelocity.magnitude }); this.impactEnabled = false; base.Invoke("EnableImpact", this.impactRetriggerTimeout); } }
private void OnEnable() { if (this.delayAfterSpawn > 0f) { this.waitingForSpawnTimeout = true; base.Invoke("EndSpawnTimeout", this.delayAfterSpawn); } else { this.waitingForSpawnTimeout = false; } this.sqrImpactSpeedThreshold = this.impactSpeedThreshold * this.impactSpeedThreshold; this.sqrSlideSpeedThreshold = this.slideSpeedThreshold * this.slideSpeedThreshold; this.collider = base.GetComponent <Collider>(); this.rigidbody = base.GetComponent <Rigidbody>(); if (!this.rigidbody) { base.enabled = false; return; } if (this.slideObjects == null) { this.slideObjects = new List <GameObject>(); } else { this.slideObjects.Clear(); } FMODCommon.PreloadEvents(new string[] { this.impactEvent, this.slideEvent }); this.hasPreloaded = true; }
private void DieFire() { if (!this.controller) { return; } this.sendDisablePerchTarget(); if (this.controller.initIdealBirds > 0) { this.controller.initIdealBirds--; } if (this.controller.initMaxBirds > 0) { this.controller.initMaxBirds--; } base.StopAllCoroutines(); FMODCommon.PlayOneshot(this.DieEvent, base.transform); this.ragDoll.burning = true; Transform transform = this.ragDoll.metgoragdoll(default(Vector3)); if (BoltNetwork.isRunning && BoltNetwork.isServer) { CoopRagdollToken coopRagdollToken = new CoopRagdollToken(); coopRagdollToken.onFireApplied = true; BoltNetwork.Attach(transform.gameObject, coopRagdollToken); } this.controller.Unspawn(base.gameObject); }
private void Die() { if (!this.Dead) { this.Dead = true; this.controller.AddFishSpawnBackCounter(); FMODCommon.PlayOneshot(this.dieEvent, base.transform); if (this.Blood) { this.Blood.SetActive(true); this.Blood.transform.parent = null; } if (this.exploded) { base.Invoke("enableGrabTrigger", 5f); } else if (this.MyTrigger) { this.MyTrigger.SetActive(true); } base.CancelInvoke("switchDirection"); base.CancelInvoke("checkForwardCollide"); base.StopCoroutine("setFleeSpeed"); if (this.typeShark) { EventRegistry.Animal.Publish(TfEvent.KilledShark, base.gameObject); base.StartCoroutine("setDeathSpeedShark"); } else { base.StartCoroutine("setDeathSpeed"); } destroyAfter component = base.transform.GetComponent <destroyAfter>(); if (component) { component.enabled = true; } if (!this.typeShark) { this.rb.useGravity = true; this.rb.isKinematic = false; base.transform.GetComponent <Collider>().isTrigger = false; } if (this.exploded) { this.rb.AddTorque((float)UnityEngine.Random.Range(-2000, 2000), (float)UnityEngine.Random.Range(-2000, 2000), (float)UnityEngine.Random.Range(-2000, 2000), ForceMode.Force); } else if (!this.typeShark) { this.rb.AddTorque(base.transform.forward * 8000f, ForceMode.Force); } if (this.typeShark) { this.animator.SetBoolReflected("Dead", true); this.animator.speed = 1f; base.Invoke("doRagDoll", 3.3f); } } }
private void OnEnable() { FMODCommon.PreloadEvents(new string[] { this.addItemEvent }); this.hasPreloaded = true; }
private void PlayTriggerSFX() { if (this.sfxPosition == null) { this.sfxPosition = base.transform; } FMODCommon.PlayOneshot(this.triggerSFX, this.sfxPosition); }
private void Start() { FMODCommon.PreloadEvents(new string[] { this.tree, this.water }); }
private void soundBreatheOut() { if (this.Remote) { return; } FMODCommon.PlayOneshot(this.breatheOutEvent, base.transform); }
private void playDrawBow() { if (this.Remote) { return; } FMODCommon.PlayOneshot(this.bowDrawEvent.eventPath, this.setup.leftHand); }
private void OnEnable() { this.eventInstance = FMODCommon.PlayOneshot(this.eventPath, base.transform.position, new object[] { "wind", TheForestAtmosphere.Instance.WindIntensity }); }
private void OnDestroy() { FMODCommon.ReleaseIfValid(this._snapshotInstance, STOP_MODE.IMMEDIATE); if (InsideCheck._instance == this) { InsideCheck._instance = null; } }
private void explodeAllPoints() { for (int i = 0; i < this.explodePoints.Length; i++) { UnityEngine.Object.Instantiate <GameObject>(this.ExplosionPrefab, this.explodePoints[i].position, Quaternion.identity); FMODCommon.PlayOneshotNetworked("event:/mutants/creepies/Worm/worm_fall_impact", this.explodePoints[i], FMODCommon.NetworkRole.Server); } }
public bool OriginalPutDown(bool fake, bool drop, bool equipPrevious, GameObject preSpawned) { if (this._infiniteLogHack) { return(true); } if (!fake) { if (this._logs <= 0) { return(false); } this.RemoveLog(equipPrevious); } if (drop) { bool flag = this._logs == 1; Transform transform = this._logsHeld[Mathf.Min(this._logs, 1)].transform; Vector3 vector = transform.position + transform.forward * -2f; Quaternion quaternion = LocalPlayer.Transform.rotation; quaternion *= Quaternion.AngleAxis(90f, Vector3.up); if (LocalPlayer.FpCharacter.PushingSled) { vector += transform.forward * -1.25f + transform.right * -2f; } Vector3 origin = vector; origin.y += 3f; if (Physics.Raycast(origin, Vector3.down, out RaycastHit raycastHit, 5f, this._layerMask)) { vector.y = raycastHit.point.y + 2.2f; } if (flag) { vector.y += 1f; } if (BoltNetwork.isRunning) { DropItem dropItem = DropItem.Create(GlobalTargets.OnlyServer); dropItem.PrefabId = BoltPrefabs.Log; dropItem.Position = vector; dropItem.Rotation = quaternion; dropItem.PreSpawned = ((!preSpawned) ? null : preSpawned.GetComponent <BoltEntity>()); dropItem.Send(); } else if (preSpawned) { preSpawned.transform.position = vector; preSpawned.transform.rotation = quaternion; } else { Instantiate(this._logPrefab, vector, quaternion); } FMODCommon.PlayOneshotNetworked("event:/player/foley/log_drop_exert", transform, FMODCommon.NetworkRole.Any); } this.UpdateLogCount(); return(true); }