コード例 #1
0
        private void InitWeapons()
        {
            {
                ShaderInfo.Material fragMaterial;
                fragMaterial.Emissive  = new Color(0, 0, 0, 255);
                fragMaterial.Diffuse   = new Color(74, 74, 74, 255);
                fragMaterial.Specular  = new Color(255, 255, 255, 255);
                fragMaterial.Shininess = 0.9f;

                LightingInfo lightingInfo = new LightingInfo("fragNadeNormal", fragMaterial);
                Weapon       fragGrenade  = new Weapon(null, "FragGrenade", "FragNade", new Vector2(0.5f, 0), new Vector2(0.5f, 0), new Vector2(0), true);
                fragGrenade.Position                  = new Vector2(0, 0.5f);
                fragGrenade.WeaponDrawable            = new Drawable("fragNade", new Vector2(4), 8, 8, 0, 0, 0.2f);
                fragGrenade.WeaponDrawable.ShaderInfo = lightingInfo;
                fragGrenade.Tags.Add("MotionFlip");
                Attack fragImpactAttack = new Attack(Attack.DamageType.Kinetic, new List <StatusEffect>(), 10.0f);
                Attack fragAreaAttack   = new Attack(Attack.DamageType.Kinetic, new List <StatusEffect>(), 40.0f);
                fragGrenade.InitialiseAttack(fragImpactAttack, fragAreaAttack, 0.5f, 0.3f, 5.0f, 0.0f, 0.05f, 0.6f, 2.0, false, true);
                Weapons.Add("FragGrenade", fragGrenade);
            }
            {
                Sound firingSound = new Sound();
                firingSound.AddSoundEffect("PistolShot");
                //firingSound.AddSoundEffect("PistolShot2");
                //firingSound.AddSoundEffect("PistolShot3");
                //firingSound.AddSoundEffect("PistolShot4");
                //firingSound.AddSoundEffect("PistolShot5");

                ShaderInfo.Material pistolMaterial;
                pistolMaterial.Emissive  = new Color(0, 0, 0, 255);
                pistolMaterial.Diffuse   = new Color(74, 74, 74, 255);
                pistolMaterial.Specular  = new Color(255, 255, 255, 255);
                pistolMaterial.Shininess = 0.9f;

                LightingInfo lightingInfo = new LightingInfo("PistolNormal", pistolMaterial);
                Weapon       pistol       = new Weapon(null, "Pistol", "SmallRound", new Vector2(36 / 32f, 1.5f / 32f), new Vector2(1.0f, 0f), new Vector2(-9.5f / 32f, -4.5f / 32f), true);
                pistol.Position                  = new Vector2(0f, 0.8f);
                pistol.WeaponDrawable            = new Drawable("Pistol", new Vector2(16, 16), 32, 32, 0, 0, 0.1f);
                pistol.WeaponDrawable.ShaderInfo = lightingInfo;
                pistol.FireEmitters.Add(new Emitter(null, Emitters["PistolFlash"]));
                pistol.Tags.Add("MotionFlip");
                Attack pistolImpactAttack = new Attack(Attack.DamageType.Kinetic, new List <StatusEffect>(), 10.0f);
                Attack pistolAreaAttack   = new Attack(Attack.DamageType.Kinetic, new List <StatusEffect>(), 40.0f);
                pistol.InitialiseAttack(pistolImpactAttack, pistolAreaAttack, 0.2f, 20.0f, 5.0f, 0.0f, 0.05f, 0.0f, 2.0, true, true);
                pistol.AddSound(firingSound);
                Weapons.Add("Pistol", pistol);
            }
            {
                Sound firingSound = new Sound();
                firingSound.AddSoundEffect("PistolShot");
                firingSound.AddSoundEffect("PistolShot2");
                firingSound.AddSoundEffect("PistolShot3");
                firingSound.AddSoundEffect("PistolShot4");
                firingSound.AddSoundEffect("PistolShot5");

                ShaderInfo.Material turretMaterial;
                turretMaterial.Emissive  = new Color(0, 0, 0, 255);
                turretMaterial.Diffuse   = new Color(74, 74, 74, 255);
                turretMaterial.Specular  = new Color(255, 255, 255, 255);
                turretMaterial.Shininess = 0.9f;

                LightingInfo lightingInfo = new LightingInfo("TurretNormal", turretMaterial);
                Weapon       turretBase   = new Weapon(null, "TurretBase", "SmallRound", new Vector2(12 / 32f, 0.5f / 32f), new Vector2(6.5f / 32f, 0 / 32f), new Vector2(0f / 32f, -8.5f / 32f), true);
                turretBase.Position                  = new Vector2(0f / 32f, 8.5f / 32f);
                turretBase.WeaponDrawable            = new Drawable("Turret", new Vector2(16, 16), 32, 32, 0, 32, 0.1f);
                turretBase.WeaponDrawable.ShaderInfo = lightingInfo;
                turretBase.FireEmitters.Add(new Emitter(null, Emitters["PistolFlash"]));
                turretBase.Tags.Add("MotionFlip");
                Attack pistolImpactAttack = new Attack(Attack.DamageType.Kinetic, new List <StatusEffect>(), 10.0f);
                Attack pistolAreaAttack   = new Attack(Attack.DamageType.Kinetic, new List <StatusEffect>(), 40.0f);
                turretBase.InitialiseAttack(pistolImpactAttack, pistolAreaAttack, 0.5f, 20.0f, 5.0f, 0.0f, 0.05f, 0.0f, 2.0, true, true);
                turretBase.AddSound(firingSound);
                Weapons.Add("TurretBase", turretBase);
            }
        }