예제 #1
0
파일: PickUp.cs 프로젝트: K07H/The-Forest
 protected virtual void OwnershipCheck()
 {
     if (LocalPlayer.Inventory)
     {
         if (this._positionHashSaving)
         {
             if (GlobalDataSaver.GetInt(base.transform.ToGeoHash(), 0) == 1)
             {
                 this.ClearOut(false);
             }
             else
             {
                 this.OwnershipCheckUnregister();
             }
         }
         else if (LocalPlayer.Inventory.Owns(this._itemId, true))
         {
             if (this._destroyIfAlreadyOwned && !BoltNetwork.isRunning)
             {
                 this.ClearOut(false);
             }
             else if (this._destroyTarget.activeSelf)
             {
                 this._destroyTarget.SetActive(false);
             }
         }
         else if (!this._destroyTarget.activeSelf)
         {
             this._destroyTarget.SetActive(true);
         }
     }
 }
예제 #2
0
 private IEnumerator Start()
 {
     if (!BoltNetwork.isClient && !this.HiddenCache)
     {
         bool flag = GlobalDataSaver.GetInt(base.transform.ToGeoHash() + "_exploded", 0) == 1;
         if (flag)
         {
             this.SetExplodedMp();
             this.DoExplodeFinal();
         }
     }
     if (BoltNetwork.isClient || (BoltNetwork.isServer && !this.HiddenCache))
     {
         this.PositionHashBlownUpCheck();
     }
     else if (this.HiddenCache)
     {
         while (LevelSerializer.IsDeserializing)
         {
             yield return(null);
         }
         if (GlobalDataSaver.GetInt("HiddenCache" + this.CacheIndex, 0) == 1)
         {
             if (this.InsidePos)
             {
                 this.InsidePos.gameObject.SetActive(true);
             }
             UnityEngine.Object.Destroy(base.gameObject);
             this.SetExplodedMp();
         }
     }
     yield break;
 }
예제 #3
0
 private void DoExplode()
 {
     this.blownUp = true;
     this.Cut1.SetActive(true);
     this.Cut2.SetActive(true);
     this.Cut3.SetActive(true);
     this.Cut4.SetActive(true);
     this.Cut5.SetActive(true);
     this.Cut1.transform.parent = null;
     this.Cut2.transform.parent = null;
     this.Cut3.transform.parent = null;
     this.Cut4.transform.parent = null;
     this.Cut5.transform.parent = null;
     this.Cut1.GetComponent <Rigidbody>().AddForce((float)UnityEngine.Random.Range(15, 50), (float)UnityEngine.Random.Range(25, 50), (float)UnityEngine.Random.Range(15, 50), ForceMode.Impulse);
     this.Cut2.GetComponent <Rigidbody>().AddForce((float)UnityEngine.Random.Range(15, 50), (float)UnityEngine.Random.Range(25, 50), (float)UnityEngine.Random.Range(15, 50), ForceMode.Impulse);
     this.Cut3.GetComponent <Rigidbody>().AddForce((float)UnityEngine.Random.Range(15, 50), (float)UnityEngine.Random.Range(25, 50), (float)UnityEngine.Random.Range(15, 50), ForceMode.Impulse);
     this.Cut4.GetComponent <Rigidbody>().AddForce((float)UnityEngine.Random.Range(15, 50), (float)UnityEngine.Random.Range(25, 50), (float)UnityEngine.Random.Range(15, 50), ForceMode.Impulse);
     this.Cut5.GetComponent <Rigidbody>().AddForce((float)UnityEngine.Random.Range(15, 50), (float)UnityEngine.Random.Range(25, 50), (float)UnityEngine.Random.Range(15, 50), ForceMode.Impulse);
     if (this.InsidePos)
     {
         this.InsidePos.gameObject.SetActive(true);
         if (this.HiddenCache && this.WorldItem.Length > 0)
         {
             this.MyItem = UnityEngine.Object.Instantiate <GameObject>(this.WorldItem[UnityEngine.Random.Range(0, this.WorldItem.Length - 1)], this.InsidePos.position, this.InsidePos.rotation);
             this.MyItem.transform.parent = this.InsidePos.transform;
         }
         if (this.SpawnWhenExplode != null && this.SpawnWhenExplode.Length > 0)
         {
             foreach (GameObject original in this.SpawnWhenExplode)
             {
                 Vector3 vector = this.InsidePos.position + new Vector3(UnityEngine.Random.value * 0.5f, 0f, UnityEngine.Random.value * 0.5f);
                 float   num    = Terrain.activeTerrain.SampleHeight(vector);
                 if (vector.y < num)
                 {
                     vector.y = num + 0.2f;
                 }
                 this.MyItem = UnityEngine.Object.Instantiate <GameObject>(original, vector, this.InsidePos.rotation);
                 this.MyItem.transform.parent = this.InsidePos.transform;
             }
         }
     }
     if (this.RopePlace)
     {
         this.MyRopeMaker.SetActive(true);
     }
     if (!BoltNetwork.isClient)
     {
         if (this.HiddenCache)
         {
             GlobalDataSaver.SetInt("HiddenCache" + this.CacheIndex, 1);
         }
         else
         {
             GlobalDataSaver.SetInt(base.transform.ToGeoHash() + "_exploded", 1);
         }
     }
     UnityEngine.Object.Destroy(base.gameObject);
 }
예제 #4
0
 private void Collect()
 {
     if (this._pendingdestroythroughbolt)
     {
         return;
     }
     if (this.MainEffect() || this._destroyIfFull)
     {
         if (this._positionHashSaving)
         {
             GlobalDataSaver.SetInt(SceneUtils.PositionToLongHash(base.transform.position), 1);
         }
         this.CollectBonuses();
         if (this._spiderDice && UnityEngine.Random.Range(0, 4) == 2)
         {
             UnityEngine.Object.Instantiate(Resources.Load("Spider"), base.transform.position, base.transform.rotation);
         }
         if (this._spawnAfterPickupPrefab)
         {
             if (!BoltNetwork.isRunning)
             {
                 UnityEngine.Object.Instantiate(this._spawnAfterPickupPrefab, base.transform.position, base.transform.rotation);
             }
             else
             {
                 BoltNetwork.Instantiate(this._spawnAfterPickupPrefab, base.transform.position, base.transform.rotation);
             }
         }
         if (!this.TryPool() && !this._infinite)
         {
             this.ClearOut(false);
         }
     }
     else if (!this._preventFakeDrop)
     {
         if (this._positionHashSaving)
         {
             GlobalDataSaver.SetInt(SceneUtils.PositionToLongHash(base.transform.position), 1);
         }
         if (this._spawnAfterPickupPrefab)
         {
             if (!BoltNetwork.isRunning)
             {
                 UnityEngine.Object.Instantiate(this._spawnAfterPickupPrefab, base.transform.position, base.transform.rotation);
             }
             else
             {
                 BoltNetwork.Instantiate(this._spawnAfterPickupPrefab, base.transform.position, base.transform.rotation);
             }
         }
         this.ClearOut(true);
     }
 }
예제 #5
0
파일: PickUp.cs 프로젝트: K07H/The-Forest
 private void Collect()
 {
     if (this._pendingdestroythroughbolt)
     {
         return;
     }
     if (this._fakeArrowPickup)
     {
         base.transform.parent.SendMessage("sendRemoveArrow", SendMessageOptions.DontRequireReceiver);
     }
     if (this._unparentArrows)
     {
         CoopWeaponArrowFire componentInChildren = base.transform.parent.GetComponentInChildren <CoopWeaponArrowFire>();
         if (componentInChildren)
         {
             componentInChildren.transform.parent = null;
         }
     }
     if (this._firstTimePickup)
     {
         if (LocalPlayer.Animator)
         {
             LocalPlayer.Animator.SetBool("firstTimePickup", true);
         }
     }
     else if (LocalPlayer.Animator)
     {
         LocalPlayer.Animator.SetBool("firstTimePickup", false);
     }
     if (base.transform.parent)
     {
         artifactBallPlacedController componentInParent = base.transform.GetComponentInParent <artifactBallPlacedController>();
         if (componentInParent)
         {
             componentInParent.setHeldArtifactState();
         }
     }
     if (this._hairSprayFuel && LocalPlayer.Stats.hairSprayFuel.CurrentFuel < LocalPlayer.Stats.hairSprayFuel.MaxFuelCapacity)
     {
         LocalPlayer.Stats.hairSprayFuel.CurrentFuel = LocalPlayer.Stats.hairSprayFuel.MaxFuelCapacity;
     }
     this.CheckTrappedAnimal();
     if (this.MainEffect() || this._destroyIfFull)
     {
         if (this._positionHashSaving)
         {
             GlobalDataSaver.SetInt(base.transform.ToGeoHash(), 1);
         }
         this.CollectBonuses();
         if (this._spiderDice && UnityEngine.Random.Range(0, 4) == 2)
         {
             UnityEngine.Object.Instantiate(Resources.Load("Spider"), base.transform.position, base.transform.rotation);
         }
         if (this._spawnAfterPickupPrefab)
         {
             Vector3 vector = base.transform.position;
             if (this._useSkinAnimalRoutine)
             {
                 vector += LocalPlayer.Transform.forward * 1.1f;
             }
             if (!BoltNetwork.isRunning || !this._spawnAfterPickupPrefab.GetComponent <BoltEntity>())
             {
                 UnityEngine.Object.Instantiate <GameObject>(this._spawnAfterPickupPrefab, vector, Quaternion.identity);
             }
             else
             {
                 BoltNetwork.Instantiate(this._spawnAfterPickupPrefab, vector, Quaternion.identity);
             }
             if (this._spawnAfterPickupPrefab2)
             {
                 if (!BoltNetwork.isRunning || !this._spawnAfterPickupPrefab2.GetComponent <BoltEntity>())
                 {
                     UnityEngine.Object.Instantiate <GameObject>(this._spawnAfterPickupPrefab2, vector, Quaternion.identity);
                 }
                 else
                 {
                     BoltNetwork.Instantiate(this._spawnAfterPickupPrefab2, vector, Quaternion.identity);
                 }
             }
         }
         if (!this.TryPool() && !this._infinite)
         {
             this.ClearOut(false);
         }
     }
     else if (!this._preventFakeDrop)
     {
         if (this._positionHashSaving)
         {
             GlobalDataSaver.SetInt(base.transform.ToGeoHash(), 1);
         }
         if (this._spawnAfterPickupPrefab)
         {
             Vector3 vector2 = base.transform.position;
             if (this._useSkinAnimalRoutine)
             {
                 vector2 += LocalPlayer.Transform.forward * 1.1f;
             }
             if (!BoltNetwork.isRunning || !this._spawnAfterPickupPrefab.GetComponent <BoltEntity>())
             {
                 UnityEngine.Object.Instantiate <GameObject>(this._spawnAfterPickupPrefab, vector2, Quaternion.identity);
             }
             else
             {
                 BoltNetwork.Instantiate(this._spawnAfterPickupPrefab, vector2, Quaternion.identity);
             }
             if (this._spawnAfterPickupPrefab2)
             {
                 if (!BoltNetwork.isRunning || !this._spawnAfterPickupPrefab2.GetComponent <BoltEntity>())
                 {
                     UnityEngine.Object.Instantiate <GameObject>(this._spawnAfterPickupPrefab2, vector2, Quaternion.identity);
                 }
                 else
                 {
                     BoltNetwork.Instantiate(this._spawnAfterPickupPrefab2, vector2, Quaternion.identity);
                 }
             }
         }
         this.ClearOut(true);
     }
 }