private void transferStuckArrows() { if (this.animalArrowSync) { if (this.closestStoredToken == null) { return; } storeLocalMutantInfo2 component = this.closestStoredToken.transform.GetComponent <storeLocalMutantInfo2>(); if (this.closestStoredToken) { if (!this.ast) { this.ast = base.transform.GetComponent <arrowStickToTarget>(); } if (!this.ast) { arrowStickToTarget[] componentsInChildren = base.transform.GetComponentsInChildren <arrowStickToTarget>(true); if (componentsInChildren[0]) { this.ast = componentsInChildren[0]; } } if (this.ast) { int num = 0; foreach (KeyValuePair <Transform, int> keyValuePair in component.stuckArrowsIndex) { if (keyValuePair.Key) { if (this.ast.singleJointMode) { keyValuePair.Key.parent = this.ast.baseJoint; keyValuePair.Key.localPosition = Vector3.zero; keyValuePair.Key.localRotation = component.stuckArrowRot[num]; } else { keyValuePair.Key.parent = this.ast.stickToJoints[keyValuePair.Value]; keyValuePair.Key.localPosition = component.stuckArrowPos[num]; keyValuePair.Key.localRotation = component.stuckArrowRot[num]; } fakeArrowSetup component2 = keyValuePair.Key.GetComponent <fakeArrowSetup>(); if (component2 && BoltNetwork.isRunning) { component2.storedIndex = this.ast.stuckArrows.Count; component2.entityTarget = base.transform.root.GetComponent <BoltEntity>(); } int count = this.ast.stuckArrows.Count; this.ast.stuckArrows.Add(keyValuePair.Key, count); num++; } } } UnityEngine.Object.Destroy(this.closestStoredToken); Scene.SceneTracker.storedRagDollPrefabs.RemoveAll((GameObject o) => o == null); Scene.SceneTracker.storedRagDollPrefabs.TrimExcess(); } } }
private void transferClientFire() { if (this.closestStoredToken == null) { return; } mutantTransferFire component = base.transform.GetComponent <mutantTransferFire>(); if (component && component.allBones.Count > 0) { storeLocalMutantInfo2 component2 = this.closestStoredToken.transform.GetComponent <storeLocalMutantInfo2>(); if (component2 == null || component2.fire.Count == 0) { return; } for (int i = 0; i < component2.fire.Count; i++) { if (component2.fire[i] && component2.fire[i].gameObject.activeSelf) { component2.fire[i].parent = component.allBones[i]; component2.fire[i].localPosition = component2.firePos[i]; component2.fire[i].localRotation = component2.fireRot[i]; } } } }
public override void Attached() { float num = float.PositiveInfinity; GameObject gameObject = null; for (int i = 0; i < Scene.SceneTracker.storedRagDollPrefabs.Count; i++) { if (Scene.SceneTracker.storedRagDollPrefabs[i] != null) { float num2 = Vector3.Distance(base.transform.position, Scene.SceneTracker.storedRagDollPrefabs[i].transform.position); if (num2 < num) { num = num2; if (num2 < 1f) { gameObject = Scene.SceneTracker.storedRagDollPrefabs[i]; } } } } if (gameObject) { storeLocalMutantInfo2 component = gameObject.GetComponent <storeLocalMutantInfo2>(); base.transform.position = component.rootPosition; base.transform.rotation = component.rootRotation; for (int j = 0; j < this.jointsToSync.Length; j++) { this.jointsToSync[j].localRotation = component.jointAngles[j]; } UnityEngine.Object.Destroy(gameObject); Scene.SceneTracker.storedRagDollPrefabs.RemoveAll((GameObject o) => o == null); Scene.SceneTracker.storedRagDollPrefabs.TrimExcess(); } }
public override void Detached() { if (BoltNetwork.isClient && Scene.MutantControler.activeNetCannibals.Contains(base.gameObject)) { Scene.MutantControler.activeNetCannibals.Remove(base.gameObject); } if (this.creepy && BoltNetwork.isClient) { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.storePrefab, base.transform.position, base.transform.rotation); storeLocalMutantInfo2 component = gameObject.GetComponent <storeLocalMutantInfo2>(); Scene.SceneTracker.storedRagDollPrefabs.Add(gameObject); component.identifier = this.storedRagDollName; component.rootRotation = this.rootTr.rotation; component.rootPosition = this.rootTr.position; mutantTransferFire component2 = base.transform.GetComponent <mutantTransferFire>(); if (component2) { for (int i = 0; i < component2.clientFireGo.Count; i++) { spawnParticleController component3 = component2.clientFireGo[i].GetComponent <spawnParticleController>(); if (component3 && component3.spawnedPrefab) { int value = component2.allBones.IndexOf(component2.clientFireGo[i].transform.parent); component.fireIndex.Add(component3.spawnedPrefab.transform, value); component.firePos.Add(component2.clientFireGo[i].transform.localPosition); component.fireRot.Add(component2.clientFireGo[i].transform.localRotation); component3.spawnedPrefab.SendMessage("disableFollowTarget"); } } } CoopMutantMaterialSync component4 = base.transform.GetComponent <CoopMutantMaterialSync>(); if (component4) { component.matColor = component4.storedColor; } for (int j = 0; j < this.storedCreepyJoints.Length; j++) { component.jointAngles.Add(this.storedCreepyJoints[j].localRotation); } if (this.ast) { int num = 0; foreach (KeyValuePair <Transform, int> keyValuePair in this.ast.stuckArrows) { if (keyValuePair.Key) { component.stuckArrowsIndex.Add(keyValuePair.Key, keyValuePair.Value); component.stuckArrowPos.Add(keyValuePair.Key.localPosition); component.stuckArrowRot.Add(keyValuePair.Key.localRotation); if (num < this.ast.stuckArrowsTypeList.Count) { component.stuckArrowType.Add(this.ast.stuckArrowsTypeList[num]); } num++; } } } } }
public IEnumerator generateStoredJointList() { yield return(new WaitForEndOfFrame()); if (this.doneGenerateList) { yield break; } GameObject store = UnityEngine.Object.Instantiate <GameObject>(this.storePrefab, base.transform.position, base.transform.rotation); storeLocalMutantInfo2 slmi = store.GetComponent <storeLocalMutantInfo2>(); slmi.identifier = this.cms.storedRagDollName; slmi.jointAngles.Clear(); for (int i = 0; i < this.jointsToSync.Length; i++) { slmi.jointAngles.Add(this.jointsToSync[i].localRotation); } CoopMutantMaterialSync cmms = base.transform.parent.GetComponent <CoopMutantMaterialSync>(); if (cmms) { slmi.matColor = cmms.storedColor; } if (this.ast) { foreach (KeyValuePair <Transform, int> keyValuePair in this.ast.stuckArrows) { if (keyValuePair.Key) { slmi.stuckArrowsIndex.Add(keyValuePair.Key, keyValuePair.Value); slmi.stuckArrowPos.Add(keyValuePair.Key.localPosition); slmi.stuckArrowRot.Add(keyValuePair.Key.localRotation); } } } mutantTransferFire mtf = base.transform.parent.GetComponent <mutantTransferFire>(); if (mtf) { for (int j = 0; j < mtf.clientFireGo.Count; j++) { spawnParticleController component = mtf.clientFireGo[j].GetComponent <spawnParticleController>(); if (component && component.spawnedPrefab) { int value = mtf.allBones.IndexOf(mtf.clientFireGo[j].transform.parent); slmi.fireIndex.Add(component.spawnedPrefab.transform, value); slmi.firePos.Add(mtf.clientFireGo[j].transform.localPosition); slmi.fireRot.Add(mtf.clientFireGo[j].transform.localRotation); component.spawnedPrefab.SendMessage("disableFollowTarget"); } } } Scene.SceneTracker.storedRagDollPrefabs.Add(store); this.doneGenerateList = true; yield break; }
public override void Detached() { if (!Scene.SceneTracker) { return; } GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate(Resources.Load("storeRagDollPrefab"), base.transform.position, base.transform.rotation); gameObject.transform.position = base.transform.position; gameObject.transform.rotation = base.transform.rotation; storeLocalMutantInfo2 component = gameObject.GetComponent <storeLocalMutantInfo2>(); Scene.SceneTracker.storedRagDollPrefabs.Add(gameObject); if (this.ca.isSnow) { component.isSnow = true; } if (!this.ast) { this.ast = base.transform.GetComponentInChildren <arrowStickToTarget>(); } if (!this.ast) { this.ast = base.transform.GetComponent <arrowStickToTarget>(); } if (this.ast) { foreach (KeyValuePair <Transform, int> keyValuePair in this.ast.stuckArrows) { if (keyValuePair.Key) { component.stuckArrowsIndex.Add(keyValuePair.Key, keyValuePair.Value); component.stuckArrowPos.Add(keyValuePair.Key.localPosition); component.stuckArrowRot.Add(keyValuePair.Key.localRotation); } } } mutantTransferFire component2 = base.transform.GetComponent <mutantTransferFire>(); if (component2) { for (int i = 0; i < component2.clientFireGo.Count; i++) { spawnParticleController component3 = component2.clientFireGo[i].GetComponent <spawnParticleController>(); if (component3 && component3.spawnedPrefab) { component.fire.Add(component3.spawnedPrefab.transform); component.firePos.Add(component2.clientFireGo[i].transform.localPosition); component.fireRot.Add(component2.clientFireGo[i].transform.localRotation); component3.spawnedPrefab.SendMessage("disableFollowTarget"); Debug.Log("detached client fire"); } } } }
private void generateStorePrefab() { GameObject gameObject = UnityEngine.Object.Instantiate(this.storePrefab, base.transform.position, base.transform.rotation) as GameObject; storeLocalMutantInfo2 component = gameObject.GetComponent <storeLocalMutantInfo2>(); for (int i = 0; i < this.jointsToSync.Length; i++) { component.jointAngles.Add(this.jointsToSync[i].localRotation); } component.rootPosition = this.rootTr.position; component.rootRotation = this.rootTr.rotation; Scene.SceneTracker.storedRagDollPrefabs.Add(gameObject); }
public override void Detached() { if (this.creepy && BoltNetwork.isClient) { GameObject gameObject = UnityEngine.Object.Instantiate(this.storePrefab, base.transform.position, base.transform.rotation) as GameObject; storeLocalMutantInfo2 component = gameObject.GetComponent <storeLocalMutantInfo2>(); Scene.SceneTracker.storedRagDollPrefabs.Add(gameObject); component.identifier = this.storedRagDollName; component.rootRotation = this.rootTr.rotation; component.rootPosition = this.rootTr.position; for (int i = 0; i < this.storedCreepyJoints.Length; i++) { component.jointAngles.Add(this.storedCreepyJoints[i].localRotation); } } }
private void setupSnowSkin() { if (this.closestStoredToken == null) { return; } storeLocalMutantInfo2 component = this.closestStoredToken.transform.GetComponent <storeLocalMutantInfo2>(); if (this.closestStoredToken && component.isSnow) { animalSkinSetup component2 = base.transform.GetComponent <animalSkinSetup>(); if (component2 && this.snowMat) { component2.skin.sharedMaterial = this.snowMat; } } }
private IEnumerator transferClientFire(storeLocalMutantInfo2 store) { mutantTransferFire mtf = base.transform.GetComponent <mutantTransferFire>(); if (mtf && mtf.allBones.Count > 0) { if (store == null || store.fireIndex.Count == 0) { yield break; } float targetDist = float.PositiveInfinity; Transform key = null; foreach (KeyValuePair <Transform, int> keyValuePair in store.fireIndex) { if (key == null) { key = keyValuePair.Key; } } float timer = Time.time + 2f; while (targetDist > 10f) { if (Time.time > timer) { yield break; } targetDist = Vector3.Distance(key.position, base.transform.position); yield return(null); } int indexCount = 0; foreach (KeyValuePair <Transform, int> keyValuePair2 in store.fireIndex) { if (keyValuePair2.Key && keyValuePair2.Key.gameObject.activeSelf) { keyValuePair2.Key.parent = mtf.allBones[keyValuePair2.Value]; keyValuePair2.Key.localPosition = store.firePos[indexCount]; keyValuePair2.Key.localRotation = store.fireRot[indexCount]; indexCount++; } } } yield break; }
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); }
private IEnumerator syncRagDollPositions() { yield return(new WaitForFixedUpdate()); float closestDist = float.PositiveInfinity; GameObject closestStoredToken = null; for (int i = 0; i < Scene.SceneTracker.storedRagDollPrefabs.Count; i++) { if (Scene.SceneTracker.storedRagDollPrefabs[i] != null) { float dist = Vector3.Distance(base.transform.position, Scene.SceneTracker.storedRagDollPrefabs[i].transform.position); if (dist < closestDist) { closestDist = dist; closestStoredToken = Scene.SceneTracker.storedRagDollPrefabs[i]; } } } if (closestStoredToken) { storeLocalMutantInfo2 component = closestStoredToken.transform.GetComponent <storeLocalMutantInfo2>(); if (!this.ast) { this.ast = base.transform.GetComponent <arrowStickToTarget>(); } if (!this.ast) { arrowStickToTarget[] componentsInChildren = base.transform.GetComponentsInChildren <arrowStickToTarget>(true); if (componentsInChildren != null && componentsInChildren.Length > 0 && componentsInChildren[0]) { this.ast = componentsInChildren[0]; } } if (this.ast) { int num = 0; foreach (KeyValuePair <Transform, int> keyValuePair in component.stuckArrowsIndex) { if (keyValuePair.Key) { keyValuePair.Key.parent = this.ast.stickToJoints[keyValuePair.Value]; keyValuePair.Key.localPosition = component.stuckArrowPos[num]; keyValuePair.Key.localRotation = component.stuckArrowRot[num]; fakeArrowSetup component2 = keyValuePair.Key.GetComponent <fakeArrowSetup>(); if (component2 && BoltNetwork.isRunning) { component2.storedIndex = this.ast.stuckArrows.Count; component2.entityTarget = base.transform.root.GetComponent <BoltEntity>(); } int count = this.ast.stuckArrows.Count; this.ast.stuckArrows.Add(keyValuePair.Key, count); num++; } } } if (component.fireIndex.Count > 0) { base.StartCoroutine(this.transferClientFire(component)); } if (this.ragDollJoints.Length == 0) { yield break; } CoopMutantMaterialSync component3 = base.GetComponent <CoopMutantMaterialSync>(); if (component3) { component3.setSkinColor(component.matColor); } if (this.rootTr) { this.rootTr.rotation = component.rootRotation; this.rootTr.position = component.rootPosition; if (component.jointAngles.Count > 0) { for (int j = 0; j < this.ragDollJoints.Length; j++) { this.ragDollJoints[j].localRotation = component.jointAngles[j]; } } } } yield return(null); yield break; }
public override void Attached() { if (!this.Creepy) { base.state.Transform.SetTransforms(base.transform); } if (!base.entity.isOwner) { CoopMutantDummyToken coopMutantDummyToken = base.entity.attachToken as CoopMutantDummyToken; if (coopMutantDummyToken != null) { base.transform.localScale = coopMutantDummyToken.Scale; CoopMutantMaterialSync component = base.GetComponent <CoopMutantMaterialSync>(); if (component && coopMutantDummyToken.MaterialIndex >= 0) { component.ApplyMaterial(coopMutantDummyToken.MaterialIndex); component.Disabled = true; if (!this.Creepy) { if (coopMutantDummyToken.OriginalMutant) { Animator componentInChildren = coopMutantDummyToken.OriginalMutant.GetComponentInChildren <Animator>(); AnimatorStateInfo currentAnimatorStateInfo = componentInChildren.GetCurrentAnimatorStateInfo(0); if (this.Replicator) { this.Replicator.ApplyHashToRemote(0, currentAnimatorStateInfo.fullPathHash, false, currentAnimatorStateInfo.normalizedTime, true); } } dummyAnimatorControl component2 = base.GetComponent <dummyAnimatorControl>(); if (component2) { component2.hips.position = coopMutantDummyToken.HipPosition; component2.hips.rotation = coopMutantDummyToken.HipRotation; } float num = float.PositiveInfinity; GameObject gameObject = null; for (int i = 0; i < Scene.SceneTracker.storedRagDollPrefabs.Count; i++) { if (Scene.SceneTracker.storedRagDollPrefabs[i] != null) { float num2 = Vector3.Distance(base.transform.position, Scene.SceneTracker.storedRagDollPrefabs[i].transform.position); if (num2 < num) { num = num2; gameObject = Scene.SceneTracker.storedRagDollPrefabs[i]; } } } if (gameObject) { storeLocalMutantInfo2 component3 = gameObject.transform.GetComponent <storeLocalMutantInfo2>(); this.jointRotations.Clear(); for (int j = 0; j < component3.jointAngles.Count; j++) { this.ragDollJoints[j].localRotation = component3.jointAngles[j]; this.jointRotations.Add(component3.jointAngles[j]); } if (component) { component.setSkinColor(component3.matColor); } if (component3.fireIndex.Count > 0) { base.StartCoroutine(this.transferClientFire(component3)); } if (!this.ast) { this.ast = base.transform.GetComponent <arrowStickToTarget>(); } if (!this.ast) { arrowStickToTarget[] componentsInChildren = base.transform.GetComponentsInChildren <arrowStickToTarget>(true); if (componentsInChildren[0]) { this.ast = componentsInChildren[0]; } } if (this.ast) { int num3 = 0; foreach (KeyValuePair <Transform, int> keyValuePair in component3.stuckArrowsIndex) { if (keyValuePair.Key) { keyValuePair.Key.parent = this.ast.stickToJoints[keyValuePair.Value]; keyValuePair.Key.localPosition = component3.stuckArrowPos[num3]; keyValuePair.Key.localRotation = component3.stuckArrowRot[num3]; fakeArrowSetup component4 = keyValuePair.Key.GetComponent <fakeArrowSetup>(); if (component4 && BoltNetwork.isRunning) { component4.storedIndex = this.ast.stuckArrows.Count; component4.entityTarget = base.transform.root.GetComponent <BoltEntity>(); } int count = this.ast.stuckArrows.Count; this.ast.stuckArrows.Add(keyValuePair.Key, count); num3++; } } } this.doSync = true; } } } if (this.Creepy) { base.StartCoroutine(this.syncRagDollPositions()); } if (!this.Creepy) { CoopMutantPropSync component5 = base.GetComponent <CoopMutantPropSync>(); if (component5) { component5.ApplyPropMask(coopMutantDummyToken.Props); } if (this.RegularParts && this.SkinnyParts) { if (coopMutantDummyToken.Skinny) { this.RegularParts.SetActive(false); this.SkinnyParts.SetActive(true); } else { this.RegularParts.SetActive(true); this.SkinnyParts.SetActive(false); } } } } } }