예제 #1
0
        public static void Postfix(ref EntityAlive __instance)
        {
            // Check if this feature is enabled.
            if (Configuration.CheckFeatureStatus(AdvFeatureClass, Feature))
            {
                if (__instance is EntityPlayerLocal)
                {
                    return;
                }



                if (RandomSizeHelper.AllowedRandomSize(__instance))
                {
                    // This is the distributed random heigh multiplier. Add or adjust values as you see fit. By default, it's just a small adjustment.
                    float[] numbers = new float[9] {
                        0.7f, 0.8f, 0.9f, 0.9f, 1.0f, 1.0f, 1.0f, 1.1f, 1.2f
                    };
                    System.Random random = new System.Random();

                    int   randomIndex = random.Next(0, numbers.Length);
                    float flScale     = numbers[randomIndex];

                    AdvLogging.DisplayLog(AdvFeatureClass, " Random Size: " + flScale);
                    __instance.Buffs.AddCustomVar("RandomSize", flScale);
                    // scale down the zombies, or upscale them
                    __instance.gameObject.transform.localScale = new Vector3(flScale, flScale, flScale);
                }

                // Check if there's random ranges
                EntityClass entityClass = __instance.EntityClass;
                if (entityClass.Properties.Values.ContainsKey("RandomSizes"))
                {
                    List <float> Ranges  = new List <float>();
                    float        flScale = 1f;
                    foreach (string text in entityClass.Properties.Values["RandomSizes"].Split(new char[] { ',' }))
                    {
                        Ranges.Add(StringParsers.ParseFloat(text));
                    }

                    System.Random random      = new System.Random();
                    int           randomIndex = random.Next(0, Ranges.Count);
                    flScale = Ranges[randomIndex];
                    AdvLogging.DisplayLog(AdvFeatureClass, " Random Size: " + flScale);
                    __instance.Buffs.AddCustomVar("RandomSize", flScale);

                    // scale down the zombies, or upscale them
                    __instance.gameObject.transform.localScale = new Vector3(flScale, flScale, flScale);
                }
            }
        }
예제 #2
0
 public static void Postfix(EntityAlive __instance, BinaryWriter _bw)
 {
     if (!Configuration.CheckFeatureStatus(AdvFeatureClass, Feature))
     {
         return;
     }
     try
     {
         if (RandomSizeHelper.AllowedRandomSize(__instance))
         {
             float flScale = __instance.gameObject.transform.localScale.x;
             _bw.Write(flScale);
         }
     }
     catch (Exception)
     {
     }
 }
예제 #3
0
        public static void Postfix(EntityAlive __instance, BinaryReader _br)
        {
            if (!Configuration.CheckFeatureStatus(AdvFeatureClass, Feature))
            {
                return;
            }

            try
            {
                if (RandomSizeHelper.AllowedRandomSize(__instance))
                {
                    float flScale = _br.ReadSingle();
                    __instance.gameObject.transform.localScale = new Vector3(flScale, flScale, flScale);
                }
            }
            catch (Exception)
            {
            }
        }
예제 #4
0
        public static void Postfix(EntityAlive __instance)
        {
            // Check if this feature is enabled.
            if (Configuration.CheckFeatureStatus(AdvFeatureClass, Feature))
            {
                if (RandomSizeHelper.AllowedRandomSize(__instance))
                {
                    // This is the distributed random heigh multiplier. Add or adjust values as you see fit. By default, it's just a small adjustment.
                    float[] numbers = new float[9] {
                        0.7f, 0.8f, 0.9f, 0.9f, 1.0f, 1.0f, 1.0f, 1.1f, 1.2f
                    };

                    System.Random random      = new System.Random();
                    int           randomIndex = random.Next(0, numbers.Length);
                    float         flScale     = numbers[randomIndex];

                    AdvLogging.DisplayLog(AdvFeatureClass, " Random Size: " + flScale);
                    // scale down the zombies, or upscale them
                    __instance.gameObject.transform.localScale = new Vector3(flScale, flScale, flScale);
                }
            }
        }