Пример #1
0
        /// <summary>
        /// 创建一个飞行的实体弹药
        /// </summary>
        /// <param name="position">位置</param>
        /// <param name="velocity">发射者初速度</param>
        /// <param name="rotation">表示子弹旋转方向的矩阵</param>
        /// <param name="weapon">子弹所属武器类型</param>
        /// <param name="number">这个弹药串中子弹的数量</param>
        public Bullet(GameWorld gameWorld, Weapon weapon, float num, Vector3 position)
        {
            this.gameWorld = gameWorld;
            this.weapon    = weapon;
            this.position0 = position;
            this.position  = position;
            this.positionl = position;
            this.rotation  = weapon.unit.Rotation;
            this.num       = num;
            Random random = new Random();
            float  angel  = ((float)random.NextDouble()) * weapon.maxAngle;
            float  rZ     = ((float)random.NextDouble()) * MathHelper.Pi;

            this.velocity = weapon.unit.Velocity + Vector3.TransformNormal(Vector3.Forward
                                                                           , Matrix.CreateRotationY(MathHelper.ToRadians(angel)) * Matrix.CreateRotationZ(rZ)
                                                                           * weapon.unit.Rotation)
                            * weapon.basicSpeed;
            this.Group      = weapon.unit.Group;
            this.bonusRange = weapon.range / weapon.basicSpeed * weapon.unit.Velocity.Length();
            if (weapon.bulletEffectType != null)
            {
                this.bulletModel = new AODModel(gameWorld, weapon.bulletEffectType, position, Matrix.Identity, 1.0f);//需改
                bulletModel.NormalEffectsBeginToDie();
            }
        }
Пример #2
0
 public ParticleEffect(GameWorld gameWorld, ParticleEffectType particleEffectType, AODModel model, Vector3 position, float scale)
 {
     parentModel   = model;
     this.position = position;
     this.scale   *= scale;
     LoadType(gameWorld, particleEffectType);
 }
Пример #3
0
        public LootItem(Vector3 position, LootSettings settings, GameWorld gameWorld)
        {
            this.Position      = position;
            this.modelRotation = Matrix.CreateRotationX((float)AODGameLibrary.Helpers.RandomHelper.Random.NextDouble() * MathHelper.Pi) * Matrix.CreateRotationY((float)AODGameLibrary.Helpers.RandomHelper.Random.NextDouble() * MathHelper.Pi);
            this.Scale         = settings.ModelScale;
            this.lootSettings  = settings;

            this.gameWorld = gameWorld;
            if (settings.ModelName != "")
            {
                Model = new AODModel(gameWorld, gameWorld.Content.Load <AODModelType>(settings.ModelName), position, modelRotation, Scale);
            }

            BulletNum = (int)MathHelper.Lerp(lootSettings.MinBulletNum, lootSettings.MaxBulletNum, (float)AODGameLibrary.Helpers.RandomHelper.Random.NextDouble());
        }
Пример #4
0
 void LoadType(DecorationType dT, GameWorld gameWorld)
 {
     this.Name      = dT.Name;
     this.UnitState = UnitState.alive;
     this.Scale     = AODGameLibrary.Helpers.RandomHelper.RandomNext(dT.MinScale, dT.MaxScale);
     if (dT.RandomModelRotation)
     {
         this.modelRotation = Matrix.Identity
                              * Matrix.CreateRotationX(AODGameLibrary.Helpers.RandomHelper.RandomNext(0, MathHelper.Pi))
                              * Matrix.CreateRotationY(AODGameLibrary.Helpers.RandomHelper.RandomNext(0, MathHelper.Pi))
                              * Matrix.CreateRotationZ(AODGameLibrary.Helpers.RandomHelper.RandomNext(0, MathHelper.Pi));
     }
     else
     {
         this.modelRotation = dT.ModelRotation;
     }
     if (dT.Modelname != "")
     {
         Model = new AODModel(gameWorld, gameWorld.game.Content.Load <AODModelType>(dT.Modelname), Position, ModelRotation, Scale);
     }
     else
     {
         Model = null;
     }
     this.Mass          = dT.Mass;
     this.FrictionForce = dT.FrictionForce;
     //this.sideThrustForce = unitType.sideThrustForce;
     this.angularRate           = dT.AngularRate;
     this.MaxArmor              = dT.MaxArmor;
     this.MaxShield             = dT.MaxShield;
     this.Armor                 = this.MaxArmor;
     this.Shield                = this.MaxShield;
     this.ShieldRestoreRate     = dT.ShieldRestoreRate;
     this.ShieldRestoreTime     = dT.ShieldRestoreTime;
     this.ShieldRestoreTimeleft = this.ShieldRestoreTime;
     this.ArmorRestoreRate      = dT.ArmorRestoreRate;
     base.Bounding              = dT.Bounding;
     base.Heavy                 = dT.Heavy;
     this.Far = dT.Far;
 }
Пример #5
0
 public ParticleEffect(GameWorld gameWorld, ParticleEffectType particleEffectType, AODModel model)
 {
     parentModel = model;
     LoadType(gameWorld, particleEffectType);
 }
Пример #6
0
 public void SetModel(string modelName, GameWorld gameWorld)
 {
     Model = new AODModel(gameWorld, gameWorld.game.Content.Load <AODModelType>(modelName), Position, ModelRotation, Scale);
 }