Ejemplo n.º 1
0
 public void DestroyTrunk()
 {
     UnityEngine.Object.Destroy(this.Trunk);
     if (this.PerchTargets != null)
     {
         this.PerchTargets.SetActive(true);
     }
     if (this.LodTree != null)
     {
         this.LodTree.SendMessageToTargets("OnTreeCutDown", this.TrunkUpperSpawn);
         IEnumerator enumerator = base.transform.GetEnumerator();
         try
         {
             while (enumerator.MoveNext())
             {
                 object           obj       = enumerator.Current;
                 Transform        transform = (Transform)obj;
                 ExplodeTreeStump component = transform.GetComponent <ExplodeTreeStump>();
                 if (component)
                 {
                     transform.parent = this.LodTree.transform;
                     component.CoolDown();
                     UnityEngine.Object.Destroy(base.gameObject, 0.01f);
                     break;
                 }
             }
         }
         finally
         {
             IDisposable disposable;
             if ((disposable = (enumerator as IDisposable)) != null)
             {
                 disposable.Dispose();
             }
         }
     }
 }
Ejemplo n.º 2
0
 private void OnTriggerStay(Collider other)
 {
     if (other.gameObject.CompareTag("jumpObject") || other.gameObject.CompareTag("UnderfootWood"))
     {
         ExplodeTreeStump component = other.transform.GetComponent <ExplodeTreeStump>();
         if (component)
         {
             this.atStump = true;
             this.animator.SetFloatReflected("terrainAngle", 0f, 0.5f, Time.deltaTime * 2f);
             this.animator.SetFloatReflected("axeBlend1", 1f, 0.5f, Time.deltaTime * 2f);
         }
     }
     if (other.gameObject.CompareTag("animalCollide") || other.gameObject.CompareTag("Shell"))
     {
         animalId component2 = other.transform.GetComponent <animalId>();
         if (component2)
         {
             this.atStump = true;
             this.animator.SetFloatReflected("terrainAngle", 0f, 0.5f, Time.deltaTime * 2f);
             this.animator.SetFloatReflected("axeBlend1", -1f, 0.5f, Time.deltaTime * 2f);
         }
     }
     else if (other.gameObject.CompareTag("Float"))
     {
         this.atStump = true;
         this.animator.SetFloatReflected("terrainAngle", 0f, 0.5f, Time.deltaTime * 2f);
         this.animator.SetFloatReflected("axeBlend1", -0.5f, 0.5f, Time.deltaTime * 2f);
     }
     if (other.gameObject.CompareTag("enemyCollide"))
     {
         this.currEnemyCheck = true;
         if (Vector3.Distance(LocalPlayer.Transform.position, other.transform.position) < 5f)
         {
             this.forceExit();
             return;
         }
     }
     if (other.gameObject.CompareTag("treeTrigger") || other.gameObject.CompareTag("Tree"))
     {
         this.inAnyTreeTrigger = true;
         if (!this.treeTriggers.Contains(other))
         {
             this.inTreeCounter++;
             this.treeTriggers.Add(other);
             this.lastTreeCollider = other;
         }
         this.currTree      = other.gameObject;
         this.currTreeCheck = true;
         getAxePos component3 = other.GetComponent <getAxePos>();
         if (component3)
         {
             this.treeTriggerPos = component3.axePosTr.position;
         }
         else
         {
             this.treeTriggerPos = this.currTree.transform.position;
         }
         this.setup.pmControl.FsmVariables.GetFsmVector3("lookAtTreePos").Value = other.transform.position;
         this.atTree = true;
         this.treeTriggers.RemoveAll((Collider o) => o == null);
         if (this.treeTriggers.Count > 1)
         {
             this.treeTriggers.Sort((Collider c1, Collider c2) => (base.transform.position - new Vector3(c1.transform.position.x, base.transform.position.y, c1.transform.position.z)).sqrMagnitude.CompareTo((base.transform.position - new Vector3(c2.transform.position.x, base.transform.position.y, c2.transform.position.z)).sqrMagnitude));
         }
         this.treePos = new Vector3(this.treeTriggers[0].transform.position.x, base.transform.position.y, this.treeTriggers[0].transform.position.z);
         Vector3 position = LocalPlayer.PlayerBase.transform.position;
         position.y    = base.transform.position.y;
         this.distance = Vector3.Distance(position, this.treePos);
         if (this.distance < this.cutThreshold)
         {
             if (!this.startedAxeAdjust)
             {
                 base.StartCoroutine("setAxeHeight");
                 this.startedAxeAdjust = true;
             }
             this.fsmLookAtTree.Value = true;
             this.animator.SetBoolReflected("bigTree", true);
             this.animator.SetFloatReflected("weaponHit", 1f);
         }
         else
         {
             this.fsmLookAtTree.Value = false;
             this.forceExit();
             this.animator.SetBoolReflected("bigTree", false);
             this.animator.SetFloatReflected("weaponHit", 0f);
         }
     }
 }
Ejemplo n.º 3
0
 private void OnTriggerStay(Collider other)
 {
     if (other.gameObject.CompareTag("FireTrigger"))
     {
         Fire2 component = other.GetComponent <Fire2>();
         if (component && LocalPlayer.Animator.GetCurrentAnimatorStateInfo(1).shortNameHash == this.drawBowIdleHash)
         {
             if (component.CurrentLit)
             {
                 float num = 1.8f;
                 if (component.isBonfire)
                 {
                     num = 4.4f;
                 }
                 float num2;
                 if (LocalPlayer.Inventory.HasInSlot(Item.EquipmentSlot.RightHand, LocalPlayer.AnimControl._bowRecurveId))
                 {
                     num2 = Vector3.Distance(other.transform.position, LocalPlayer.ScriptSetup.heldModernBowTip.transform.position);
                 }
                 else
                 {
                     num2 = Vector3.Distance(other.transform.position, LocalPlayer.ScriptSetup.heldBowTip.transform.position);
                 }
                 if (num2 < num)
                 {
                     if (Time.time > this.lightArrowTimer)
                     {
                         BowController component2;
                         if (LocalPlayer.Inventory.HasInSlot(Item.EquipmentSlot.RightHand, LocalPlayer.AnimControl._bowRecurveId))
                         {
                             component2 = LocalPlayer.ScriptSetup.heldModernBow.GetComponent <BowController>();
                         }
                         else
                         {
                             component2 = LocalPlayer.ScriptSetup.heldBow.GetComponent <BowController>();
                         }
                         if (component2 && component2._activeAmmoBonus != WeaponStatUpgrade.Types.BurningAmmo && component2._activeFireArrowGO == null)
                         {
                             component2.gameObject.SendMessage("LightArrow");
                         }
                     }
                 }
                 else
                 {
                     this.lightArrowTimer = Time.time + 1.7f;
                 }
             }
         }
         else
         {
             this.lightArrowTimer = Time.time + 1.7f;
         }
     }
     else if (other.gameObject.CompareTag("jumpObject") || other.gameObject.CompareTag("UnderfootWood"))
     {
         ExplodeTreeStump component3 = other.transform.GetComponent <ExplodeTreeStump>();
         if (component3)
         {
             this.atStump = true;
             this.animator.SetFloatReflected("terrainAngle", 0f, 0.5f, Time.deltaTime * 2f);
             this.animator.SetFloatReflected("axeBlend1", 1f, 0.5f, Time.deltaTime * 2f);
         }
     }
     else if (other.gameObject.CompareTag("animalCollide") || other.gameObject.CompareTag("Shell"))
     {
         animalId component4 = other.transform.GetComponent <animalId>();
         if (component4)
         {
             this.atStump = true;
             this.animator.SetFloatReflected("terrainAngle", 0f, 0.5f, Time.deltaTime * 2f);
             this.animator.SetFloatReflected("axeBlend1", -1f, 0.5f, Time.deltaTime * 2f);
         }
     }
     else if (other.gameObject.CompareTag("Float"))
     {
         this.atStump = true;
         this.animator.SetFloatReflected("terrainAngle", 0f, 0.5f, Time.deltaTime * 2f);
         this.animator.SetFloatReflected("axeBlend1", -0.5f, 0.5f, Time.deltaTime * 2f);
     }
     else if (other.gameObject.CompareTag("enemyCollide"))
     {
         this.currEnemyCheck = true;
         if (Vector3.Distance(LocalPlayer.Transform.position, other.transform.position) < 5f)
         {
             this.forceExit();
             return;
         }
     }
     else if (other.gameObject.CompareTag("treeTrigger") || other.gameObject.CompareTag("Tree"))
     {
         this.inAnyTreeTrigger = true;
         if (!this.treeTriggers.Contains(other))
         {
             this.inTreeCounter++;
             this.treeTriggers.Add(other);
             this.lastTreeCollider = other;
         }
         this.currTree      = other.gameObject;
         this.currTreeCheck = true;
         getAxePos component5 = other.GetComponent <getAxePos>();
         if (component5)
         {
             if (component5.ants != null)
             {
                 component5.ants.SetActive(true);
             }
             this.treeTriggerPos = component5.axePosTr.position;
         }
         else
         {
             this.treeTriggerPos = this.currTree.transform.position;
         }
         this.setup.pmControl.FsmVariables.GetFsmVector3("lookAtTreePos").Value = other.transform.position;
         this.atTree = true;
         this.treeTriggers.RemoveAll((Collider o) => o == null);
         if (this.treeTriggers.Count > 1)
         {
             this.treeTriggers.Sort((Collider c1, Collider c2) => (base.transform.position - new Vector3(c1.transform.position.x, base.transform.position.y, c1.transform.position.z)).sqrMagnitude.CompareTo((base.transform.position - new Vector3(c2.transform.position.x, base.transform.position.y, c2.transform.position.z)).sqrMagnitude));
         }
         this.treePos = new Vector3(this.treeTriggers[0].transform.position.x, base.transform.position.y, this.treeTriggers[0].transform.position.z);
         Vector3 position = LocalPlayer.PlayerBase.transform.position;
         position.y    = base.transform.position.y;
         this.distance = Vector3.Distance(position, this.treePos);
         if (this.distance < this.cutThreshold)
         {
             if (!this.startedAxeAdjust)
             {
                 base.StartCoroutine("setAxeHeight");
                 this.startedAxeAdjust = true;
             }
             this.fsmLookAtTree.Value = true;
             this.animator.SetBoolReflected("bigTree", true);
             this.animator.SetFloatReflected("weaponHit", 1f);
         }
         else
         {
             this.fsmLookAtTree.Value = false;
             this.forceExit();
             this.animator.SetBoolReflected("bigTree", false);
             this.animator.SetFloatReflected("weaponHit", 0f);
         }
     }
 }