//public methods public void push(Command command) { mQueue.Enqueue(command);}
public Aircraft(Type type, ResourceHolder<Texture, ResourceID> textures, ResourceHolder<Font,FontID> fonts) :base(Table[(int)type].hitpoints) { mType = type; mSprite = new Sprite(textures.get(toTextureID(type))); FloatRect bounds = mSprite.GetLocalBounds(); mSprite.Origin = new Vector2f(bounds.Width / 2, bounds.Height / 2); TextNode healthDisplay = new TextNode(fonts, " "); ; mHealthDisplay = healthDisplay; attachChild(healthDisplay); mTravelledDistance = 0; mDirectionIndex = 0; mIsFiring = false; mIsLaunchingMissile = false; MissileAmmo = 3; mIsMarkedForRemoval = false; mFireCountdown = Time.Zero; mFireRateLevel = 1; mSpreadLevel = 1; mFireCommand = new Command(); mFireCommand.category = (uint)Category.PlayerAircraft; mFireCommand.actionfunc = (SceneNode node, Time time) => { SceneNode aircraft = (Aircraft)node; createBullets(aircraft, textures); }; mLaunchCommand = new Command(); }
public void onCommand(Command command, Time dt) { if (command.category == getCategory()) { command.actionfunc(this, dt); } foreach (SceneNode child in mChildren) { child.onCommand(command, dt); } }