Пример #1
0
        public Bullet(MainAsteroidsScene scene, int collideLayer) : base(scene)
        {
            polygonCollider            = new PolygonCollider(this, Core.Resources.Resources.Polygones.Bullet, scene.collidersWorld, collideLayer);
            polygonCollider.Tag        = "Bullet";
            polygonCollider.OnCollide += PolygonCollider_OnCollide;

            physic = new PhysicCore(this);

            polygonRender = new PolygonRender(this, Core.Resources.Resources.Polygones.Bullet);
            spriteRender  = new SpriteRender(this, Core.Resources.Resources.Sprites.Bullet);
            spriteRender.SetActive(false);
        }
Пример #2
0
        public Asteroid(MainAsteroidsScene scene, SpriteInfo spriteInfo, Polygon polygon) : base(scene)
        {
            this.scene   = scene;
            SpriteRender = new SpriteRender(this, spriteInfo);
            SpriteRender.SetActive(false);

            PolygonRender = new PolygonRender(this, polygon);

            collider2D            = new PolygonCollider(this, polygon, scene.collidersWorld, 1);
            collider2D.OnCollide += Collider2D_OnCollide;
            collider2D.Tag        = "Asteroid";
            Physic = new PhysicCore(this);
        }
Пример #3
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);
     }
 }
Пример #4
0
        public UFO(MainAsteroidsScene scene, SpaceShip spaceShip) : base(scene)
        {
            this.scene     = scene;
            this.spaceShip = spaceShip;
            Name           = "UFO";
            physic         = new PhysicCore(this);
            gun            = new Gun(scene, this, 0, physic, 1);

            gun.BulletSpeed    = 450;
            gun.BulletLifeTime = 1.5f;
            gun.FireRate       = 1.5f;

            var plgn = Core.Resources.Resources.Polygones.UFO;

            polygonCollider            = new PolygonCollider(this, plgn, scene.collidersWorld, 1);
            polygonCollider.OnCollide += PolygonCollider_OnCollide;
            polygonCollider.Tag        = Name;
            PolygonRender              = new PolygonRender(this, plgn);
            SpriteRender = new SpriteRender(this, Core.Resources.Resources.Sprites.UFO);
            SpriteRender.SetActive(false);
        }