public void ActionX(int i, LivingObject o) { if (actionbarSlots[i].Item != null) { actionbarSlots[i].Item.Action(actionbarSlots[i].Item, o); } }
//public void HitOtherObject(LivingObject target) //{ // target.Health -= Damage; // target.Push(Position - target.Position, KnockbackPower); // target.IsHit = true; // DidAttack(); //} public void GetHitBy(LivingObject damageSource) { Nemesis = damageSource; //NemesisTimer = 20; ModifyResourceValue("hp", -damageSource.Damage); Push(damageSource.Position - Position, damageSource.KnockbackPower); IsHit = true; IsInCombat = true; //textList.Add(new DynamicText(ScreenManager.DebugFont, Position, Size, new Vector2(0, -1), 10f, Color.DarkRed, "-" + damageSource.Damage.ToString()) { TextShader = true }); damageSource.OnAttack(); }
public void Use(Item item, LivingObject o) { var i = item.GetItem <Usable>(); switch (i.type) { case UsableType.HealthPot: if (o.Health >= o.MaxHealth) { Console.WriteLine("full hp"); return; } Console.WriteLine("hp restored: " + i.Value); o.ModifyResourceValue("hp", i.Value); break; case UsableType.ManaPot: o.Mana += i.Value; break; } i.Exist = false; }
public void Action(Item item, LivingObject player) { switch (item.Type) { case ItemType.Usable: GetItem <Usable>().Use(item, player); break; case ItemType.Weapon: //GetItem<Weapon>().Use(); break; case ItemType.Armor: //GetItem<Armor>().Use(); break; default: break; } }