Пример #1
0
        void DropChaff()
        {
            PartResource cmResource = GetCMResource();

            if (cmResource == null || !(cmResource.amount >= 1))
            {
                return;
            }
            cmResource.amount--;
            audioSource.pitch = UnityEngine.Random.Range(0.9f, 1.1f);
            audioSource.PlayOneShot(cmSound);

            if (!vci)
            {
                vci = vessel.gameObject.AddComponent <VesselChaffInfo>();
            }
            vci.Chaff();

            GameObject cm    = chaffPool.GetPooledObject();
            CMChaff    chaff = cm.GetComponent <CMChaff>();

            chaff.Emit(ejectTransform.position, ejectVelocity * ejectTransform.forward);

            FireParticleEffects();
        }
Пример #2
0
        void SetupCM()
        {
            countermeasureType = countermeasureType.ToLower();
            switch (countermeasureType)
            {
            case "flare":
                cmType  = CountermeasureTypes.Flare;
                cmSound = GameDatabase.Instance.GetAudioClip("BDArmory/Sounds/flareSound");
                if (!flarePool)
                {
                    SetupFlarePool();
                }
                resourceName = "CMFlare";
                break;

            case "chaff":
                cmType       = CountermeasureTypes.Chaff;
                cmSound      = GameDatabase.Instance.GetAudioClip("BDArmory/Sounds/smokeEject");
                resourceName = "CMChaff";
                vci          = vessel.GetComponent <VesselChaffInfo>();
                if (!vci)
                {
                    vci = vessel.gameObject.AddComponent <VesselChaffInfo>();
                }
                if (!chaffPool)
                {
                    SetupChaffPool();
                }
                break;

            case "smoke":
                cmType         = CountermeasureTypes.Smoke;
                cmSound        = GameDatabase.Instance.GetAudioClip("BDArmory/Sounds/smokeEject");
                smokePoofSound = GameDatabase.Instance.GetAudioClip("BDArmory/Sounds/smokePoof");
                resourceName   = "CMSmoke";
                if (smokePool == null)
                {
                    SetupSmokePool();
                }
                break;
            }
        }
Пример #3
0
 void SetupCM()
 {
     countermeasureType = countermeasureType.ToLower();
     switch(countermeasureType)
     {
     case "flare":
         cmType = CountermeasureTypes.Flare;
         cmSound = GameDatabase.Instance.GetAudioClip("BDArmory/Sounds/flareSound");
         if(!flarePool)
         {
             SetupFlarePool();
         }
         resourceName = "CMFlare";
         break;
     case "chaff":
         cmType = CountermeasureTypes.Chaff;
         cmSound = GameDatabase.Instance.GetAudioClip("BDArmory/Sounds/smokeEject");
         resourceName = "CMChaff";
         vci = vessel.GetComponent<VesselChaffInfo>();
         if(!vci)
         {
             vci = vessel.gameObject.AddComponent<VesselChaffInfo>();
         }
         if(!chaffPool)
         {
             SetupChaffPool();
         }
         break;
     case "smoke":
         cmType = CountermeasureTypes.Smoke;
         cmSound = GameDatabase.Instance.GetAudioClip("BDArmory/Sounds/smokeEject");
         smokePoofSound = GameDatabase.Instance.GetAudioClip("BDArmory/Sounds/smokePoof");
         resourceName = "CMSmoke";
         if(smokePool == null)
         {
             SetupSmokePool();
         }
         break;
     }
 }
Пример #4
0
        void DropChaff()
        {
            PartResource cmResource = GetCMResource();
            if(cmResource && cmResource.amount >= 1)
            {
                cmResource.amount--;
                audioSource.pitch = UnityEngine.Random.Range(0.9f, 1.1f);
                audioSource.PlayOneShot(cmSound);

                if(!vci)
                {
                    vci = vessel.gameObject.AddComponent<VesselChaffInfo>();
                }
                vci.Chaff();

                GameObject cm = chaffPool.GetPooledObject();
                CMChaff chaff = cm.GetComponent<CMChaff>();
                chaff.Emit(ejectTransform.position, ejectVelocity * ejectTransform.forward);

                FireParticleEffects();
            }
        }