/// <summary> /// Обработать событие "Инвентарь изменился" /// </summary> protected virtual void HandleEquipmentChanges(object sender, EquipmentEventArgs e) { if (e.Item.itemImage != null) { weaponImage.sprite = e.Item.itemImage; } }
protected virtual void OnEquipmentChanged(EquipmentEventArgs e) { EventHandler <EquipmentEventArgs> handler = equipmentChangedEvent; if (handler != null) { handler(this, e); } }
/// <summary> /// occurs when a dressing meneuver is completed. /// </summary> /// <param name="sender">the sender</param> /// <param name="e">the event arguemtn (equipment)</param> void WornArmour_OnFinishedDressingManeuver(object sender, EquipmentEventArgs<ArmourWorn.DressingActionType, IArmour> e) { switch (e.EquipEventType) { case ArmourWorn.DressingActionType.PutOn: Inventory.Remove(e.EquipmentInvolved); UI.Graphics.Display.ShowMessage( "You are now wearing {0}.", e.EquipmentInvolved.Name); break; case ArmourWorn.DressingActionType.TakeOff: Inventory.Push(e.EquipmentInvolved); UI.Graphics.Display.ShowMessage( "You are no longer wearing {0}.", e.EquipmentInvolved.Name); break; } }
/// <summary> /// fires when the wield status of a weapon changes. /// </summary> /// <param name="sender">the sender</param> /// <param name="e">the event args (equipment)</param> void WieldedWeapons_OnWieldWeaponEvent(object sender, EquipmentEventArgs<WeaponsWielded.WieldEventType, IWeapon> e) { switch (e.EquipEventType) { case WeaponsWielded.WieldEventType.Sheath: Inventory.Push(e.EquipmentInvolved); UI.Graphics.Display.ShowMessage("The weapon {0} has been sheathed.", e.EquipmentInvolved.Name); break; case WeaponsWielded.WieldEventType.Wield: Inventory.Remove(e.EquipmentInvolved); UI.Graphics.Display.ShowMessage(string.Format("You are now wielding {0}.", e.EquipmentInvolved.Name)); break; } }