private void StartupVariables() { RunningCost = 10; Equipment = new EquipmentSlots(); Stats = new CharacterStats(); Stats.Equipment = Equipment; CollisionRadius = 25f; movementInterval = 20f; AttackDelay = 300; Class = new ClassInformation(); Skills = new List<Skill>(); StatusEffects = new List<StatusEffect>(); OnHitEffects = new List<StatusEffect>(); Inventory = new Inventory(); ComboManager = new ComboManager {Attacks = 2, CurrentAttackIndex = 0}; Melee = new Weapon { AttackAngle = 180, AttackRange = 30, AttackPower = 5, Cooldown = 700f, Name = "None" }; Facing = Direction.Down; Behavior = new BehaviorEngine(); Name = string.Empty; ActionState = ActionState.Idle; IsAlive = true; }
public void Unequip(Weapon weapon) { Inventory.Add(weapon); Equipment.MainWeapon = null; }
public void EquipWeapon(Weapon weapon, WeaponSlot destinationSlot) { switch (destinationSlot) { case WeaponSlot.Main: Equipment.MainWeapon = weapon; break; case WeaponSlot.Secondary: Equipment.SecondaryWeapon = weapon; break; } }
public void EquipItem(Weapon weapon) { if (Equipment.MainWeapon != null) Inventory.Add(Equipment.MainWeapon); Inventory.Remove(weapon); Equipment.MainWeapon = weapon; }
private void btnNewItem_Click(object sender, EventArgs e) { ItemTypes type = (ItemTypes)cbbNewItemType.SelectedIndex; Item it; switch (type) { case ItemTypes.Usable: it = new Item() { Type = ItemTypes.Usable, Name = "Item" }; break; case ItemTypes.Equipment: it = new Equipment() { Type = ItemTypes.Equipment, Name = "Equipment" }; break; case ItemTypes.Weapon: it = new Weapon() { Type = ItemTypes.Weapon, Name = "Weapon" }; break; default: it = new Item() { Type = ItemTypes.Usable, Name = "Item" }; break; } Items.Add(it); lbxItems.DataSource = null; lbxItems.ValueMember = "Id"; lbxItems.DisplayMember = "Name"; lbxItems.DataSource = Items; lbxItems.SelectedIndex = Items.Count - 1; }
private void DrawWeaponStats(Weapon weap) { DrawEquipmentStat(LanguageConfig.Config.AttackRange, weap.AttackRange, Player.CurrentWeapon == null ? 0 : Player.CurrentWeapon.AttackRange); DrawEquipmentStat(LanguageConfig.Config.AttackPower, weap.AttackPower, Player.CurrentWeapon == null ? 0 : Player.CurrentWeapon.AttackPower); DrawEquipmentStat("Stamina", weap.StaminaCost, Player.CurrentWeapon.StaminaCost); }