Beispiel #1
0
    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);
        }
    }
Beispiel #2
0
    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);
    }
Beispiel #3
0
 private void AffirmPowerOnEvent()
 {
     if (this.powerOnInstance == null && !CoopPeerStarter.DedicatedHost)
     {
         this.powerOnInstance = FMODCommon.PlayOneshot("event:/combat/weapons/artifact/artifact_dropped_loop", base.transform);
     }
 }
Beispiel #4
0
    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);
    }
Beispiel #5
0
 private void startBossFightMusic()
 {
     if (this.bossFightEvent == null && !string.IsNullOrEmpty(this.bossFightMusic))
     {
         this.bossFightEvent = FMODCommon.PlayOneshot(this.bossFightMusic, base.transform);
     }
 }
Beispiel #6
0
 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);
     }
 }
Beispiel #7
0
 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);
     }
 }
Beispiel #8
0
 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;
     }
 }
Beispiel #9
0
 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);
         }
     }
 }
Beispiel #10
0
 private void soundBreatheOut()
 {
     if (this.Remote)
     {
         return;
     }
     FMODCommon.PlayOneshot(this.breatheOutEvent, base.transform);
 }
Beispiel #11
0
 private void PlayTriggerSFX()
 {
     if (this.sfxPosition == null)
     {
         this.sfxPosition = base.transform;
     }
     FMODCommon.PlayOneshot(this.triggerSFX, this.sfxPosition);
 }
Beispiel #12
0
 private void OnEnable()
 {
     this.eventInstance = FMODCommon.PlayOneshot(this.eventPath, base.transform.position, new object[]
     {
         "wind",
         TheForestAtmosphere.Instance.WindIntensity
     });
 }
Beispiel #13
0
 private void playDrawBow()
 {
     if (this.Remote)
     {
         return;
     }
     FMODCommon.PlayOneshot(this.bowDrawEvent.eventPath, this.setup.leftHand);
 }
Beispiel #14
0
 protected virtual void FinishedBurning()
 {
     if (this.MyBurnt && (!BoltNetwork.isClient || !this.MyBurnt.GetComponent <BoltEntity>()))
     {
         FMODCommon.PlayOneshot("event:/combat/weapons/axe/axe_plane_hits_plant", base.transform.position, new object[0]);
         GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.MyBurnt, base.transform.position, base.transform.rotation);
         base.SendMessage("Burnt", gameObject, SendMessageOptions.DontRequireReceiver);
         IEnumerator enumerator = gameObject.transform.GetEnumerator();
         try
         {
             while (enumerator.MoveNext())
             {
                 object    obj       = enumerator.Current;
                 Transform transform = (Transform)obj;
                 if (!transform.GetComponent <UnParent>())
                 {
                     Renderer component = transform.GetComponent <Renderer>();
                     if (component)
                     {
                         if (this.BurnMaterial)
                         {
                             component.sharedMaterial = this.BurnMaterial;
                         }
                         component.SetPropertyBlock(this.propertyBlock);
                     }
                 }
             }
         }
         finally
         {
             IDisposable disposable;
             if ((disposable = (enumerator as IDisposable)) != null)
             {
                 disposable.Dispose();
             }
         }
     }
     if (this.DestroyWhenComplete)
     {
         if (BoltNetwork.isRunning && base.entity && base.entity.isAttached)
         {
             if (base.entity.isOwner)
             {
                 BoltNetwork.Destroy((!this.DestroyTarget) ? base.gameObject : this.DestroyTarget);
             }
         }
         else
         {
             UnityEngine.Object.Destroy((!this.DestroyTarget) ? base.gameObject : this.DestroyTarget);
         }
     }
     else
     {
         this.StopBurning();
         this.usedFuelSeconds = 0f;
     }
 }
Beispiel #15
0
 private void TryPlaySound(string path)
 {
     if (this.SoundsEnabled())
     {
         FMODCommon.PlayOneshot(path, base.transform);
         this.timeoutActive = true;
         base.Invoke("EndTimeout", 1f);
     }
 }
Beispiel #16
0
 public void OnWeightRemoved()
 {
     this._weight--;
     this.RefreshDoorAndWeightTarget();
     if (this._weight < this._maxWeight)
     {
         FMODCommon.PlayOneshot(this._beginCloseEvent, this._sfxPosition);
     }
     base.SendMessageUpwards("OnWeightChanged", SendMessageOptions.DontRequireReceiver);
 }
Beispiel #17
0
    private EventInstance PlayEvent(string path)
    {
        EventInstance eventInstance = FMODCommon.PlayOneshot(path, base.transform);

        if (eventInstance != null)
        {
            this.eventInstances.Add(eventInstance);
        }
        return(eventInstance);
    }
Beispiel #18
0
 private void PlayOpenEvent()
 {
     if (this._weight == 0)
     {
         FMODCommon.PlayOneshot(this._initialOpenEvent, this._sfxPosition);
     }
     else if (this._weight < this._maxWeight)
     {
         FMODCommon.PlayOneshot(this._additionalOpenEvent, this._sfxPosition);
     }
 }
Beispiel #19
0
 private void CutDown()
 {
     if (!this.breakEventPlayed)
     {
         FMODCommon.PlayOneshot(this.breakEvent, base.transform);
         this.breakEventPlayed = true;
         this.Loot.SetActive(true);
         this.Loot.transform.parent = null;
         UnityEngine.Object.Destroy(base.gameObject);
     }
 }
Beispiel #20
0
 private void ToggleInside()
 {
     this._insideCheck        = true;
     Scene.ShoreMask.clipMask = this._insideClip;
     this._flatOceanMat.SetTexture("TerrainFlowHeightmap", this._flatOceanInsideFlowmap);
     LocalPlayer.Buoyancy.enabled = false;
     LocalPlayer.Transform.SendMessage("setInYacht", true);
     if (this._snapshotInstance == null)
     {
         this._snapshotInstance = FMODCommon.PlayOneshot("snapshot:/Inside Yacht", Vector3.zero, new object[0]);
     }
 }
Beispiel #21
0
 private void DieTrap(int type)
 {
     if (type == 3)
     {
         FMODCommon.PlayOneshotNetworked("event:/player/player_vox/jump_vox", base.transform, FMODCommon.NetworkRole.Server);
         FMODCommon.PlayOneshot("event:/player/foley/body_fall", base.transform.position, FMODCommon.NetworkRole.Server, new object[]
         {
             "fall",
             0.8f
         });
     }
 }
Beispiel #22
0
 private void PlaySong()
 {
     if (UnityEngine.Random.value < 0.005f && !Clock.planecrash)
     {
         if (base.gameObject.activeSelf)
         {
             this.songInstance = FMODCommon.PlayOneshot(this.SongEvent, base.transform);
         }
         this.songBreak = true;
         base.Invoke("resetSongBreak", 12f);
     }
 }
Beispiel #23
0
 private void StartBurningEvent()
 {
     if (this.burningEventInstance == null && !string.IsNullOrEmpty(this.burningEvent))
     {
         this.burningEventInstance = FMODCommon.PlayOneshot(this.burningEvent, base.transform);
         if (this.burningEventInstance != null)
         {
             this.burningEventInstance.getParameter("size", out this.sizeParameter);
             this.burningEventInstance.getParameter("flare up", out this.flareUpParameter);
         }
     }
 }
Beispiel #24
0
    private void DieSpear()
    {
        destroyAfter component = base.transform.GetComponent <destroyAfter>();

        if (component)
        {
            component.enabled = false;
        }
        if (this.controlScript && this.controlScript.allFish.Contains(base.gameObject))
        {
            this.controlScript.allFish.Remove(base.gameObject);
        }
        this.spearedBool    = true;
        this.rb.useGravity  = false;
        this.rb.isKinematic = true;
        this.col.isTrigger  = true;
        this.col.enabled    = false;
        if (!this.Dead)
        {
            FMODCommon.PlayOneshot(this.dieEvent, base.transform);
            if (this.controller)
            {
                this.controller.AddFishSpawnBackCounter();
            }
        }
        if (this.Blood)
        {
            this.Blood.SetActive(true);
            this.Blood.transform.parent = null;
        }
        this.Dead = true;
        if (this.animator)
        {
            this.animator.SetBoolReflected("Dead", true);
        }
        base.CancelInvoke("switchDirection");
        base.CancelInvoke("checkForwardCollide");
        if (this.MyTrigger)
        {
            this.MyTrigger.SetActive(true);
        }
        base.StopCoroutine("setFleeSpeed");
        if (this.typeShark)
        {
            base.StartCoroutine("setDeathSpeedShark");
        }
        else
        {
            base.StartCoroutine("setDeathSpeed");
        }
    }
Beispiel #25
0
 public static void Play(SfxInfo.SfxTypes type, Transform source = null, bool mpSync = true)
 {
     if (Sfx.Instance && type < (SfxInfo.SfxTypes)Sfx.Instance._definitions.Length)
     {
         if (mpSync)
         {
             FMODCommon.PlayOneshotNetworked(Sfx.Instance._definitions[(int)type]._path, source, FMODCommon.NetworkRole.Any);
         }
         else
         {
             FMODCommon.PlayOneshot(Sfx.Instance._definitions[(int)type]._path, source);
         }
     }
 }
Beispiel #26
0
 private void AffirmEventStarted()
 {
     if (this.eventInstance == null && !CoopPeerStarter.DedicatedHost)
     {
         this.eventInstance = FMODCommon.PlayOneshot("event:/combat/chainsaw/chainsaw", base.transform);
         if (this.eventInstance != null)
         {
             this.eventInstance.getParameter("cutting", out this.cuttingParameter);
             this.eventInstance.getParameter("gore", out this.cuttingFleshParameter);
             this.eventInstance.getParameter("wood", out this.cuttingTreeParameter);
             this.SetCuttingParameter(0f);
             this.setCuttingFleshParameter(0f);
             this.setCuttingTreeParameter(0f);
         }
     }
 }
Beispiel #27
0
    private void setupNetSync()
    {
        AnimatorStateInfo currentAnimatorStateInfo  = this.netAnimator.GetCurrentAnimatorStateInfo(1);
        AnimatorStateInfo nextAnimatorStateInfo     = this.netAnimator.GetNextAnimatorStateInfo(1);
        AnimatorStateInfo currentAnimatorStateInfo2 = this.crossbowAnimator.GetCurrentAnimatorStateInfo(0);

        if (currentAnimatorStateInfo.shortNameHash == this.crossbowReloadHash)
        {
            if (currentAnimatorStateInfo.normalizedTime > 0.1f)
            {
                this._boltAnimated.SetActive(true);
            }
            else
            {
                this._boltAnimated.SetActive(false);
            }
            this.crossbowAnimator.SetBool("cancelReload", false);
            this.crossbowAnimator.SetBool("fire", false);
            this.crossbowAnimator.Play(this.reloadHash, 0, currentAnimatorStateInfo.normalizedTime);
            this.doBowSnap = false;
        }
        else if (currentAnimatorStateInfo.shortNameHash == this.crossbowIdleReloadHash || nextAnimatorStateInfo.shortNameHash == this.crossbowIdleReloadHash)
        {
            this.crossbowAnimator.CrossFade(this.idleLoadedHash, 0.1f, 0, 0f);
            this.crossbowAnimator.SetBool("cancelReload", false);
            this.crossbowAnimator.SetBool("fire", false);
            this._boltAnimated.SetActive(true);
            this.doBowSnap = false;
        }
        else if (currentAnimatorStateInfo.shortNameHash == this.crossbowFireHash || nextAnimatorStateInfo.shortNameHash == this.crossbowFireHash)
        {
            if (!this.doBowSnap)
            {
                FMODCommon.PlayOneshot("event:/combat/bow/bow_fire", base.transform);
                this.doBowSnap = true;
            }
            this.crossbowAnimator.SetBool("fire", true);
            this._boltAnimated.SetActive(false);
        }
        else if (currentAnimatorStateInfo.shortNameHash == this.crossbowIdleHash)
        {
            this.crossbowAnimator.SetBool("cancelReload", true);
            this.crossbowAnimator.SetBool("fire", false);
            this._boltAnimated.SetActive(false);
            this.doBowSnap = false;
        }
    }
 public static void PlayOneShot(string eventName, Vector3 position, bool local, float maxDistance)
 {
     if (BoltNetwork.isRunning)
     {
         foreach (BoltEntity current in Scene.SceneTracker.allPlayerEntities)
         {
             if ((current.transform.position - position).sqrMagnitude < maxDistance * maxDistance)
             {
                 FMODNetworkedAudio.SendEvent(eventName, position, current.source);
             }
         }
     }
     if (local)
     {
         FMODCommon.PlayOneshot(eventName, position, new object[0]);
     }
 }
Beispiel #29
0
        private void Update()
        {
            bool    flag        = this.IsClosed();
            Vector3 eulerAngles = this._doorTr.eulerAngles;

            eulerAngles.y            = Mathf.SmoothDampAngle(this._doorTr.eulerAngles.y, this._targetDoorRotation.y, ref this._doorVelocity, this._openSmoothTime);
            this._doorTr.eulerAngles = eulerAngles;
            Vector3 eulerAngles2 = this._doorFlippedTr.eulerAngles;

            eulerAngles2.y = Mathf.SmoothDampAngle(this._doorFlippedTr.eulerAngles.y, this._targetDoorFlippedRotation.y, ref this._doorFlippedVelocity, this._openSmoothTime);
            this._doorFlippedTr.eulerAngles = eulerAngles2;
            this._weightTr.position         = Vector3.SmoothDamp(this._weightTr.position, this._targetWeightPosition, ref this._weightVelocity, this._openSmoothTime);
            if (this.IsClosed() && !flag)
            {
                FMODCommon.PlayOneshot(this._fullyClosedEvent, this._sfxPosition);
            }
        }
Beispiel #30
0
 public void CutDown()
 {
     if (!this.breakEventPlayed)
     {
         FMODCommon.PlayOneshot(this.breakEvent, base.transform);
         this.breakEventPlayed = true;
     }
     this.Cut1.SetActive(true);
     this.Cut2.SetActive(true);
     this.Cut3.SetActive(true);
     this.Cut1.transform.parent = null;
     this.Cut2.transform.parent = null;
     this.Cut3.transform.parent = null;
     this.Cut1.GetComponent <Rigidbody>().AddForce((float)UnityEngine.Random.Range(30, 100), (float)UnityEngine.Random.Range(30, 100), (float)UnityEngine.Random.Range(30, 100));
     this.Cut2.GetComponent <Rigidbody>().AddForce((float)UnityEngine.Random.Range(30, 100), (float)UnityEngine.Random.Range(30, 100), (float)UnityEngine.Random.Range(30, 100));
     this.Cut3.GetComponent <Rigidbody>().AddForce((float)UnityEngine.Random.Range(30, 100), (float)UnityEngine.Random.Range(30, 100), (float)UnityEngine.Random.Range(30, 100));
     UnityEngine.Object.Destroy(base.gameObject);
 }