public void AddBodyMP(BoltEntity body) { Debug.Log("addbodymp1"); if (!body) { return; } Debug.Log("addbodymp2"); dummyTypeSetup componentInChildren = body.gameObject.GetComponentInChildren <dummyTypeSetup>(); IMultiHolderState state; MultiHolder multiHolder; if (base.state.IsReal) { state = base.state; multiHolder = this; Debug.Log("addbodymp3-1"); } else { state = base.state.Replaces.GetState <IMultiHolderState>(); multiHolder = base.state.Replaces.GetComponentsInChildren <MultiHolder>(true)[0]; Debug.Log("addbodymp3-2"); } if (multiHolder._bodyTypes == null || multiHolder._bodyTypes.Length == 0) { Debug.Log("addbodymp4"); multiHolder._bodyTypes = new EnemyType[3]; } if (state.Body0 == null) { Debug.Log("addbodymp5"); state.Body0 = body; state.Body0.GetState <IMutantState>().Transform.SetTransforms(null, null); multiHolder._bodyTypes[0] = componentInChildren._type; multiHolder._contentActual = 1; multiHolder._contentTypeActual = MultiHolder.ContentTypes.Body; MultiHolder.GetTriggerChild(body.transform).gameObject.SetActive(false); } else if (state.Body1 == null) { Debug.Log("addbodymp6"); state.Body1 = body; state.Body1.GetState <IMutantState>().Transform.SetTransforms(null, null); multiHolder._bodyTypes[1] = componentInChildren._type; multiHolder._contentActual = 2; multiHolder._contentTypeActual = MultiHolder.ContentTypes.Body; MultiHolder.GetTriggerChild(body.transform).gameObject.SetActive(false); } else if (state.Body2 == null) { Debug.Log("addbodymp7"); state.Body2 = body; state.Body2.GetState <IMutantState>().Transform.SetTransforms(null, null); multiHolder._bodyTypes[2] = componentInChildren._type; multiHolder._contentActual = 3; multiHolder._contentTypeActual = MultiHolder.ContentTypes.Body; MultiHolder.GetTriggerChild(body.transform).gameObject.SetActive(false); } }
private void BodyContentUpdate(ref MultiHolder.ContentTypes showAddIcon) { if (BoltNetwork.isRunning) { this.BodyContentUpdate_MP(ref showAddIcon); return; } if (this._contentActual > 0 && !LocalPlayer.AnimControl.heldBodyGo.activeSelf && !LocalPlayer.Inventory.Logs.HasLogs) { this.TakeIcon.SetActive(true); if (TheForest.Utils.Input.GetButtonDown("Take")) { LocalPlayer.AnimControl.setMutantPickUp(this.PickUpBody()); this.RefreshMassAndDrag(); this.TakeIcon.SetActive(false); } } if (this._contentActual < 3 && LocalPlayer.AnimControl.carry) { showAddIcon = MultiHolder.ContentTypes.Body; if (TheForest.Utils.Input.GetButtonDown("Craft")) { if (this._bodies == null) { this._bodies = new GameObject[3]; } if (this._bodyTypes == null || this._bodyTypes.Length < 3) { this._bodyTypes = new EnemyType[3]; } this._contentTypeActual = MultiHolder.ContentTypes.Body; this._emitter.Play(); LocalPlayer.AnimControl.heldBodyGo.SetActive(false); GameObject placedBodyGo = LocalPlayer.AnimControl.placedBodyGo; dummyTypeSetup dummyTypeSetup = placedBodyGo.GetComponent <dummyTypeSetup>() ?? placedBodyGo.GetComponentInChildren <dummyTypeSetup>(); placedBodyGo.SetActive(true); placedBodyGo.SendMessage("dropFromCarry", SendMessageOptions.DontRequireReceiver); MultiHolder.GetTriggerChild(placedBodyGo.transform).gameObject.SetActive(false); placedBodyGo.transform.position = this.MutantBodySlots[this._contentActual].transform.position; placedBodyGo.transform.rotation = this.MutantBodySlots[this._contentActual].transform.rotation; placedBodyGo.transform.parent = base.transform.root; dummyAnimatorControl dummyAnimatorControl = placedBodyGo.GetComponent <dummyAnimatorControl>() ?? placedBodyGo.GetComponentInChildren <dummyAnimatorControl>(); dummyAnimatorControl.enabled = false; this._bodyTypes[this._contentActual] = dummyTypeSetup._type; this._bodies[this._contentActual] = placedBodyGo; this._contentActual++; this.RefreshMassAndDrag(); Scene.HudGui.DropButton.SetActive(false); LocalPlayer.Animator.SetBoolReflected("bodyHeld", false); LocalPlayer.AnimControl.carry = false; LocalPlayer.AnimControl.placedBodyGo = null; LocalPlayer.Inventory.ShowAllEquiped(); } } }
private void setupEncounter() { if (this.typeMourning1) { dummyTypeSetup component = base.transform.GetComponent <dummyTypeSetup>(); if (component && (component._type == EnemyType.regularMale || component._type == EnemyType.regularMaleLeader || component._type == EnemyType.regularFemale || component._type == EnemyType.regularMaleFireman) && this.info && base.gameObject) { this.info.addToEncounters(base.gameObject); } } else if (this.info && base.gameObject) { this.info.addToEncounters(base.gameObject); } if (!base.IsInvoking("checkEncounterConditions")) { base.InvokeRepeating("checkEncounterConditions", 1f, 20f); } this.encounterCoolDown = false; }
private void CutDown() { bool flag = false; bool flag2 = false; bool flag3 = false; dummyTypeSetup component = base.transform.root.GetComponent <dummyTypeSetup>(); if (component && (component._type == EnemyType.skinnyMale || component._type == EnemyType.skinnyFemale || component._type == EnemyType.skinnyMalePale)) { flag = true; } if (this.femaleHair && this.femaleHair.activeSelf) { flag2 = true; } if (this.propManager) { this.isPoisoned = this.propManager.poisoned; if (this.propManager.skinnedHeadMask.activeSelf && this.isHead) { flag3 = true; this.propManager.skinnedHeadMask.SetActive(false); } } if (this.setupManager) { this.isPoisoned = this.setupManager.poisoned; } Vector3 position = Vector3.zero; GameObject gameObject = null; if (this.instantiateCutPrefab) { Quaternion rotation; if (this.instantiatePivot) { position = this.instantiatePivot.transform.position; rotation = this.instantiatePivot.transform.rotation; } else { position = this.MyCut.transform.position; rotation = this.MyCut.transform.rotation; } if (!BoltNetwork.isClient) { if (flag) { gameObject = UnityEngine.Object.Instantiate <GameObject>(this.spawnSkinny, position, rotation); } else { gameObject = UnityEngine.Object.Instantiate <GameObject>(this.spawnRegular, position, rotation); } if (component && component._type == EnemyType.paleMale) { gameObject.transform.localScale = gameObject.transform.localScale * 1.15f; } if (flag2) { enableGoReceiver componentInChildren = gameObject.GetComponentInChildren <enableGoReceiver>(); if (componentInChildren) { componentInChildren.doEnableGo(); } } if (flag3) { coopChoppedPartsReplicator component2 = gameObject.GetComponent <coopChoppedPartsReplicator>(); if (component2 && component2.faceMask) { component2.faceMask.SetActive(true); } else { flag3 = false; } } } base.StartCoroutine(this.setupCutSkin(gameObject, flag)); } else if (!BoltNetwork.isClient) { this.MyCut.SetActive(true); if (flag2) { enableGoReceiver componentInChildren2 = this.MyCut.GetComponentInChildren <enableGoReceiver>(); if (componentInChildren2) { componentInChildren2.doEnableGo(); } } base.StartCoroutine(this.setupCutSkin(this.MyCut, flag)); } if (BoltNetwork.isClient && this.storePrefab && this.instantiateCutPrefab) { GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(this.storePrefab, position, base.transform.rotation); storeLocalMutantInfo2 component3 = gameObject2.GetComponent <storeLocalMutantInfo2>(); Scene.SceneTracker.storedRagDollPrefabs.Add(gameObject2); component3.mat = this.sourceMat; CoopMutantMaterialSync component4 = base.transform.root.GetComponent <CoopMutantMaterialSync>(); if (component4) { component3.matColor = component4.storedColor; } else if (component) { if (this.isPoisoned) { component3.matColor = Scene.SceneTracker.poisonedColor; } else if (component._type == EnemyType.paleMale || component._type == EnemyType.skinnyMalePale) { component3.matColor = Scene.SceneTracker.paleMutantColor; } else { component3.matColor = Scene.SceneTracker.regularMutantColor; } } component3.bloodPropertyBlock = this.bloodPropertyBlock; component3.showHair = flag2; component3.showMask = flag3; } SkinnedMeshRenderer component5 = this.MyPart.GetComponent <SkinnedMeshRenderer>(); foreach (Transform transform in component5.bones) { IEnumerator enumerator = transform.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; Transform transform2 = (Transform)obj; if (transform2.GetComponent <arrowTrajectory>()) { transform2.parent = null; Rigidbody component6 = transform2.GetComponent <Rigidbody>(); if (component6) { component6.isKinematic = false; component6.useGravity = true; } Collider component7 = transform2.GetComponent <Collider>(); if (component7) { component7.isTrigger = false; component7.enabled = true; } } } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } } this.MyPart.SetActive(false); if (this.MyPartSkinny) { this.MyPartSkinny.SetActive(false); } if (this.props.Length > 0) { for (int j = 0; j < this.props.Length; j++) { this.props[j].SetActive(false); } } if (LocalPlayer.Transform && Vector3.Distance(LocalPlayer.Transform.position, base.transform.position) < 4f) { EventRegistry.Enemy.Publish(TfEvent.CutLimb, null); } this.MyCut.transform.parent = null; UnityEngine.Object.Destroy(base.gameObject); }
public void TakeBodyMP(BoltEntity body, BoltConnection from) { if (!body) { return; } dummyTypeSetup componentInChildren = body.gameObject.GetComponentInChildren <dummyTypeSetup>(); MultiHolder multiHolder; if (base.state.IsReal) { IMultiHolderState state = base.state; multiHolder = this; } else { if (!base.state.Replaces) { return; } IMultiHolderState state = base.state.Replaces.GetState <IMultiHolderState>(); multiHolder = base.state.Replaces.GetComponentsInChildren <MultiHolder>(true)[0]; } bool flag = false; TakeBodyApprove takeBodyApprove = (from != null) ? TakeBodyApprove.Create(from) : TakeBodyApprove.Create(GlobalTargets.OnlySelf); if (base.state.Body0 == body) { Debug.Log("TakeBody:Body0:" + base.state.Body0); flag = true; takeBodyApprove.Body = body; takeBodyApprove.Send(); base.state.Body0 = null; multiHolder._contentActual = 0; multiHolder._contentTypeActual = MultiHolder.ContentTypes.None; multiHolder._bodyTypes[0] = EnemyType.regularMale; } else if (base.state.Body1 == body) { Debug.Log("TakeBody:Body1:" + base.state.Body1); flag = true; takeBodyApprove.Body = body; takeBodyApprove.Send(); base.state.Body1 = null; multiHolder._contentActual = 1; multiHolder._bodyTypes[1] = EnemyType.regularMale; } else if (base.state.Body2 == body) { Debug.Log("TakeBody:Body2:" + base.state.Body2); flag = true; takeBodyApprove.Body = body; takeBodyApprove.Send(); base.state.Body2 = null; multiHolder._contentActual = 2; multiHolder._bodyTypes[2] = EnemyType.regularMale; } if (flag) { body.GetState <IMutantState>().Transform.SetTransforms(body.transform); } }