public BPlayer(Node node,BattleScene battleScene) : base(node) { weaponLayer = new Layer(); this.AddChild (weaponLayer); //最下层 this.bScene = battleScene; mainship = new BWarship(this,new Vector2(480,272),25,25, ContactType.Player, null,null,"Battles//testship.png"); wingman01 = new BWingman(this,new Vector2(480,272),0,15,15); wingman02 = new BWingman(this,new Vector2(480,272),1,15,15); CameraMoveSpeed = 3.5f; mainship.Speed=CameraMoveSpeed; mainship.HP = 7000; //设置武器 List<BWeapon> weapons = new List<BWeapon>(); weapons.Add(new BDefenseCannon(200,WeapType.Secondary, WeapRanType.UShortRange, ContactType.PlayerBullet,0.25f)); weapons.Add(new BGeneralBomb(120,WeapType.Special,WeapRanType.UShortRange, ContactType.Bomb,1f)); weapons.Add(new BDoubleMissile(220, WeapType.Major,WeapRanType.MediumRange, ContactType.PlayerBullet,2f)); for(int i= 0;i < weapons.Count;i++) { weapons[i].ChangeMaster(mainship); } mainship.Weapon = new BWeaponSystem(this,weapons,weaponLayer); }
public BPlayer(Node node, BattleScene battleScene) : base(node) { weaponLayer = new Layer(); this.AddChild(weaponLayer); //最下层 this.bScene = battleScene; mainship = new BWarship(this, new Vector2(480, 272), 25, 25, ContactType.Player, null, null, "Battles//testship.png"); wingman01 = new BWingman(this, new Vector2(480, 272), 0, 15, 15); wingman02 = new BWingman(this, new Vector2(480, 272), 1, 15, 15); CameraMoveSpeed = 3.5f; mainship.Speed = CameraMoveSpeed; mainship.HP = 7000; //设置武器 List <BWeapon> weapons = new List <BWeapon>(); weapons.Add(new BDefenseCannon(200, WeapType.Secondary, WeapRanType.UShortRange, ContactType.PlayerBullet, 0.25f)); weapons.Add(new BGeneralBomb(120, WeapType.Special, WeapRanType.UShortRange, ContactType.Bomb, 1f)); weapons.Add(new BDoubleMissile(220, WeapType.Major, WeapRanType.MediumRange, ContactType.PlayerBullet, 2f)); for (int i = 0; i < weapons.Count; i++) { weapons[i].ChangeMaster(mainship); } mainship.Weapon = new BWeaponSystem(this, weapons, weaponLayer); }
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); }
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); }
//必须调用! public void ChangeMaster(BWarship m) { this.master = m; this.fatherNode = m; }