// set observer fields based on name public void set(Subject.Name name, MoveProxy mProxy) { if (name == Subject.Name.LeftKey) { this.direction = -2f; } else if (name == Subject.Name.RightKey) { this.direction = 2f; } this.privMoveProxy = mProxy; this.name = name; }
// composite metho, set delta direction for all children public void CompositeSetDelta(float d) { MoveProxy mpx = (MoveProxy)this.pProxy; // set itself first mpx.delta = d; Component walk = this.pChildHead; // move all children (recursively until leaves) while (walk != null) { ((GameObject)walk).CompositeSetDelta(d); walk = walk.pNextSibling; } }
public void CompositeAdvance() { MoveProxy mpx = (MoveProxy)this.pProxy; // move itself first mpx.y -= 15f; Component walk = this.pChildHead; // move all children (recursively until leaves) while (walk != null) { ((GameObject)walk).CompositeAdvance(); walk = walk.pNextSibling; } }
public ShootObserver() { this.pMissileProxy = (FlyProxy)ProjectileTracker.pMissile.pProxy; this.pShipProxy = (MoveProxy)ProjectileTracker.pShip.pProxy; }