Esempio n. 1
0
 static ShrapnelGenerator()
 {
     DEFAULT_SHRAPNEL_INFO = new ShrapnelInfo();
     DEFAULT_SHRAPNEL_INFO.COUNT_MIN = 3;
     DEFAULT_SHRAPNEL_INFO.COUNT_MAX = 7;
     DEFAULT_SHRAPNEL_INFO.VELOCITY_MIN = -3;
     DEFAULT_SHRAPNEL_INFO.VELOCITY_MAX = 3;
     DEFAULT_SHRAPNEL_INFO.LIFE_MIN = 4;
     DEFAULT_SHRAPNEL_INFO.LIFE_MAX = 10;
     DEFAULT_SHRAPNEL_INFO.SIZE = 1;
 }
Esempio n. 2
0
        internal static void createShrapnel(List<DrawableObjectAbstract> pipeline, Vector2 pos, Color color, float depth, ref ShrapnelInfo info)
        {
            GameTexture image = TextureMap.fetchTexture("Pixel");

            // use a random seed based on position, not time, otherwise all the bullets
            //  in a frame will have the same shrapnel generated (or so it seems)
            Random r = RandomManager.get();
            int count = r.Next(info.COUNT_RANGE) + info.COUNT_MIN;
            for (int i = 0; i < count; i++)
            {
                Vector2 v =
                    new Vector2(r.Next(info.VELOCITY_RANGE) + info.VELOCITY_MIN,
                                r.Next(info.VELOCITY_RANGE) + info.VELOCITY_MIN);
                int life = r.Next(info.LIFE_RANGE) + info.LIFE_MIN;

                Shrapnel s = new Shrapnel(pipeline, pos, v, depth, color, life, info.SIZE);
            }
        }
Esempio n. 3
0
 public override void die()
 {
     base.die();
     ShrapnelInfo info = new ShrapnelInfo();
     info.COUNT_MIN = 20;
     info.COUNT_MAX = 30;
     info.VELOCITY_MIN = -3;
     info.VELOCITY_MAX = 3;
     info.LIFE_MIN = 3;
     info.LIFE_MAX = 12;
     info.SIZE = 3;
     ShrapnelGenerator.createShrapnel(pipeline_, position_, Color.Red, Constants.DEPTH_DEBUG_LINES, ref info);
 }