public RandomShooter(Barragebatch x, LinkedList <Bullet> mBullet, Vector2 position, Sprite target) : base(x.iGunID, position, x.iGunStartTime, x.iGunEndTime - x.iGunStartTime, x.iBindingID) { ran = new Random(); localBullet = mBullet; this.x = x; this.target = target; this.isAbsolutePos = x.bIsAbsolute; //调用初始化函数,初始化除了事件以外的所有成员变量 Initialize(0); //处理发射器事件以及子弹事件 this.bulletEvent = new List <BarrageEvent>(); this.myEvent = new List <BarrageEvent>(); this.myEventReader = new EventReader(); this.currentEvent = new List <BarrageEvent>(); this.relativeBinding = x.bRelativeBinding; //处理子弹事件 if (bulletData.bulletEvent.Length != 0) { bulletEvent = myEventReader.ReadEvent(bulletData.bulletEvent); } if (x.strGunEvent.Length != 0) { myEvent = myEventReader.ReadEvent(x.strGunEvent); } }
public DirectShooter(int ID, LinkedList <Bullet> mBullet, BulletInfo bulletData, int frequency, Vector2 relativePosition, int startFrame, int life, Sprite target, string eventString, int eventLoopFrame, float randomRadius, bool isSelfSnipe, int bindingID, bool relativeBinding) : base(ID, relativePosition, startFrame, life, bindingID) { this.localBullet = mBullet; this.bulletData = bulletData; this.frequency = frequency; this.randomRadius = randomRadius; this.target = target; this.isSelfSnipe = isSelfSnipe; this.isHighLight = bulletData.isHighLight; this.fireCircleRadius = bulletData.fireRadius; this.fireInCircle = bulletData.isFireInCircle; this.randomPosition = Vector2.Zero; this.circlePosition = Vector2.Zero; this.bulletEvent = new List <BarrageEvent>(); this.myEvent = new List <BarrageEvent>(); this.myEventReader = new EventReader(); this.currentEvent = new List <BarrageEvent>(); this.relativeBinding = relativeBinding; //处理子弹事件 if (bulletData.bulletEvent.Length != 0) { bulletEvent = myEventReader.ReadEvent(bulletData.bulletEvent); } if (eventString.Length != 0) { myEvent = myEventReader.ReadEvent(eventString); } eventID = 0; this.eventLoopFrame = eventLoopFrame; }
EventReader myEventReader; //事件读取器 public LaserShooter(Barragebatch x, LinkedList <Bullet> myLaser, Vector2 position, Sprite target) : base(x.iGunID, position, x.iGunStartTime, x.iGunEndTime - x.iGunStartTime, x.iBindingID) { this.x = x; this.target = target; this.localBullet = myLaser; Initialize(0); this.isAbsolutePos = x.bIsAbsolute; //处理发射器事件以及子弹事件 this.myEventReader = new EventReader(); this.myEvent = new List <BarrageEvent>(); this.currentEvent = new List <BarrageEvent>(); this.relativeBinding = x.bRelativeBinding; //处理子弹事件 if (x.strBulletEvent.Length != 0) { myEvent = myEventReader.ReadEvent(x.strBulletEvent); } }
public Enemy(ImageName imageName, Point frameSize, Point sheetSize, Point framePosition, Vector2 position, Vector2 spriteOrigin, int hitRadius, int speed, float speedDirection, int HP, string eventStr) : base(imageName, frameSize, sheetSize, framePosition, position, spriteOrigin, hitRadius, speed, enemyPicturePerFrame) { rotateDegree = 0; this.HP = HP; this.speedDirection = speedDirection; this.myEventReader = new EventReader(); if (eventStr.Length != 0) { myEvent = myEventReader.ReadEvent(eventStr); } currentEvent = new List <BarrageEvent>(); this.isOneFrame = false; eventID = 0; eventLoopFrame = 10000; animeFrameNumber = 0; myState = SpriteState.BORN; }