예제 #1
0
        //public

        //private
        protected override void OnEnter()
        {
            atlas      = new TextureAtlas(TextureUtil.BitmapFromBytes(FileUtil.Read(atlasPath, 0)), 32, 32);
            background = new TileMap(ref atlas, 40, 23, 32, 32);

            for (int x = 0; x < 40; x++)
            {
                for (int y = 0; y < 23; y++)
                {
                    background.SetTileName(x, y, MathUtil.FairRoundedRandom(0, 32 * 32).ToString());
                }
            }
            AddChild(background);

            while (circleFactory.NumFreeInstances > 0)
            {
                CircleSprite sprite = circleFactory.GetObject();
                sprite.TransformOffsetX = sprite.Width / 2.0d;
                sprite.TransformOffsetY = sprite.Height / 2.0d;
                sprite.Rotation         = MathUtil.Random(-180.0d, 180.0d);
                sprite.ScaleX           = sprite.ScaleY = MathUtil.Random(0.1d, 0.3d);
                sprite.X     = MathUtil.Random(0.0d, Window.Width - sprite.Width);
                sprite.Y     = MathUtil.Random(0.0d, Window.Height - sprite.Height);
                sprite.Color = new SFML.Graphics.Color(255, 255, 255, (byte)MathUtil.FairRoundedRandom(25, 255));
                circles.Add(sprite);
                AddChild(sprite);
            }
        }
예제 #2
0
 public override void Update(LevelTime levelTime, CircleSprite arenaCircle, ArenaCamera camera,
                             bool confineCursorToScreen)
 {
     UpdatePosition(levelTime, arenaCircle, camera, confineCursorToScreen);
     heartIterator.Update(levelTime);
     UpdateInvincibility(levelTime);
 }
예제 #3
0
 protected override void OnExit()
 {
     while (circles.Count > 0)
     {
         CircleSprite sprite = circles[0];
         circles.RemoveAt(0);
         RemoveChild(sprite);
         circleFactory.ReturnObject(sprite);
     }
     RemoveChild(background);
     atlas.Dispose();
 }
예제 #4
0
 protected override void UpdatePosition(LevelTime levelTime, CircleSprite arenaCircle,
                                        ArenaCamera camera, bool confineCursorToScreen)
 {
     positionIterator.Update(levelTime);
 }