protected override void UpdateWorld() { if (GamePad.ButtonBackClicked()) { Exit(); } if (GamePad.ButtonAClicked()) { mPatrols.Add(new PatrolObject()); } if (GamePad.ButtonBClicked()) { if (mPatrols.Count > 0) { PatrolObject p = mPatrols[0]; p.RemoveFromAutoDrawSet(); mPatrols.RemoveAt(0); } } foreach (PatrolObject p in mPatrols) { p.Update(); } EchoToTopStatus("A to add a new patrol, B to remove a patrol"); EchoToBottomStatus("Currently NumPatrol=" + mPatrols.Count); }
protected override void UpdateWorld() { if (GamePad.ButtonBackClicked()) { Exit(); } if (GamePad.ButtonAClicked()) { mPatrols.Add(new PatrolObject()); } if (GamePad.ButtonBClicked()) { if (mPatrols.Count > 0) { PatrolObject p = mPatrols[0]; p.RemoveFromAutoDrawSet(); mPatrols.RemoveAt(0); } } int numChase = 0; for (int i = 0; i < mPatrols.Count; i++) { PatrolObject p = mPatrols[i]; if (p.ChasingHero()) { numChase++; } if (p.Update(mHero)) { mPatrols.Remove(p); p.RemoveFromAutoDrawSet(); } } mHero.Update(GamePad.ThumbSticks.Right); EchoToTopStatus("A to add a new patrol, B to remove a patrol"); EchoToBottomStatus("Currently NumPatrol=" + mPatrols.Count + " NumChasing=" + numChase + " Hero caught=" + mHero.NumTimesCaught); }