コード例 #1
0
        private void OnEquip(string slot, InventoryItem item)
        {
            if (IsSeamothArm(item.item.GetTechType(), out TechType techType))
            {
                int slotID = seamoth.GetSlotIndex(slot);

                if (slotID == LeftArmSlotID)
                {
                    AddArm(SeamothArm.Left, techType);
                    return;
                }
                else if (slotID == RightArmSlotID)
                {
                    AddArm(SeamothArm.Right, techType);
                    return;
                }
            }
        }
コード例 #2
0
        public override void Process(SeamothModulesAction packet)
        {
            using (packetSender.Suppress <SeamothModulesAction>())
                using (packetSender.Suppress <ItemContainerRemove>())
                {
                    GameObject _gameObject = NitroxEntity.RequireObjectFrom(packet.Id);
                    SeaMoth    seamoth     = _gameObject.GetComponent <SeaMoth>();
                    if (seamoth != null)
                    {
                        TechType techType = packet.TechType.ToUnity();

                        if (techType == TechType.SeamothElectricalDefense)
                        {
                            float[]           chargearray = (float[])seamoth.ReflectionGet("quickSlotCharge");
                            float             charge      = chargearray[packet.SlotID];
                            float             slotCharge  = seamoth.GetSlotCharge(packet.SlotID);
                            GameObject        gameObject  = global::Utils.SpawnZeroedAt(seamoth.seamothElectricalDefensePrefab, seamoth.transform, false);
                            ElectricalDefense component   = gameObject.GetComponent <ElectricalDefense>();
                            component.charge       = charge;
                            component.chargeScalar = slotCharge;
                        }

                        if (techType == TechType.SeamothTorpedoModule)
                        {
                            Transform      muzzle        = (packet.SlotID != seamoth.GetSlotIndex("SeamothModule1") && packet.SlotID != seamoth.GetSlotIndex("SeamothModule3")) ? seamoth.torpedoTubeRight : seamoth.torpedoTubeLeft;
                            ItemsContainer storageInSlot = seamoth.GetStorageInSlot(packet.SlotID, TechType.SeamothTorpedoModule);
                            TorpedoType    torpedoType   = null;

                            for (int i = 0; i < seamoth.torpedoTypes.Length; i++)
                            {
                                if (storageInSlot.Contains(seamoth.torpedoTypes[i].techType))
                                {
                                    torpedoType = seamoth.torpedoTypes[i];
                                    break;
                                }
                            }

                            //Original Function use Player Camera need parse owner camera values
                            TorpedoShot(storageInSlot, torpedoType, muzzle, packet.Forward.ToUnity(), packet.Rotation.ToUnity());
                        }
                    }
                }
        }
コード例 #3
0
 /// <summary>
 /// This method is examine of the <see cref="SeaMoth"/> right arm slot.
 /// </summary>
 /// <returns>
 /// If any arm mounted in the right arm slot, returns the arm slot ID.<br/>Otherwise, returns <c>-1</c>.
 /// </returns>
 public int GetRightArmSlotID(SeaMoth seamoth)
 {
     return(seamoth.GetSlotIndex("SeamothArmRight"));
 }
コード例 #4
0
 /// <summary>
 /// This method is examine of the <see cref="SeaMoth"/> left arm slot.
 /// </summary>
 /// <returns>
 /// If any arm mounted in the left arm slot, returns the arm slot ID.<br/>Otherwise, returns <c>-1</c>.
 /// </returns>
 public int GetLeftArmSlotID(SeaMoth seamoth)
 {
     return(seamoth.GetSlotIndex("SeamothArmLeft"));
 }