Example #1
0
 public SpriteRender(DrawableActor actor, SpriteInfo texturePart) : base(actor)
 {
     sceneActor    = actor;
     sprite        = new Sprite(texturePart.Texture, texturePart.Rect);
     sprite.Origin = texturePart.Origin;
     Scale         = sceneActor.Transform.Scale;
     SetActive(true);
 }
Example #2
0
 public Gun(MainAsteroidsScene scene, DrawableActor actor, float fwdSpawnBulletScale, PhysicCore physic, int bulletCollideLayer) : base(actor)
 {
     drawableActor            = actor;
     this.physic              = physic;
     this.fwdBulletSpawnScale = fwdSpawnBulletScale;
     BulletLifeTime           = 1.5f;
     FireRate    = 0.1f;
     bulletsPull = new Bullet[(int)(BulletLifeTime / FireRate)];
     for (int i = 0; i < bulletsPull.Length; i++)
     {
         bulletsPull[i]          = new Bullet(scene, bulletCollideLayer);
         bulletsPull[i].LiveTime = BulletLifeTime;
         bulletsPull[i].SetActive(false);
     }
 }
Example #3
0
        public PolygonRender(DrawableActor actor, Polygon polygon) : base(actor)
        {
            this.polygon = new Polygon(polygon);
            convexShape  = new ConvexShape();
            var verts = this.polygon.GetVertices();

            convexShape.SetPointCount((uint)verts.Length);
            for (int i = 0; i < verts.Length; i++)
            {
                convexShape.SetPoint((uint)i, verts[i].ToVector2f());
            }
            convexShape.Origin           = this.polygon.Center.ToVector2f();
            convexShape.OutlineThickness = 2;
            convexShape.OutlineColor     = Color.White;
            convexShape.FillColor        = Color.Transparent;
            drawableActor = actor;
            SetActive(true);
        }