Example #1
0
        public override void Load()
        {
            playerTank = new TankBuilder(true)
                         .SetChassis(0, 0)
                         .SetTurret(0)
                         .SetTracks(0)
                         .Build() as PlayerTank;
            CreateEntity(playerTank);
            playerTank.transform.SetPosition(new Vector2(200, 300));
            playerTank.StartTurn();

            TankState state = new TankState();

            state.Pos_X = playerTank.transform.position.x;
            state.Pos_Y = playerTank.transform.position.y;
            playerTank.UpdateTankState(state);

            Tank npcTank = new TankBuilder(false)
                           .SetChassis(1, 1)
                           .SetTurret(1)
                           .SetTracks(1)
                           .Build();

            CreateEntity(npcTank);
            npcTank.transform.SetPosition(new Vector2(500, 300));
        }
Example #2
0
        public override void Load()
        {
            players = NetworkManager.Instance.GetPlayerList();
            foreach (Player player in players)
            {
                if (player.ConnectionId == NetworkManager.Instance.myConnId())
                {
                    tank = new TankBuilder(true)
                           .SetChassis(player.Tank.Color_id, player.Tank.Chasis_id)
                           .SetTurret(player.Tank.Chasis_id)
                           .SetTracks(player.Tank.Trucks_id)
                           .Build() as PlayerTank;
                    CreateEntity(tank);
                    tank.transform.SetPosition(new Vector2(player.TankState.Pos_X, player.TankState.Pos_Y));
                    tankDict.Add(player.ConnectionId, tank);
                    if (NetworkManager.Instance.getCurrentPlayer() == "YOU")
                    {
                        tank.StartTurn();
                    }
                }
                else
                {
                    Tank NPCTank = new TankBuilder(false)
                                   .SetChassis(player.Tank.Color_id, player.Tank.Chasis_id)
                                   .SetTurret(player.Tank.Chasis_id)
                                   .SetTracks(player.Tank.Trucks_id)
                                   .Build();
                    CreateEntity(NPCTank);
                    NPCTank.transform.SetPosition(new Vector2(player.TankState.Pos_X, player.TankState.Pos_Y));
                    tankDict.Add(player.ConnectionId, NPCTank);
                }
            }
            //NetworkManager.Instance.GetCrate();

            NetworkManager.Instance.PlayerChanged += Instance_PlayerChanged;


            //background = CreateEntity(new Background()) as Background;

            //terrain = CreateEntity(new Terrain()) as Terrain;

            gameplayUI = CreateEntity(new GameplayUI()) as GameplayUI;
            grenade    = new ProjectileFactory().Create("grenade") as Grenade;
            grenade.transform.SetPosition(new Vector2(300f, 300f));

            crate = CreateEntity(new Crate(Image.FromFile("../../res/crates/crate_0.png"), new Vector2(200f, 200f), grenade, new Vector2(50f, 50f))) as Crate;
            crate.transform.SetPosition(new Vector2(200f, 300f));
            crate.transform.SetSize(new Vector2(50f, 50f));

            /*
             * Tank usaTank = new TankBuilder()
             *  .SetChassis(1, 1)
             *  .SetTurret(1)
             *  .SetTracks(0)
             *  .Build();
             * CreateEntity(usaTank);
             * usaTank.transform.SetPosition(new Vector2(500, 100));
             */
        }
Example #3
0
        public override void Load()
        {
            Tank usaTank =
                new TankBuilder(true)
                .SetChassis(1, 1)
                .SetTurret(1)
                .SetTracks(0)
                .Build();

            CreateEntity(usaTank);
            usaTank.transform.SetPosition(new Vector2(500, 100));

            usaTank.ApplyCamouflage(0);
            usaTank.ApplySideskirt(0);
            usaTank.ApplyAccessory(1);



            explosion = new ParticleFactory().Create("explosion") as ParticleEmitter;
            explosion.transform.SetPosition(usaTank.transform.position);
            explosion2 = explosion.Clone();
            explosion2.transform.SetPosition(usaTank.transform.position + new Vector2(200, 200));
        }
        public override void Load()
        {
            InventoryUI inventoryUI = new InventoryUI(new Rectangle(100, 100, 300, 300));

            CreateEntity(inventoryUI);

            Tank usaTank =
                new TankBuilder(true)
                .SetChassis(1, 1)
                .SetTurret(1)
                .SetTracks(0)
                .Build();

            CreateEntity(usaTank);
            usaTank.transform.SetPosition(new Vector2(500, 100));

            // Apply customiztion
            usaTank.ApplyCamouflage(0);
            usaTank.ApplySideskirt(0);
            usaTank.ApplyAccessory(1);

            Tank nazziTank = new TankBuilder(true)
                             .SetChassis(3, 0)
                             .SetTurret(0)
                             .SetTracks(1)
                             .Build();

            CreateEntity(nazziTank);
            nazziTank.transform.SetPosition(new Vector2(500, 200));
            nazziTank.ApplyCamouflage(4);
            nazziTank.ApplyAccessory(2);

            Tank jpTank = new TankBuilder(true)
                          .SetChassis(0, 2)
                          .SetTurret(2)
                          .SetTracks(2)
                          .Build();

            CreateEntity(jpTank);
            jpTank.transform.SetPosition(new Vector2(500, 300));
            jpTank.ApplyCamouflage(5);
            jpTank.ApplySideskirt(1);

            inputField  = CreateEntity(new InputField(20, 20, 120, 20)) as InputField;
            startButton = CreateEntity(new Button(150, 20, 50, 50, null, "Join Lobby")) as Button;
            startButton.OnClickCallback += StartButton_OnClickCallback;

            progressBar = CreateEntity(new ProgressBar(new Rectangle(170, 100, 64, 8), Color.LightGreen, Color.DarkGreen)) as ProgressBar;
            progressBar.SetProgress(0.4f);

            UIFactory uiFactory = new UIFactory();

            for (int i = 0; i < 3; i++)
            {
                testButtons[i] = uiFactory.Create(new UICreateArgs("button", new Vector2(200, 200 + i * 50))) as Button;
            }

            Grenade grenade = new ProjectileFactory().Create("grenade") as Grenade;

            grenade.transform.SetPosition(new Vector2(400, 100));
        }