Exemple #1
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();
        }
Exemple #2
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);
        }
Exemple #3
0
        void TankSelectionChanged(object sender, TomShane.Neoforce.Controls.EventArgs e)
        {
            Renderer.SceneTools.Scene scene = ServiceManager.Scene;
            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, Constants.TURRET_MOUNT);
            selectedTank.ZRotation = oldRotation;

            selectedTankModelName = (string)form.Tanks[form.TankIndex];
            ApplySkin();
        }
Exemple #4
0
        /// <summary>
        /// Updates the screen
        /// </summary>
        /// <param name="gameTime">XNA gameTime</param>
        public override void Update()
        {
            Renderer.SceneTools.Scene scene = ServiceManager.Scene;
            selectedTank.RotateZ(MathHelper.ToRadians((float)(10 * ServiceManager.Game.DeltaTime)));
            selectedTurret.RotateZ(MathHelper.ToRadians((float)(10 * ServiceManager.Game.DeltaTime)));

            if (selectedTurret.MeshColor != form.TankColor || selectedTank.MeshColor != form.TankColor)
            {
                changesMade = true;
            }

            this.DetectChanges();

            // TODO: This is done here for lack of color-event handling.
            selectedTank.MeshColor   = form.TankColor;
            selectedTurret.MeshColor = form.TankColor;

            ServiceManager.Game.Renderer.Update();
        }