Esempio n. 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();
        }
Esempio n. 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.gameObject.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;
            }
        }