protected override void OnUpdate() { base.OnUpdate(); foreach (MFEntity e in entitySpriteDict.Keys) { MFQuadSprite s = entitySpriteDict[e] as MFQuadSprite; if (s != null) { Rectangle rect = new Rectangle((int)(e.rectangle.left * 120) + Env.screenWidth / 2, (int)(e.rectangle.top * 120) + Env.screenHeight / 2, (int)(e.rectangle.width * 120), (int)(e.rectangle.height * 120)); s.rect = rect; } } }
private void OnEntitySpawned(object sender, EntityArgs args) { MFQuadSprite sp = new MFQuadSprite(); MFMainGameLayer layer = MFLayer.GetLayer <MFMainGameLayer>(); if (args.entity is MFBullet) { sp.texName = "bullet"; } else { sp.texName = "ship"; } if (layer != null) { layer.AddSprite(sp); } this.entitySpriteDict[args.entity] = sp; }