コード例 #1
0
        private void GrantEquipment(CharacterBody body, Inventory inventory)
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Void RoR2.GenericPickupController::GrantEquipment(RoR2.CharacterBody,RoR2.Inventory)' called on client");
                return;
            }
            this.waitStartTime = Run.FixedTimeStamp.now;
            EquipmentIndex currentEquipmentIndex = inventory.currentEquipmentIndex;
            EquipmentIndex equipmentIndex        = this.pickupIndex.equipmentIndex;

            inventory.SetEquipmentIndex(equipmentIndex);
            this.NetworkpickupIndex = new PickupIndex(currentEquipmentIndex);
            this.consumed           = false;
            GenericPickupController.SendPickupMessage(inventory.GetComponent <CharacterMaster>(), new PickupIndex(equipmentIndex));
            if (this.pickupIndex == PickupIndex.none)
            {
                UnityEngine.Object.Destroy(base.gameObject);
                return;
            }
            if (this.selfDestructIfPickupIndexIsNotIdeal && this.pickupIndex != PickupIndex.Find(this.idealPickupIndex.pickupName))
            {
                PickupDropletController.CreatePickupDroplet(this.pickupIndex, base.transform.position, new Vector3(UnityEngine.Random.Range(-4f, 4f), 20f, UnityEngine.Random.Range(-4f, 4f)));
                UnityEngine.Object.Destroy(base.gameObject);
            }
        }
コード例 #2
0
 private void GrantItem(CharacterBody body, Inventory inventory)
 {
     if (!NetworkServer.active)
     {
         Debug.LogWarning("[Server] function 'System.Void RoR2.GenericPickupController::GrantItem(RoR2.CharacterBody,RoR2.Inventory)' called on client");
         return;
     }
     inventory.GiveItem(this.pickupIndex.itemIndex, 1);
     GenericPickupController.SendPickupMessage(inventory.GetComponent <CharacterMaster>(), this.pickupIndex);
     UnityEngine.Object.Destroy(base.gameObject);
 }