Beispiel #1
0
        public BEnemyship(Node node, Vector2 pos,List<BWeapon> weapons,Layer weaponLayer, string path)
            : base(node,pos,25,25, ContactType.Enemy,null,null,path)
        {
            this.weaponLayer =weaponLayer;

            //this.ToContact
            //this.beContact
            //随机AI间隔
            float rnd = Maths.Rnd.Next(1,5)*0.1f;
            aiticker = new Ticker(rnd);
            //随机锁敌半径
            lockRadius =Maths.Rnd.Next(500,900);
            //随机追踪间隔
            trackCd = new Countdown(Maths.Rnd.Next(10,50)*0.1f);

            this.Speed = 3.2f;
            inertiaSpeed = 1.83f;
            TrackAction = new BTracker (Body, ref  this.Speed, 0.025f, 0.0025f);
            lockRadius *= lockRadius;
            HP = 220;

            for(int i= 0;i < weapons.Count;i++)
            {
                weapons[i].ChangeMaster(this);
            }

            this.Weapon = new BWeaponSystem(this,weapons,weaponLayer);
        }
Beispiel #2
0
        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);
        }