Esempio n. 1
0
        /// <summary>
        /// Event handler for when the user selects a different tank
        /// </summary>
        void SelectionChanged(object sender, TomShane.Neoforce.Controls.EventArgs e)
        {
            if (tanks.Length > 0)
            {
                form.PlayButton.Enabled   = true;
                form.EditButton.Enabled   = true;
                form.DeleteButton.Enabled = true;

                selectedTank = tanks[form.SelectedIndex];

                form.Armor = GameForms.Utils.ConvertFactorToProgressBar(selectedTank.armorFactor);
                form.Speed = GameForms.Utils.ConvertFactorToProgressBar(selectedTank.speedFactor);

                Scene scene = ServiceManager.Game.Renderer.ActiveScene;
                scene.ClearAll();

                tankObj = new Renderer.SceneTools.Entities.Object3(
                    ServiceManager.Resources.GetModel(@"tanks\" + selectedTank.model), Vector3.Zero);
                tankObj.MeshColor = Toolkit.GetColor(selectedTank.color);

                tank      = scene.Add(tankObj, 0);
                turretObj = new Renderer.SceneTools.Entities.Object3(
                    ServiceManager.Resources.GetModel(@"weapons\" + WeaponLoader.GetWeapon(selectedTank.weaponID).Model),
                    Vector3.Zero);

                turretObj.MeshColor = Toolkit.GetColor(selectedTank.color);
                turret = scene.Add(turretObj, 0);
                turretObj.Attach(tankObj, Constants.TURRET_MOUNT);

                ApplySkin();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Event handler for when the user selects a different tank
        /// </summary>
        void SelectionChanged(object sender, TomShane.Neoforce.Controls.EventArgs e)
        {
            if (tanks.Length > 0)
            {
                form.PlayButton.Enabled = true;
                form.EditButton.Enabled = true;
                form.DeleteButton.Enabled = true;

                selectedTank = tanks[form.SelectedIndex];

                form.Armor = GameForms.Utils.ConvertFactorToProgressBar(selectedTank.armorFactor);
                form.Speed = GameForms.Utils.ConvertFactorToProgressBar(selectedTank.speedFactor);

                Scene scene = ServiceManager.Game.Renderer.ActiveScene;
                scene.ClearAll();

                tankObj = new Renderer.SceneTools.Entities.Object3(
                    ServiceManager.Resources.GetModel(@"tanks\" + selectedTank.model), Vector3.Zero);
                tankObj.MeshColor = Toolkit.GetColor(selectedTank.color);

                tank = scene.Add(tankObj, 0);
                turretObj = new Renderer.SceneTools.Entities.Object3(
                    ServiceManager.Resources.GetModel(@"weapons\" + WeaponLoader.GetWeapon(selectedTank.weaponID).Model),
                    Vector3.Zero);

                turretObj.MeshColor = Toolkit.GetColor(selectedTank.color);
                turret = scene.Add(turretObj, 0);
                turretObj.Attach(tankObj, Constants.TURRET_MOUNT);

                ApplySkin();
            }
        }