public void SetAttributesByType()
 {
     switch (this.ModuleType)
     {
         case ShipModuleType.Turret:
             this.InstalledWeapon = ResourceManager.GetWeapon(ResourceManager.ShipModulesDict[this.UID].WeaponType);
             this.InstalledWeapon.moduleAttachedTo = this;
             this.InstalledWeapon.SetOwner(this.Parent);
             this.InstalledWeapon.Center = this.Center;
             this.isWeapon = true;
             this.InstalledWeapon.isTurret = true;
             this.Parent.Weapons.Add(this.InstalledWeapon);
             break;
         case ShipModuleType.MainGun:
             this.InstalledWeapon = ResourceManager.GetWeapon(ResourceManager.ShipModulesDict[this.UID].WeaponType);
             this.InstalledWeapon.moduleAttachedTo = this;
             this.InstalledWeapon.SetOwner(this.Parent);
             this.InstalledWeapon.isMainGun = true;
             this.InstalledWeapon.Center = this.Center;
             this.isWeapon = true;
             this.Parent.Weapons.Add(this.InstalledWeapon);
             break;
         case ShipModuleType.MissileLauncher:
             this.InstalledWeapon = ResourceManager.GetWeapon(ResourceManager.ShipModulesDict[this.UID].WeaponType);
             this.InstalledWeapon.moduleAttachedTo = this;
             this.InstalledWeapon.SetOwner(this.Parent);
             this.InstalledWeapon.Center = this.Center;
             this.isWeapon = true;
             this.Parent.Weapons.Add(this.InstalledWeapon);
             break;
         case ShipModuleType.Colony:
             this.Parent.isColonyShip = true;
             break;
         case ShipModuleType.Bomb:
             this.Parent.BombBays.Add(this);
             break;
         case ShipModuleType.Drone:
             this.InstalledWeapon = ResourceManager.GetWeapon(ResourceManager.ShipModulesDict[this.UID].WeaponType);
             this.InstalledWeapon.moduleAttachedTo = this;
             this.InstalledWeapon.SetOwner(this.Parent);
             this.InstalledWeapon.Center = this.Center;
             this.isWeapon = true;
             this.Parent.Weapons.Add(this.InstalledWeapon);
             break;
         case ShipModuleType.Spacebomb:
             this.InstalledWeapon = ResourceManager.GetWeapon(ResourceManager.ShipModulesDict[this.UID].WeaponType);
             this.InstalledWeapon.moduleAttachedTo = this;
             this.InstalledWeapon.SetOwner(this.Parent);
             this.InstalledWeapon.Center = this.Center;
             this.isWeapon = true;
             this.Parent.Weapons.Add(this.InstalledWeapon);
             break;
     }
     if ((double)this.shield_power_max > 0.0)
     {
         this.shield = new Shield();
         this.shield.World = Matrix.Identity * Matrix.CreateScale(2f) * Matrix.CreateRotationZ(this.Rotation) * Matrix.CreateTranslation(this.Center.X, this.Center.Y, 0.0f);
         this.shield.Owner = (GameplayObject)this;
         this.shield.displacement = 0.0f;
         this.shield.texscale = 2.8f;
         this.shield.Rotation = this.Rotation;
         lock (GlobalStats.ShieldLocker)
             ShieldManager.shieldList.Add(this.shield);
     }
     if (this.IsSupplyBay)
     {
         if (this.Parent.Role == "freighter")
             this.Parent.Role = "supply";
         this.Parent.IsSupplyShip = true;
     }
     this.Health = this.HealthMax;
 }
 private static void DrawShield(Shield shield, Matrix view, Matrix projection)
 {
     foreach (ModelMesh mesh in ShieldManager.shieldModel.Meshes)
     {
         ShieldManager.ShieldEffect.Parameters["World"].SetValue(Matrix.CreateScale(50f) * shield.World);
         ShieldManager.ShieldEffect.Parameters["View"].SetValue(view);
         ShieldManager.ShieldEffect.Parameters["Projection"].SetValue(projection);
         ShieldManager.ShieldEffect.Parameters["tex"].SetValue(ShieldManager.shieldTexture);
         ShieldManager.ShieldEffect.Parameters["AlphaMap"].SetValue(ShieldManager.gradientTexture);
         ShieldManager.ShieldEffect.Parameters["scale"].SetValue((float)shield.texscale);
         ShieldManager.ShieldEffect.Parameters["displacement"].SetValue((float)shield.displacement);
         ShieldManager.ShieldEffect.CurrentTechnique = ShieldManager.ShieldEffect.Techniques["Technique1"];
         foreach (ModelMeshPart part in mesh.MeshParts)
         {
             part.Effect = ShieldManager.ShieldEffect;
         }
         mesh.Draw();
     }
 }
 public static void FireShieldAnimation(GameplayObject Obj, float Rotation, float Scale)
 {
     Shield shield = new Shield();
     Matrix w = ((Matrix.Identity * Matrix.CreateScale(1f)) * Matrix.CreateRotationZ(Rotation)) * Matrix.CreateTranslation(Obj.Center.X, Obj.Center.Y, 0f);
     shield.World = w;
     shield.Owner = Obj;
     shield.displacement = ShieldManager.y;
     shield.texscale = ShieldManager.z;
     shield.Rotation = Rotation;
     ShieldManager.shieldList.Add(shield);
 }
 public void InitializeUpdate()
 {
     this.shield = new Shield();
     this.shield.World = Matrix.Identity * Matrix.CreateScale(2f) * Matrix.CreateRotationZ(0.0f) * Matrix.CreateTranslation(this.Position.X, this.Position.Y, 2500f);
     this.shield.Center = new Vector3(this.Position.X, this.Position.Y, 2500f);
     this.shield.displacement = 0.0f;
     this.shield.texscale = 2.8f;
     this.shield.Rotation = 0.0f;
     ShieldManager.PlanetaryShieldList.Add(this.shield);
     //this.initializing = true;
     this.UpdateDescription();
     this.SO = new SceneObject(((ReadOnlyCollection<ModelMesh>)ResourceManager.GetModel("Model/SpaceObjects/planet_" + (object)this.planetType).Meshes)[0]);
     this.SO.ObjectType = ObjectType.Dynamic;
     this.SO.World = Matrix.Identity * Matrix.CreateScale(3f) * Matrix.CreateScale(this.scale) * Matrix.CreateTranslation(new Vector3(this.Position, 2500f));
     this.RingWorld = Matrix.Identity * Matrix.CreateRotationX(MathHelper.ToRadians(this.ringTilt)) * Matrix.CreateScale(5f) * Matrix.CreateTranslation(new Vector3(this.Position, 2500f));
     //this.initializing = false;
 }