コード例 #1
0
 public BBullet(Node node, Vector2 pos, Vector2 Dir, float Speed,
                float w, float h, WeapRanType wrt, ContactType ctype, float att, string path) :
     base(node, 0, 0, pos, w, h, ctype, null, null)
 {
     this.Att   = att;
     this.Speed = Speed;
     this.Dir   = Dir;
     body       = new SpriteX(path, pos);
     body.ChangeFather(this);
     body.CenterSprite(TRS.Local.Center);
     body.Color  = new Vector4(12 / 255f, 255 / 255f, 98 / 255f, 255f / 255f);
     maxShootDis = BWeapon.GetRangeByType(wrt);
 }
コード例 #2
0
ファイル: BWarship.cs プロジェクト: PssProgram/Lost-In-Trek
        /// <summary>
        /// 构造一个宇宙舰基对象,不会碰撞的
        /// </summary>
        public BWarship(Node node, Vector2 pos, string path) :
            base(node, 1, 1)
        {
            body = new SpriteX(path, pos);
            body.ChangeFather(this);
            body.CenterSprite(TRS.Local.Center);

            Speed           = 8f;
            MaxRotSpeed     = 0.02f;
            RotSpeed        = MaxRotSpeed;
            RotSpeedInc     = 0.002f;
            this.Body.Scale = allWarshipScale;
        }
コード例 #3
0
        public BBomb(Node node, Vector2 pos, Vector2 Dir, float Speed,
                     float w, float h, WeapRanType wrt, float startBomb, float NoContactTime, ContactType ctype, float att, string path) :
            base(node, 0, 0, pos, w, h, ctype, null, null)
        {
            this.Att = att;

            this.NoContactTime = NoContactTime;
            this.Speed         = Speed;
            this.Dir           = Dir;
            body = new SpriteX(path, pos);
            body.ChangeFather(this);
            body.CenterSprite(TRS.Local.Center);

            //
            body.Scale = new Vector2(12f, 12f);
            body.Color = new Vector4(220 / 255f, 82 / 255f, 98 / 255f, 255f / 255f);
            //base.drawBoundBox = new DrawBoundBox(this);
        }
コード例 #4
0
ファイル: BMissile.cs プロジェクト: PssProgram/Lost-In-Trek
        public BMissile(Node node, Vector2 pos, BWarship target, float Speed, float rots, float rotsInc,
                        float w, float h, WeapRanType wrt, ContactType ctype, float att, string path) :
            base(node, 0, 0, pos, w, h, ctype, null, null)
        {
            this.Att    = att;
            this.Speed  = Speed;
            this.target = target;

            body = new SpriteX(path, pos);
            body.ChangeFather(this);
            body.CenterSprite(TRS.Local.Center);
            body.Scale = new Vector2(0.4f, 0.4f);

            tracker = new BTracker(body, ref this.Speed, rots, rotsInc);
            tracker.SetTarger(target.GetPosition());

            body.Color  = BWarship.ColorID;
            maxShootDis = BWeapon.GetRangeByType(wrt);
        }
コード例 #5
0
        public BattleMap(Node node)
            : base(node)
        {
            background = new SpriteX("Battles//background.png", new Vector2(-100, -100));
            background.ChangeFather(this);
            boundaryWarner = new SpriteX("Battles//BoundaryWarning.png", NoDisplayPos);
            boundaryWarner.ChangeFather(this);
            boundaryWarner.CenterSprite(TRS.Local.Center);

            Vector2 pos;
            SpriteX x;

            for (int i = 0; i < starCount; i++)
            {
                pos = new Vector2(Maths.Rnd.Next((int)(-BattleScene.Width * 0.5f - 100), (int)(BattleScene.Width * 0.5f + 100)),
                                  Maths.Rnd.Next((int)(-BattleScene.Heigth * 0.5f - 100), (int)(BattleScene.Heigth * 0.5f + 100)));
                x = new SpriteX("Battles//star.png", pos);
                x.ChangeFather(this);
                x.CenterSprite(TRS.Local.Center);
            }
        }