示例#1
0
        /// <summary>
        /// Populate the listboxes with turret and tank models
        /// </summary>
        private void PopulateBoxes()
        {
            List<object> turrets = new List<object>();

            //Populate turrets

            weapons = WeaponLoader.GetWeaponsAsList();

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

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

            Renderer.SceneTools.Scene scene = ServiceManager.Scene;

            selectedTankRenderID = scene.Add(
                 ServiceManager.Resources.GetModel("tanks\\" + tank.model),
                 Vector3.Zero, 0);
            selectedTank = scene.Access3D(selectedTankRenderID);

            selectedTurretRenderID = scene.Add(
                ServiceManager.Resources.GetModel("weapons\\" + WeaponLoader.GetWeapon(tank.weaponID).Model),
                Vector3.Zero, 0);
            selectedTurret = scene.Access3D(selectedTurretRenderID);
            selectedTurret.Attach(selectedTank, Constants.TURRET_MOUNT);
        }
示例#2
0
        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);

            Renderer.SceneTools.Scene scene = ServiceManager.Scene;
            scene.Delete(selectedTurretRenderID);

            selectedTurretRenderID = ServiceManager.Scene.Add(
                ServiceManager.Resources.GetModel("weapons\\" + selectedWeapon.Model),
                Vector3.Zero, 0);
            float oldRotation = selectedTurret.ZRotation;
            selectedTurret = scene.Access3D(selectedTurretRenderID);
            selectedTurret.Attach(selectedTank, Constants.TURRET_MOUNT);
            selectedTurret.ZRotation = oldRotation;

            selectedTurretName = selectedWeapon.Name;
            ApplySkin();
        }
        /// <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");
        }