//constructors public BulletBase(Vector2 centerLocation, Int16 hitBoxRadius, IBulletBehavior bulletBehavior, int entryFrame) { CenterLocation = centerLocation; HitBoxRadius = hitBoxRadius; this.bulletBehavior = bulletBehavior; EntryFrame = entryFrame; TimeManipulationFactor = 1; //default flow of time is 1 InUse = false; //initially set to not in use }
//Public Methods public void Create(Vector2 centerLocation, short hitBoxRadius, IBulletBehavior bulletBehavior, int entryFrame) { for (int i = 0; i < PoolSize; i++) { if (!bullets[i].InUse) { //initializes bullet data bullets[i].CenterLocation = centerLocation; bullets[i].HitBoxRadius = hitBoxRadius; bullets[i].SetBulletBehavior(bulletBehavior); bullets[i].EntryFrame = entryFrame; bullets[i].InUse = true; return; } } }
//sets the bullet behavior of the bullet public void SetBulletBehavior(IBulletBehavior bulletBehavior) { this.bulletBehavior = bulletBehavior; }