Ejemplo n.º 1
0
        /// <summary>
        /// Populate the listboxes with turret and tank models
        /// </summary>
        private void PopulateBoxes()
        {
            //Populate turrets

            weapons = WeaponLoader.GetWeaponsAsList();
            List <object> weaponNames = new List <object>();

            foreach (Weapon weapon in weapons)
            {
                weaponNames.Add(weapon.Name);
            }

            form.Turrets = weaponNames;
            form.Tanks   = Utils.GetTankModels();

            Scene scene = ServiceManager.Game.Renderer.ActiveScene;

            selectedTankRenderID = scene.Add(
                ServiceManager.Resources.GetModel("tanks\\" + form.Tanks[0]),
                Vector3.Zero, 0);
            selectedTank = scene.Access3D(selectedTankRenderID);

            selectedTurretRenderID = scene.Add(
                ServiceManager.Resources.GetModel("weapons\\" + weapons[0].Model),
                Vector3.Zero, 0);
            selectedTurret = scene.Access3D(selectedTurretRenderID);
            selectedTurret.Attach(selectedTank, "Mount");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Event handler for when the user selects a different turret
        /// </summary>
        void TurretSelectionChanged(object sender, TomShane.Neoforce.Controls.EventArgs e)
        {
            Weapon selectedWeapon = weapons[form.TurretIndex];

            form.TurretPower = Utils.ConvertPowerToProgressBar(
                selectedWeapon.Projectile.AverageDamage);
            form.TurretRange = Utils.ConvertRangeToProgressBar(selectedWeapon.Projectile.Range);
            form.TurretRate  = Utils.ConvertRateToProgressBar(
                selectedWeapon.Cooldown);

            Scene scene = ServiceManager.Game.Renderer.ActiveScene;

            scene.Delete(selectedTurretRenderID);

            selectedTurretRenderID = ServiceManager.Game.Renderer.ActiveScene.Add(
                ServiceManager.Resources.GetModel("weapons\\" + selectedWeapon.Model),
                Vector3.Zero, 0);
            float oldRotation = selectedTurret.ZRotation;

            selectedTurret = scene.Access3D(selectedTurretRenderID);
            selectedTurret.Attach(selectedTank, "Mount");
            selectedTurret.ZRotation = oldRotation;

            ApplySkin();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Event handler for when the user selects a different tank
        /// </summary>
        void TankSelectionChanged(object sender, TomShane.Neoforce.Controls.EventArgs e)
        {
            Scene scene = ServiceManager.Game.Renderer.ActiveScene;

            scene.Delete(selectedTankRenderID);

            selectedTankRenderID = scene.Add(
                ServiceManager.Resources.GetModel("tanks\\" + form.Tanks[form.TankIndex]),
                Vector3.Zero, 0);
            float oldRotation = selectedTank.ZRotation;

            selectedTank = scene.Access3D(selectedTankRenderID);
            selectedTurret.Attach(selectedTank, "Mount");
            selectedTank.ZRotation = oldRotation;

            ApplySkin();
        }