private void ProcessUnloadedShells(Player plr, int shells) { int shellGoreSlot = TMRMod.Instance.GetGoreSlot("Gores/ShellCasing"); Vector2 itemScrPos; ReflectionLibraries.RunMethod( Main.instance, "DrawPlayerItemPos", new object[] { plr.gravDir, plr.HeldItem.type }, out itemScrPos ); Texture2D itemTex = Main.itemTexture[plr.HeldItem.type]; var itemTexOffset = new Vector2(itemTex.Width / 2, itemScrPos.Y); Vector2 itemWldPos = plr.itemLocation + itemTexOffset; for (int i = 0; i < shells; i++) { Gore.NewGore(itemWldPos, ShellCasing.GetVelocity(), shellGoreSlot, ShellCasing.GetScale()); } }
private void SpawnShellCasingAtPosition(Vector3 position) { if (this.leafObj != null && this.transform) { GameObject gameObject = SpawnManager.SpawnDebris(this.leafObj, position.WithZ(this.transform.position.z), this.transform.rotation); ShellCasing component = gameObject.GetComponent <ShellCasing>(); if (component != null) { component.Trigger(); } DebrisObject component2 = gameObject.GetComponent <DebrisObject>(); if (component2 != null) { int num = (component2.transform.right.x <= 0f) ? -1 : 1; Vector3 vector = Vector3.up * (UnityEngine.Random.value * 1.5f + 1f) + -1.5f * Vector3.right * (float)num * (UnityEngine.Random.value + 1.5f); Vector3 startingForce = new Vector3(vector.x, 0f, vector.y); if (this.transform.position.GetAbsoluteRoom() != null && this.transform.position.GetAbsoluteRoom().area.PrototypeRoomSpecialSubcategory == PrototypeDungeonRoom.RoomSpecialSubCategory.CATACOMBS_BRIDGE_ROOM) { startingForce = (vector.x * (float)num * -1f * (this.transform.position.XY() - this.sprite.WorldCenter).normalized).ToVector3ZUp(vector.y); } float y = this.transform.position.y; float num2 = position.y - this.transform.position.y + 0.2f; float num3 = component2.transform.position.y - y + UnityEngine.Random.value * 0.5f; component2.additionalHeightBoost = num2 - num3; if (this.CurrentAngle > 25f && this.CurrentAngle < 155f) { component2.additionalHeightBoost += -0.25f; } else { component2.additionalHeightBoost += 0.25f; } component2.Trigger(startingForce, num3, 1f); } } }
public void ReturnToPool(ShellCasing shellCasing) { _shellCasingPool.Add(shellCasing); }