private void SpawnBlood(DamageInfo info) { if (AI.IsTurtle(this.m_AI.m_ID) || this.m_AI.m_ID == AI.AIID.ArmadilloThreeBanded) { return; } AIManager.BloodFXType key = info.m_DamageItem ? info.m_DamageItem.m_Info.m_BloodFXType : AIManager.BloodFXType.Blunt; List <string> list = AIManager.Get().m_BloodFXNames[(int)key]; if (list.Count == 0) { DebugUtils.Assert("Missing blood fxes!", true, DebugUtils.AssertType.Info); return; } string text = list[UnityEngine.Random.Range(0, list.Count)]; text += ((this.m_AI.m_Params.m_Human || this.m_AI.m_Params.m_BigAnimal) ? "_M" : "_S"); Vector3 vector = Vector3.zero; RagdollBone closestRagdollBone = this.m_AI.GetClosestRagdollBone(info.m_Position); if (closestRagdollBone) { vector = closestRagdollBone.transform.position; } else { vector = base.transform.position; } Vector3 forward = (info.m_Damager && info.m_Damager.IsPlayer()) ? (Camera.main.transform.position - Camera.main.transform.right - vector).normalized : (-info.m_HitDir); ParticlesManager.Get().Spawn(text, vector, Quaternion.LookRotation(forward), Vector3.zero, null, -1f, false); }
private void Start() { ParticlesManager.Get().Spawn("Blood Effect", this.m_HitPos, Quaternion.identity, Vector3.zero, null, -1f, false); this.m_Item.StaticPhxRequestAdd(); this.m_Item.UpdatePhx(); this.m_BoxCollider = base.gameObject.GetComponent <BoxCollider>(); if (this.m_KillItem) { this.m_KillItem.StaticPhxRequestAdd(); this.m_KillItem.UpdatePhx(); base.transform.rotation = this.m_KillItem.m_DamagerStart.rotation; if (this.m_ID == AI.AIID.Arowana) { base.transform.Rotate(Vector3.forward, -60f); } else if (this.m_ID == AI.AIID.Piranha) { base.transform.Rotate(Vector3.forward, -90f); } else if (this.m_ID == AI.AIID.Stingray) { base.transform.Rotate(Vector3.forward, -210f); } else { base.transform.Rotate(Vector3.forward, 0f); } base.transform.parent = this.m_KillItem.transform; this.m_LocalRot = base.transform.localRotation; base.transform.parent = null; Vector3 b = (this.m_KillItem.m_DamagerStart.position - this.m_KillItem.m_DamagerEnd.position).normalized * -0.07f; base.transform.position = this.m_KillItem.m_DamagerStart.position + b; } this.m_WaterBoxCollider = this.m_Tank.GetComponent <BoxCollider>(); }
protected override void OnHitWater(Collider water_coll) { base.OnHitWater(water_coll); if (!this.m_CanHitWater) { return; } if (this.m_WasWaterHit) { return; } water_coll.isTrigger = false; int num = Physics.RaycastNonAlloc(CameraManager.Get().m_MainCamera.transform.position, CameraManager.Get().m_MainCamera.transform.forward, this.m_RaycastResultsTmp, 5f); for (int i = 0; i < num; i++) { if (this.m_RaycastResultsTmp[i].collider.gameObject == water_coll.gameObject) { ParticlesManager.Get().Spawn("SmallSplash_Size_C", this.m_RaycastResultsTmp[i].point - CameraManager.Get().m_MainCamera.transform.forward * 0.2f, Quaternion.identity, Vector3.zero, null, -1f, false); this.m_WasWaterHit = true; break; } } water_coll.isTrigger = true; }
public override void OnAnimEvent(AnimEventID id) { if (id == AnimEventID.SpawnWashingLHandFX) { Transform lhand = Player.Get().GetLHand(); this.m_LHandParticle = ParticlesManager.Get().Spawn("fx_washing_player", lhand.position, Quaternion.identity, Vector3.zero, null, -1f, false); return; } if (id == AnimEventID.SpawnWashingRHandFX) { Transform rhand = Player.Get().GetRHand(); this.m_RHandParticle = ParticlesManager.Get().Spawn("fx_washing_player", rhand.position, Quaternion.identity, Vector3.zero, null, -1f, false); return; } if (id == AnimEventID.DestroyWashingLHandFX) { ParticlesManager.Get().Remove(this.m_LHandParticle); this.m_LHandParticle = null; return; } if (id == AnimEventID.DestroyWashingRHandFX) { ParticlesManager.Get().Remove(this.m_RHandParticle); this.m_RHandParticle = null; } }
private void DelayedSpawnFX() { Vector3 fxToSpawnPos = this.m_FxToSpawnPos; ParticlesManager.Get().Spawn(this.m_FXToSpawn, fxToSpawnPos, Quaternion.identity, Vector3.zero, null, -1f, false); this.m_SpawnFX = false; }
public override void OnAnimEvent(AnimEventID id) { if (id == AnimEventID.HarvestingEnd) { this.m_AnimLoops++; if (this.m_AnimLoops == Skill.Get <HarvestingAnimalsSkill>().GetAnimationsCount()) { this.m_Animator.SetTrigger(this.m_HarvestingFinishHash); return; } } else { if (id == AnimEventID.HarvestingFinishEnd) { this.m_Animator.SetTrigger(this.m_HarvestingAnimalEndHash); this.m_End = true; return; } if (id == AnimEventID.HarvestingSpawnFX) { ParticlesManager.Get().Spawn("Animal Harvest", Camera.main.transform.position + Camera.main.transform.forward * 0.1f + Vector3.down * 0.5f, Player.Get().transform.rotation, Vector3.zero, null, -1f, false); } } }
public override bool TakeDamage(DamageInfo info) { base.TakeDamage(info); ParticlesManager.Get().Spawn("Blood_Effect_Big", base.transform.position, Quaternion.identity, Vector3.zero, null, -1f, false); UnityEngine.Object.Destroy(base.gameObject, 0.2f); return(true); }
private void UpdateParticlesSpawn() { float num = 1f - this.m_Curve.Evaluate((Time.time - this.m_StartTime) / this.m_Duration); float num2 = this.m_VerticesMinY + num * (this.m_VerticesMaxY - this.m_VerticesMinY); for (int i = 0; i < this.m_ParticleSpawnPos.Count; i++) { MiaDisappearEffectController.MiaDisappearEffectParticleSpawnPoint miaDisappearEffectParticleSpawnPoint = this.m_ParticleSpawnPos[i]; if (!miaDisappearEffectParticleSpawnPoint.m_AlreadySpawned && miaDisappearEffectParticleSpawnPoint.m_Pos.y >= num2) { miaDisappearEffectParticleSpawnPoint.m_AlreadySpawned = true; GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.m_Prefab, miaDisappearEffectParticleSpawnPoint.m_Pos, Quaternion.identity); ParticlesManager.Get().Spawn(gameObject, miaDisappearEffectParticleSpawnPoint.m_Pos, Quaternion.identity, Vector3.zero, null, -1f, false); ParticleSystem.ColorOverLifetimeModule colorOverLifetime = gameObject.GetComponent <ParticleSystem>().colorOverLifetime; ParticleSystem.MinMaxGradient color = colorOverLifetime.color; if (color.gradient != null) { GradientColorKey[] array = new GradientColorKey[2]; GradientAlphaKey[] array2 = new GradientAlphaKey[2]; array[0].color = miaDisappearEffectParticleSpawnPoint.m_Color; array[0].time = 0f; array[1].color = miaDisappearEffectParticleSpawnPoint.m_Color; array[1].time = 1f; array2[0].alpha = 1f; array2[0].time = 0f; array2[1].alpha = 0f; array2[1].time = 1f; color.gradient.SetKeys(array, array2); } colorOverLifetime.color = color; } } }
private void OnEnterState() { this.m_EnterStateTime = Time.time; switch (this.m_Animator.GetInteger(this.m_StateHash)) { case 0: this.DestroyFish(); this.m_FishingRod.Break(); return; case 1: this.BlockMoves(false); this.BlockRotation(false); return; case 2: case 3: case 4: case 10: case 11: break; case 5: this.BlockMoves(true); this.m_Player.StartAim(Player.AimType.Fishing, 18f); return; case 6: this.m_FishingRod.StartCast(); PlayerConditionModule.Get().DecreaseStamina(PlayerConditionModule.Get().GetStaminaDecrease(StaminaDecreaseReason.RodCast)); return; case 7: HintsManager.Get().ShowHint("Catch_Fish", 10f); this.m_FishingRod.StartFishing(this.m_Target); ParticlesManager.Get().Spawn("SmallSplash_Size_C", this.m_Target, Quaternion.identity, Vector3.zero, null, -1f, false); return; case 8: PlayerConditionModule.Get().DecreaseStamina(PlayerConditionModule.Get().GetStaminaDecrease(StaminaDecreaseReason.RodReel)); return; case 9: PlayerConditionModule.Get().DecreaseStamina(PlayerConditionModule.Get().GetStaminaDecrease(StaminaDecreaseReason.RodStrike)); break; case 12: this.ShowFish(); this.BlockRotation(true); return; default: return; } }
public void SpawnFX() { Transform transform = this.m_Player.gameObject.transform.FindDeepChild("mixamorig:Head"); Vector3 pos = transform.position + transform.TransformDirection(this.m_ParticlePosShift); ParticlesManager.Get().Spawn("Vomit", pos, transform.rotation, transform); this.m_FXCounter++; if (this.m_FXCounter < 10) { base.Invoke("SpawnFX", 0.1f); } }
private void DestroyWashParticles() { if (this.m_LHandParticle) { ParticlesManager.Get().Remove(this.m_LHandParticle); this.m_LHandParticle = null; } if (this.m_RHandParticle) { ParticlesManager.Get().Remove(this.m_RHandParticle); this.m_RHandParticle = null; } }
private void UpdateBodyFXs() { if (Time.time - this.m_BodyFXSpawnLastTime > this.m_BodyFXSpawnCooldown) { Vector3 position = this.m_Player.GetSpine1().position; float y = this.m_Player.GetWaterLevel() + 0.01f; float y2 = this.m_Player.GetWaterLevel() + 0.02f; position.y = y; ParticlesManager.Get().Spawn("water_splashes_foam_player", position, Quaternion.identity, this.m_WantedSpeed, this.m_Player.transform, 1f, true); position.y = y2; ParticlesManager.Get().Spawn("water_waves_lux_projector", position, Quaternion.identity, this.m_WantedSpeed, this.m_Player.transform, 1f, true); this.m_BodyFXSpawnLastTime = Time.time; } }
private void SpawnSwimHandFXs() { Vector3 position = this.m_Player.GetLHand().position; float y = this.m_Player.GetWaterLevel() + 0.01f; float y2 = this.m_Player.GetWaterLevel() + 0.02f; position.y = y; ParticlesManager.Get().Spawn("water_splashes_foam_player_hand", position, Quaternion.identity, this.m_WantedSpeed, this.m_Player.transform, 1f, true); position.y = y2; ParticlesManager.Get().Spawn("water_splashes_player_hand_a", position, Quaternion.identity, this.m_WantedSpeed, this.m_Player.transform, 1f, true); position = this.m_Player.GetRHand().position; position.y = y; ParticlesManager.Get().Spawn("water_splashes_foam_player_hand", position, Quaternion.identity, this.m_WantedSpeed, this.m_Player.transform, 1f, true); position.y = y2; ParticlesManager.Get().Spawn("water_splashes_player_hand_a", position, Quaternion.identity, this.m_WantedSpeed, this.m_Player.transform, 1f, true); }
public override void OnAnimEvent(AnimEventID id) { base.OnAnimEvent(id); if (id == AnimEventID.MakeFireSuccessEnd) { if (this.m_State == MakeFireController.State.Success && this.m_Fire != null) { this.m_FireTool.m_KindlingSlot.RemoveItem(); Item tool = this.m_Tool; this.m_Player.DropItem(tool); InventoryBackpack.Get().InsertItem(tool, null, null, true, true, true, true, true); this.m_Player.ResetControllerToStart(); this.m_Player.SetWantedItem(Hand.Right, this.m_Fire, true); this.m_Fire.m_ConnectedParticleObj = ParticlesManager.Get().Spawn("Small Smoke - Ember", this.m_Fire.transform.position, Quaternion.identity, Vector3.zero, this.m_Fire.transform, -1f, false); this.m_Fire = null; return; } } else if (id == AnimEventID.MakeFireFailEnd) { if (this.m_State == MakeFireController.State.Fail || this.m_State == MakeFireController.State.Quit) { if (this.m_FireTool != null) { this.m_FireTool.m_KindlingSlot.RemoveItem(); Item tool2 = this.m_Tool; this.m_Player.DropItem(tool2); InventoryBackpack.Get().InsertItem(tool2, null, null, true, true, true, true, true); } this.m_Player.SetWantedItem(Hand.Right, null, true); if (this.m_Kindling != null) { this.m_Kindling.enabled = true; InventoryBackpack.Get().InsertItem(this.m_Kindling, null, null, true, true, true, true, true); this.m_Kindling = null; return; } } } else if (id == AnimEventID.MakeFireTakeFire && this.m_State == MakeFireController.State.Success && !this.m_Fire) { this.m_Fire = ItemsManager.Get().CreateItem(ItemID.Fire, false, Vector3.zero, Quaternion.identity); this.m_Player.AttachItemToHand(Hand.Right, this.m_Fire); UnityEngine.Object.Destroy(this.m_Kindling.gameObject); this.m_Kindling = null; } }
private void UpdateEffects() { if (this.m_FireLevel < this.m_MinFireLevelToEnableEffects) { this.m_FireTool.m_Light.enabled = false; this.m_FireTool.m_Emission.enabled = false; return; } this.m_FireTool.m_Light.enabled = true; this.m_FireTool.m_Emission.enabled = true; this.m_FireTool.m_Light.intensity = CJTools.Math.GetProportionalClamp(0f, this.m_MaxLightIntensity, this.m_FireLevel, this.m_MinFireLevelToEnableEffects, 1f); if (!this.m_FXSpawned && this.m_FireLevel >= this.m_MinFireLevelToEnableEffects) { this.m_ParticleObj = ParticlesManager.Get().Spawn("Small Smoke - Ember", this.m_FireTool.m_KindlingSlot.transform.position, Quaternion.identity, null); this.m_FXSpawned = true; } }
public override void OnAnimEvent(AnimEventID id) { if (id == AnimEventID.HarvestingEnd) { this.m_AnimLoops++; if (this.m_AnimLoops == Skill.Get <HarvestingAnimalsSkill>().GetAnimationsCount()) { this.m_Animator.SetTrigger(this.m_HarvestingFinishHash); } } else if (id == AnimEventID.HarvestingFinishEnd) { this.m_Body.Harvest(); this.Stop(); } else if (id == AnimEventID.HarvestingSpawnFX) { ParticlesManager.Get().Spawn("Animal Harvest", Player.Get().GetRHand().position, Player.Get().GetRHand().rotation, null); } }
public override void OnTakeDamage(DamageInfo info) { base.OnTakeDamage(info); AIManager.BloodFXType key = (!info.m_DamageItem) ? AIManager.BloodFXType.Blunt : info.m_DamageItem.m_Info.m_BloodFXType; List <string> list = AIManager.Get().m_BloodFXNames[(int)key]; if (list.Count == 0) { DebugUtils.Assert("Missing blood fxes!", true, DebugUtils.AssertType.Info); return; } string text = list[UnityEngine.Random.Range(0, list.Count)]; text += ((!this.m_AI.m_Params.m_Human && !this.m_AI.m_Params.m_BigAnimal) ? "_S" : "_M"); Vector3 vector = Vector3.zero; if (this.m_AI.m_RagdollBones.Count > 0) { float num = float.MaxValue; foreach (Collider collider in this.m_AI.m_RagdollBones.Keys) { Vector3 vector2 = collider.ClosestPoint(info.m_Position); float num2 = vector2.Distance(info.m_Position); if (num2 < num) { vector = vector2; Transform transform = collider.transform; num = num2; } } } else { vector = base.transform.position; } ParticlesManager.Get().Spawn(text, vector, Quaternion.LookRotation((Camera.main.transform.position - Camera.main.transform.right - vector).normalized), null); this.m_DamageAudioSource.Stop(); this.m_DamageAudioSource.clip = AIManager.Get().m_FleshHitSounds[UnityEngine.Random.Range(0, AIManager.Get().m_FleshHitSounds.Count)]; this.m_DamageAudioSource.Play(); }
public override void OnAnimEvent(AnimEventID id) { base.OnAnimEvent(id); if (id == AnimEventID.GrabItem || id == AnimEventID.DrinkLiquid) { if (this.m_TriggerToExecute) { this.m_TriggerToExecute.OnExecute(this.m_TriggerActionToExecute); this.m_TriggerActionToExecute = TriggerAction.TYPE.None; this.m_LastTrigerExecutionTime = Time.time; this.m_TriggerToExecute = null; return; } } else { if (id == AnimEventID.GrabItemEnd) { this.m_Animator.SetBool(TriggerController.s_BGrabItem, false); this.m_Animator.SetBool(TriggerController.s_BGrabItemBow, false); this.m_Animator.SetBool(TriggerController.s_BGrabItemBambooBow, false); this.m_TriggerToExecute = null; return; } if (id == AnimEventID.DrinkLiquidEnd) { this.m_Animator.SetBool(this.m_BDrinkWater, false); this.m_TriggerInAction = false; return; } if (id == AnimEventID.DrinkLiquidStart) { Vector3 pos = base.transform.position + base.transform.forward * 0.6f; pos.y = this.m_BestTrigger.hit_pos.y; ParticlesManager.Get().Spawn("SmallSplash_Size_C", pos, Quaternion.identity, Vector3.zero, null, -1f, false); } } }
protected override void OnHitWater(Collider water_coll) { base.OnHitWater(water_coll); if (!this.m_CanHitWater) { return; } if (this.m_WasWaterHit) { return; } water_coll.isTrigger = false; RaycastHit[] array = Physics.RaycastAll(Camera.main.transform.position, Camera.main.transform.forward, 5f); for (int i = 0; i < array.Length; i++) { if (array[i].collider.gameObject == water_coll.gameObject) { ParticlesManager.Get().Spawn("SmallSplash_Size_C", array[i].point - Camera.main.transform.forward * 0.2f, Quaternion.identity, null); this.m_WasWaterHit = true; break; } } water_coll.isTrigger = true; }
public void SetBiting(bool set) { this.m_Biting = set; ParticlesManager.Get().Spawn("SmallSplash_Size_C", this.m_FloatPos, Quaternion.identity, Vector3.zero, null, -1f, false); }
private void OnSetState() { this.m_StartStateTime = Time.time; switch (this.m_State) { case MakeFireController.State.None: if (this.m_Kindling) { UnityEngine.Object.Destroy(this.m_Kindling.gameObject); } if (this.m_FireTool) { if (this.m_FireTool.m_Animator.isInitialized) { this.m_FireTool.m_Animator.SetBool(this.m_ToolAnimHash, false); } this.m_FireTool.m_Light.enabled = false; this.m_FireTool.m_Emission.enabled = false; this.m_FireTool.m_KindlingSlot.Deactivate(); this.m_FireTool.m_KindlingSlot.gameObject.SetActive(false); if (this.m_FireTool.m_AnimationVis) { this.m_FireTool.m_AnimationVis.SetActive(false); } if (this.m_FireTool.m_NormalVis) { this.m_FireTool.m_NormalVis.SetActive(true); } this.m_FireTool = null; } if (this.m_Tool) { this.m_Tool.StaticPhxRequestRemove(); this.m_Tool.OnRemovedFromHand(); this.m_Tool = null; } if (this.m_Animator.isInitialized) { this.m_Animator.SetBool(this.m_PlayerIdleAnimHash, false); this.m_Animator.SetBool(this.m_PlayerAnimHash, false); this.m_Animator.SetBool(this.m_SuccessHash, false); this.m_Animator.SetBool(this.m_FailHash, false); } if (this.m_ParticleObj) { ParticlesManager.Get().Remove(this.m_ParticleObj); this.m_ParticleObj = null; } this.m_FXSpawned = false; this.m_Player.UnblockMoves(); this.m_Player.UnblockRotation(); break; case MakeFireController.State.WaitingForKindling: this.m_FireLevel = 0f; this.m_Tool = (ItemTool)this.m_Player.GetCurrentItem(Hand.Right); DebugUtils.Assert(this.m_Tool != null, "[MakeFireController:OnEnable] ERROR - Currentitem is not a Fire Tool!", true, DebugUtils.AssertType.Info); this.m_Tool.ItemsManagerUnregister(); this.m_FireTool = this.m_Tool.GetComponent <FireTool>(); DebugUtils.Assert(this.m_FireTool != null, "[MakeFireController:OnEnable] ERROR - Missing FireTool component!", true, DebugUtils.AssertType.Info); this.m_FireTool.m_KindlingSlot.gameObject.SetActive(true); this.m_FireTool.m_KindlingSlot.Activate(); this.m_Tool.StaticPhxRequestAdd(); if (this.m_FireTool.m_AnimationVis) { this.m_FireTool.m_AnimationVis.SetActive(true); } if (this.m_FireTool.m_NormalVis) { this.m_FireTool.m_NormalVis.SetActive(false); } this.m_Player.BlockMoves(); this.m_Player.BlockRotation(); this.m_Animator.CrossFadeInFixedTime(this.m_PlayerIdleAnimHash, 0.25f, this.m_SpineLayerIndex); this.m_Animator.CrossFadeInFixedTime(this.m_PlayerIdleAnimHash, 0.25f, this.m_BaseLayerIndex); this.m_Animator.SetBool(this.m_PlayerIdleAnimHash, true); this.m_Animator.SetBool(this.m_PlayerAnimHash, false); this.m_Animator.SetBool(this.m_SuccessHash, false); this.m_Animator.SetBool(this.m_FailHash, false); this.m_Tool.OnWaitingForKindling(); break; case MakeFireController.State.Game: PlayerSanityModule.Get().OnWhispersEvent(PlayerSanityModule.WhisperType.StartFire); this.m_Tool.OnStartMakeFireGame(); this.m_Animator.CrossFadeInFixedTime(this.m_PlayerAnimHash, 0.25f, this.m_SpineLayerIndex); this.m_Animator.CrossFadeInFixedTime(this.m_PlayerAnimHash, 0.25f, this.m_BaseLayerIndex); this.m_Animator.SetBool(this.m_PlayerAnimHash, true); this.m_Animator.SetBool(this.m_PlayerIdleAnimHash, false); this.m_FireTool.m_Animator.SetBool(this.m_ToolAnimHash, true); this.m_FireTool.m_KindlingSlot.gameObject.SetActive(false); this.m_FireTool.m_KindlingSlot.Deactivate(); this.m_Kindling.enabled = false; Inventory3DManager.Get().Deactivate(); this.CalcStaminaConsumption(); this.PlaySound(); break; case MakeFireController.State.Fail: this.m_Tool.OnFailMakeFireGame(); this.m_Animator.SetBool(this.m_FailHash, true); ParticlesManager.Get().Remove(this.m_ParticleObj); this.m_ParticleObj = null; this.m_FireTool.m_Animator.SetBool(this.m_ToolAnimHash, false); this.StopSound(); HintsManager.Get().ShowHint("MakeFire_Fail", 10f); break; case MakeFireController.State.Success: Skill.Get <MakeFireSkill>().OnSkillAction(); ParticlesManager.Get().Remove(this.m_ParticleObj); this.m_ParticleObj = null; this.m_Tool.OnSuccessMakeFireGame(); this.m_Animator.SetBool(this.m_SuccessHash, true); this.m_FireTool.m_Animator.SetBool(this.m_ToolAnimHash, false); this.StopSound(); break; } }
protected virtual void SpawnFX(string fx_name, Vector3 hit_pos) { ParticlesManager.Get().Spawn(fx_name, hit_pos, Quaternion.identity, null); }