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 Awake() { this.cmd = base.transform.GetComponent <CoopMutantDummy>(); this.mrs = base.transform.GetComponent <mutantRagdollSetup>(); this.dropCollider = base.transform.GetComponent <BoxCollider>(); this.dropRb = base.transform.GetComponent <Rigidbody>(); this.animator = base.GetComponent <Animator>(); this.control = base.GetComponent <dummyAnimatorControl>(); this.Tr = base.transform; this.layer = 26; this.layerMask = 1 << this.layer; }
public GameObject PickUpBody() { this._contentActual--; if (this._contentActual == 0) { this._contentTypeActual = MultiHolder.ContentTypes.None; } GameObject gameObject = this._bodies[this._contentActual]; this._bodies[this._contentActual] = null; gameObject.transform.parent = null; MultiHolder.GetTriggerChild(gameObject.transform).gameObject.SetActive(true); dummyAnimatorControl dummyAnimatorControl = gameObject.GetComponent <dummyAnimatorControl>() ?? gameObject.GetComponentInChildren <dummyAnimatorControl>(); dummyAnimatorControl.enabled = true; return(gameObject); }
private void SpawnBody(int bodyId) { Debug.Log("SPAWN BODY:" + bodyId); GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(Prefabs.Instance._deadMutantBodies[(int)this._bodyTypes[bodyId]]); gameObject.SetActive(true); this.DisableBodyCollisions(gameObject); gameObject.transform.Find("Trigger").gameObject.SetActive(false); gameObject.transform.position = this.MutantBodySlots[bodyId].transform.position; gameObject.transform.rotation = this.MutantBodySlots[bodyId].transform.rotation; gameObject.transform.parent = base.transform.root; dummyAnimatorControl component = gameObject.GetComponent <dummyAnimatorControl>(); component.bodyOnSled = true; gameObject.SendMessage("dropFromCarry", false, SendMessageOptions.DontRequireReceiver); component.Invoke("disableControl", 2.5f); this._bodies[bodyId] = gameObject; }
private void InitAnimator() { GameObject gameObject; if (this.dummyGo) { gameObject = this.dummyGo; } else if (this.lookatGo) { gameObject = this.lookatGo; } else { gameObject = null; } if (gameObject) { this.animator = (gameObject.GetComponent <Animator>() ?? gameObject.GetComponentInChildren <Animator>()); this.dummyControl = (gameObject.GetComponent <dummyAnimatorControl>() ?? gameObject.GetComponentInChildren <dummyAnimatorControl>()); } }
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); } } } } } }
private void InitAnimator() { GameObject gameObject; if (this.dummyGo) { gameObject = this.dummyGo; } else if (this.lookatGo) { gameObject = this.lookatGo; } else { gameObject = null; } if (gameObject) { this.animator = (gameObject.GetComponent<Animator>() ?? gameObject.GetComponentInChildren<Animator>()); this.dummyControl = (gameObject.GetComponent<dummyAnimatorControl>() ?? gameObject.GetComponentInChildren<dummyAnimatorControl>()); } }
private void Awake() { this.cmd = base.transform.GetComponent<CoopMutantDummy>(); this.mrs = base.transform.GetComponent<mutantRagdollSetup>(); this.dropCollider = base.transform.GetComponent<BoxCollider>(); this.dropRb = base.transform.GetComponent<Rigidbody>(); this.animator = base.GetComponent<Animator>(); this.control = base.GetComponent<dummyAnimatorControl>(); this.Tr = base.transform; this.layer = 26; this.layerMask = 1 << this.layer; }