public void LocalPlayer()
        {
            // Create a local world
            using var world = new LocalWorld();


            // Start the world
            world.Start();

            // Create the local player
            var localPlayer = world.CreateLocalPlayer("Test");

            // Wait 1 second (game should start counting down to start)
            Thread.Sleep(1000);

            // Verify state
            Assert.AreEqual(PlayerType.Astronaut, world.LocalPlayer.Type);
            Assert.AreEqual(1, world.Players.Players.Count);
            Assert.AreEqual(1, world.State.Astronauts.Count);
            Assert.AreEqual(0, world.State.Asteroids.Count);
            Assert.AreEqual(GameMode.Waiting, world.State.Mode);
            Assert.IsTrue(world.State.RemainingTime < GameConstants.PlayerWaitTime);

            // Wait until game starts
            Thread.Sleep((int)(GameConstants.PlayerWaitTime * 1000));
            Assert.AreEqual(GameMode.Playing, world.State.Mode);
            Assert.IsTrue(world.State.RemainingTime < GameConstants.PlayTime);
        }
        public void CreateLocal()
        {
            // Create a local world
            using var world = new LocalWorld();

            // Start the world
            world.Start();

            // Wait 1 second
            Thread.Sleep(1000);

            // Verify state
            Assert.AreEqual(PlayerType.None, world.LocalPlayer.Type);
            Assert.AreEqual(0, world.Players.Players.Count);
            Assert.AreEqual(0, world.State.Astronauts.Count);
            Assert.AreEqual(0, world.State.Asteroids.Count);
            Assert.AreEqual(GameMode.Waiting, world.State.Mode);
            Assert.AreEqual(GameConstants.PlayerWaitTime, world.State.RemainingTime, 1e-2f);
        }
Example #3
0
    //INVINVENTORY--------------------------------------

    /// Access method used when the local world registers itself
    /// with this player object.
    public void setLocalWorld(LocalWorld lw)
    {
        localWorld = lw;
        //       Debug.Log ("Add block " + localWorld);
    }
Example #4
0
    private void Init()
    {
        DefineWorldNodes();
        //DefineBoxel();

        global_x = global_y = 0;

        CreateWorldNodes();

        world = new LocalWorld();

        for (int i = 0; i < 5; i++) for (int j = 0; j < 5; j++) GenerateMesh(i,j);
    }
    private void Init()
    {
        originalGroundComponent = DefineOriginalGroundComponent();
        DefineWorldNodes();
        world = new LocalWorld();
        GetStartSegments();

        RenderLogic();
    }