Exemple #1
0
        void ResetPlayerPosition()
        {
            float   x     = (game.World.Width / 2) + 0.5f;
            float   z     = (game.World.Length / 2) + 0.5f;
            Vector3 spawn = Respawn.FindSpawnPosition(game, x, z, game.LocalPlayer.Size);

            LocationUpdate update = LocationUpdate.MakePosAndOri(spawn, 0, 0, false);

            game.LocalPlayer.SetLocation(update, false);
            game.LocalPlayer.Spawn = spawn;
            game.CurrentCameraPos  = game.Camera.GetPosition(0);
        }
Exemple #2
0
        public void OnNewMapLoaded(Game game)
        {
            UpdateScore();
            string[] models = { "sheep", "pig", "skeleton", "zombie", "creeper", "spider" };
            for (int i = 0; i < 254; i++)
            {
                MobEntity fail = new MobEntity(game, models[rnd.Next(models.Length)]);
                float     x    = rnd.Next(0, game.World.Width) + 0.5f;
                float     z    = rnd.Next(0, game.World.Length) + 0.5f;

                Vector3 pos = Respawn.FindSpawnPosition(game, x, z, fail.Size);
                fail.SetLocation(LocationUpdate.MakePos(pos, false), false);
                game.Entities[i] = fail;
            }
        }
        void verifyplayerhp()
        {
            if (game.LocalPlayer.Health < 1)
            {
                Vector3 Newpos;
                Newpos.X = (float)game.World.Width / 2;
                Newpos.Z = (float)game.World.Length / 2;

                Newpos = Respawn.FindSpawnPosition(game, Newpos.Z, Newpos.X, game.LocalPlayer.Size);

                LocationUpdate update = LocationUpdate.MakePos(Newpos, false);
                game.LocalPlayer.SetLocation(update, false);
                game.LocalPlayer.Health = 20;
                game.Chat.Add("You died.");
            }
        }
Exemple #4
0
        } //Verify Player HP

        void Respawning()
        {
            game.LocalPlayer.Velocity.X = 0;
            game.LocalPlayer.Velocity.Y = 0;
            game.LocalPlayer.Velocity.Z = 0;

            Vector3 Newpos;

            Newpos.X = (float)game.World.Width / 2;
            Newpos.Z = (float)game.World.Length / 2;

            Newpos = Respawn.FindSpawnPosition(game, (int)Newpos.Z, (int)Newpos.X, game.LocalPlayer.Size);


            LocationUpdate update = LocationUpdate.MakePos(Newpos, false);

            game.LocalPlayer.SetLocation(update, true);
        }
Exemple #5
0
        void IGameComponent.OnNewMapLoaded(Game game)
        {
            UpdateScore();
            wasOnGround             = true;
            showedDeathScreen       = false;
            game.LocalPlayer.Health = 20;
            string[] models = { "sheep", "pig", "skeleton", "zombie", "creeper", "spider" };

            for (int i = 0; i < 254; i++)
            {
                MobEntity fail = new MobEntity(game, models[rnd.Next(models.Length)]);
                float     x    = rnd.Next(0, game.World.Width) + 0.5f;
                float     z    = rnd.Next(0, game.World.Length) + 0.5f;

                Vector3 pos = Respawn.FindSpawnPosition(game, x, z, fail.Size);
                fail.SetLocation(LocationUpdate.MakePos(pos, false), false);
                game.Entities.List[i] = fail;
            }
        }
        public void OnNewMapLoaded(Game game)
        {
            for (int i = 0; i < ((int)((oldlength + oldwidth / 2) / 5)); i++)
            {
                game.Entities[i] = null;
            }

            game.Chat.Add("&fScore: &e" + score, MessageType.Status1);
            string[] models = { "sheep", "pig", "skeleton", "zombie", "creeper", "spider" };
            for (int i = 0; i < ((int)((game.World.Length + game.World.Width / 2) / 5)); i++)
            {
                MobEntity fail = new MobEntity(game, models[rnd.Next(models.Length)]);
                float     x    = rnd.Next(0, game.World.Width) + 0.5f;
                float     z    = rnd.Next(0, game.World.Length) + 0.5f;

                Vector3 pos = Respawn.FindSpawnPosition(game, x, z, fail.Size);
                fail.SetLocation(LocationUpdate.MakePos(pos, false), false);
                game.Entities[i]        = fail;
                game.Entities[i].Health = 10;
            }
            oldwidth  = game.World.Width;
            oldlength = game.World.Length;
        }
        public override void Execute(string[] args)
        {
            if (args.Length != 2 && args.Length != 3)
            {
                game.Chat.Add("Unspecified error");
            }
            else
            {
                BlockID    id   = 5;
                EntityItem Item = new EntityItem(game);
                if (!BlockID.TryParse(args[1], out id))
                {
                    game.Chat.Add("Unspecified error");
                    return;
                }

                Item.ItemId = id;
                float   x   = game.LocalPlayer.Position.X;
                float   z   = game.LocalPlayer.Position.Z;
                Vector3 pos = Respawn.FindSpawnPosition(game, x, z, Item.Size);
                Item.SetLocation(LocationUpdate.MakePos(pos, false), false);
                game.Entities.List[200] = Item;
            }
        }