Esempio n. 1
0
        protected override void Start()
        {
            base.Start();

            Map.map.SetMap();
            FogOfWar.fog.InitializeFog(true);


            IEnumerable <object> objects = EntityManager.FindAllByTag("player");
            List <Player>        players = new List <Player>();

            foreach (Entity ent in objects)
            {
                players.Add(ent.FindComponent <Player>());
            }
            UIBehavior ui = UIBehavior.ui;

            ui.SetPlayers(players.ToArray());
            ui.SetUI();
            ui.ChangePlayer(0);
            //Force ui move to its original place
            WaveServices.Layout.PerformLayout(this);

            RenderManager.ActiveCamera2D.Owner.FindComponent <Camera2DBehavior>().SetDefaultValues();

            //DStarDrawable dstarBeh = new DStarDrawable();
            //this.AddSceneBehavior(dstarBeh, SceneBehavior.Order.PostUpdate);
            //dstarBeh.Set();

            //And this is for the sounds
            UIBehavior.ui.Owner.AddComponent(new SoundHandler());
        }
Esempio n. 2
0
        protected override void Start()
        {
            base.Start();
            //Find players and set them
            IEnumerable <object> objects = EntityManager.FindAllByTag("player");
            List <Player>        players = new List <Player>();

            foreach (Entity ent in objects)
            {
                players.Add(ent.FindComponent <Player>());
            }
            //Set map
            Map.map.SetMap();
            FogOfWar.fog.InitializeFog(true);

            //Set ui
            UIBehavior ui = UIBehavior.ui;

            ui.SetPlayers(players.ToArray());
            ui.SetUI();
            PopulateGame pop = new PopulateGame();

            pop.SetWoods();
            for (int i = 0; i < players.Count; i++)
            {
                pop.SetPlayer(players[i], i, players.Count);
            }

            //Force ui move to its original place
            WaveServices.Layout.PerformLayout(this);

            //Place camera
            RenderManager.ActiveCamera2D.Owner.FindComponent <Camera2DBehavior>().SetDefaultValues();

            //this is for clearing the new changing visibility tiles,  D* purposes
            this.AddSceneBehavior(new FogClearBehavior(), SceneBehavior.Order.PostUpdate);


            //And this is for the sounds
            UIBehavior.ui.Owner.AddComponent(new SoundHandler());

            UIBehavior.ui.Owner.FindComponent <VictoryBehavior>().Enable();
        }
Esempio n. 3
0
        private void SetAllElementsAndStart(bool bigField)
        {
            networkedScene.state.Text = "setting up GUI";
            if (bigField)
            {
                Map.map.SetBounds(20, 20);
            }
            else
            {
                Map.map.SetBounds(10, 12);
            }
            Map.map.SetMap();
            FogOfWar.fog.InitializeFog(true);

            UIBehavior ui = UIBehavior.ui;

            ui.SetPlayers(players);
            ui.SetUI();
            ui.Owner.FindComponent <Camera2DBehavior>().SetDefaultValues();
            for (int i = 0; i < players.Length; i++)
            {
                if (players[i].isLocalPlayer)
                {
                    ui.playerButtons[i].IsChecked = true;
                    new PopulateNetworkedGame().SetCameraPosition(i, players.Length, networkedScene);
                    break;
                }
            }



            if (networkedScene.isHost && POPULATE)
            {
                PopulateNetworkedGame pop = new PopulateNetworkedGame();
                pop.SetRiver(networkedScene.serverDispatcher);
                pop.SetWoods(networkedScene.serverDispatcher);
                for (int i = 0; i < players.Length; i++)
                {
                    pop.SetPlayer(networkedScene.serverDispatcher, players[i], i, players.Length);
                    if (players[i].isLocalPlayer)
                    {
                        pop.SetCameraPosition(i, players.Length, networkedScene);
                    }
                }
                UIBehavior.ui.Owner.FindComponent <VictoryBehavior>().Enable();
            }

            networkedScene.RemoveLobbyUI();
            Trace.WriteLine("Messages: " + networkedScene.sentMessages);
            WaveServices.Layout.PerformLayout();
            ui.Owner.IsActive       = true;
            Map.map.Owner.IsActive  = true;
            Map.map.Owner.IsVisible = true;

            //this class shows the costs for computing d* path on a selected WO
            //DStarDrawable dstarBeh = new DStarDrawable();
            //networkedScene.AddSceneBehavior(dstarBeh, SceneBehavior.Order.PostUpdate);
            //dstarBeh.Set();

            //this is for clearing the new changing visibility tiles,  D* purposes
            networkedScene.AddSceneBehavior(new FogClearBehavior(), SceneBehavior.Order.PostUpdate);
        }