Ejemplo n.º 1
0
 public void ThrowItem(Entity target, IItem item)
 {
     if (Main.CalcAim2(target.Position - p.Position, 60, out XYZ lower, out XYZ _))
     {
         item.Velocity = lower / Constants.STEPS_PER_SECOND;
         //Remove the item from the player's inventory and create a thrown item in the world
         p.Inventory.Remove(item);
         var t = new ThrownItem(p, item);
         w.AddEntity(t);
         //Track this on the player
         p.Watch.Add(t);
         p.AddMessage(new InfoEvent(new ColoredString("You throw: ") + item.Name.WithBackground(Color.Black) + new ColoredString(" | at: ") + target.Name.WithBackground(Color.Black)));
     }
 }