void SpawnProp(CharacterItem prop, PropItemData propData) { Weapon component = prop.GetComponent <Weapon>(); CharacterItem component2; if (component == null) { component2 = Main.unitRoot.GetComponent <UnitRig>().SpawnProp(prop, propData, Stitcher.TransformCatalog.RigType.Human, Team.Blue, null, true).GetComponent <CharacterItem>(); } else { //处理已存在的武器 //Main.unitRoot.GetComponent<Unit>().WeaponHandler.UseHands(); Quaternion rotation = Main.unitRoot.GetComponentInChildren <WeaponHandler>().transform.rotation; List <GameObject> targetList = null; if (propData.m_equip == UnitRig.EquipType.LEFT) { targetList = lastLeftWeapons; } else if (propData.m_equip == UnitRig.EquipType.RIGHT) { targetList = lastRightWeapons; } if (targetList.Count != 0) { for (int i = 0; i < targetList.Count; i++) { GameObject.Destroy(targetList[i]); } targetList.Clear(); } var handType = HoldingHandler.HandType.Left; if (propData.m_equip == UnitRig.EquipType.LEFT) { handType = HoldingHandler.HandType.Left; } else if (propData.m_equip == UnitRig.EquipType.RIGHT) { handType = HoldingHandler.HandType.Right; } component2 = LandfallUnitDatabase .GetDatabase() .m_unitEditorBlueprint .SetWeapon(Main.unitRoot.GetComponent <Unit>(), Team.Blue, prop.gameObject, propData, handType, rotation, targetList) .GetComponent <WeaponItem>(); } }