Exemplo n.º 1
0
 public void PollDrop(Player Player)
 {
     foreach (KeyValuePair<KeyValuePair<float, float>, Item> D in Drop)
     {
         if (D.Key.Value > 0)
         {
             Player.AddToInv(new ItemStack(D.Value, (int)D.Key.Key + (int)Helper.GetRandom() % (int)D.Key.Value));
         }
         else
         {
             Player.AddToInv(new ItemStack(D.Value, (int)D.Key.Key));
         }
     }
 }
Exemplo n.º 2
0
        int Time = 21000; // Hour * 1000

        #endregion Fields

        #region Constructors

        //====================================
        //========== INITALIZING =============
        //====================================
        public GameWorld(WorldScreen WorldScreen)
        {
            LightSystem = new KryptonEngine(GeneralManager.Game, "Effects/KryptonEffect");
            LightSystem.Initialize();
            SetLightColorPath();

            Chunks = new Dictionary<Vector2, Chunk>();
            Entities = new List<Entity>();
            Generator = new WorldGenerator(this);

            ParentScreen = WorldScreen;

            PhysicalWorld = new World(new Vector2(0, 16 * 9.81f));

            InitLightSystem();

            TestPlayer = new Player(this, true);

            SetBlock(new Vector2(4, 4), new TileEntities.TorchTE(this, new Vector2(128, 128)));
            SetBlock(new Vector2(4, 3), new TileEntities.TreeTE(this, new Vector2(128, 96)));
            Entities.Add(new DynamicBody(this, new CircleShape(10.5f, 0.5f), new Vector2(95, 100), "Textures/DynamicBodies/Barrel1"));

            Debug.WriteLine("World Initialized");
        }
Exemplo n.º 3
0
 public bool DestroyBlock(Vector2 Vect, Player Player)
 {
     if (!World.RaycastAny(Position + new Vector2(CollisionX / 2, CollisionY / 2), Vect /32))
     {
         World.GetBlock(Vect).Drop.PollDrop(Player);
         World.SetBlock(Vect, Block.GetBlock(0));
         return true;
     }
     return false;
 }