Ejemplo n.º 1
0
        static bool Prefix(Agent __instance, ref Blow b)
        {
            if (InvulnerableSettings.Instance.Enabled == false)
            {
                return(true);
            }
            if (__instance.IsMainAgent)
            {
                if (!b.BlowFlag.HasAnyFlag(BlowFlags.NoSound))
                {
                    Agent agent = (b.OwnerId != -1) ? __instance.Mission.FindAgentWithIndex(b.OwnerId) : __instance;

                    int   soundIndex     = GetSoundIndex(GetWeaponClass(ref b));
                    float forceParameter = GetForceParameter(ref b);
                    SoundEventParameter soundEventParameter = new SoundEventParameter("Force", forceParameter);
                    Mission.Current.MakeSound(soundIndex, b.Position, true, false, -1, -1, ref soundEventParameter);
                    MatrixFrame f       = __instance.Frame;
                    Vec3        dirDist = b.Position - f.origin;
                    Vec3        dir     = dirDist.NormalizedCopy();
                    float       offset  = 0.05f * agent.GetEyeGlobalHeight();
                    f.origin = b.Position + dir * offset;
                    Mission.Current.Scene.CreateBurstParticle(ParticleSystemManager.GetRuntimeIdByName("psys_game_metal_metal_coll"), f);
                    __instance.Mission.AddSoundAlarmFactorToAgents(b.OwnerId, b.Position, 15f);
                }
                return(false);
            }
            return(true);
        }
 public bool PlaySoundWithParam(
     int soundCodeId,
     SoundEventParameter parameter,
     ref Vec3 position)
 {
     return(ScriptingInterfaceOfIMBSoundEvent.call_PlaySoundWithParamDelegate(soundCodeId, parameter, ref position));
 }
Ejemplo n.º 3
0
 public static bool PlaySound(
     string soundPath,
     ref SoundEventParameter parameter,
     Vec3 position)
 {
     int  eventIdFromString = SoundEvent.GetEventIdFromString(soundPath);
     Vec3 vec3 = position;
     ref SoundEventParameter local1 = ref parameter;
Ejemplo n.º 4
0
        public static bool PlaySound(int soundCodeId, ref SoundEventParameter parameter, Vec3 position)
        {
            Vec3 position1 = position;

            return(MBSoundEvent.PlaySound(soundCodeId, ref parameter, ref position1));
        }