public DifficultyContext(Score score) { //Set the subject for the observer to be the score subject = score; //Set the initial state to Easy diffState = new EasyState(); }
//This is our class for returning our cloned enemy. May be changed in the future //To return a hashmap or dictionairy of a group of cloned classes. public Dictionary<int, EnemySubclass> getClonedEnemy(int count, DifficultyState state) { //Declare our class for cloning Original = new EnemySubclass(WindowX, WindowY); //declare our return dictionairy Dictionary<int, EnemySubclass> returnDict = new Dictionary<int, EnemySubclass>(); //return a filled hash map //of the specified class (filled with 5 clones to start) for(int i = 0; i < count; i++) { //Set the attribs each time we add to the initial area Original.setDifficultyAttribs(state.EnemySpeed,state.EnemyKillWorth,state.EnemyScreenPts); //create our clone EnemySubclass EnemyClone = (EnemySubclass)getEnemy(Original); //add to dictionairy returnDict.Add(i, EnemyClone); } //return dictionairy full of 5 seperate enemies return returnDict; }
//This is our class for returning our cloned enemy. May be changed in the future //To return a hashmap or dictionairy of a group of cloned classes. public Dictionary <int, EnemySubclass> getClonedEnemy(int count, DifficultyState state) { //Declare our class for cloning Original = new EnemySubclass(WindowX, WindowY); //declare our return dictionairy Dictionary <int, EnemySubclass> returnDict = new Dictionary <int, EnemySubclass>(); //return a filled hash map //of the specified class (filled with 5 clones to start) for (int i = 0; i < count; i++) { //Set the attribs each time we add to the initial area Original.setDifficultyAttribs(state.EnemySpeed, state.EnemyKillWorth, state.EnemyScreenPts); //create our clone EnemySubclass EnemyClone = (EnemySubclass)getEnemy(Original); //add to dictionairy returnDict.Add(i, EnemyClone); } //return dictionairy full of 5 seperate enemies return(returnDict); }
public EnemySubclass spawnEnemy(DifficultyState state) { //create our clone EnemySubclass EnemyClone = (EnemySubclass)getEnemy(Original); //Set the attribs each time we add to the initial area EnemyClone.setDifficultyAttribs(state.EnemySpeed, state.EnemyKillWorth, state.EnemyScreenPts); return EnemyClone; }
public EnemySubclass spawnEnemy(DifficultyState state) { //create our clone EnemySubclass EnemyClone = (EnemySubclass)getEnemy(Original); //Set the attribs each time we add to the initial area EnemyClone.setDifficultyAttribs(state.EnemySpeed, state.EnemyKillWorth, state.EnemyScreenPts); return(EnemyClone); }
/// <summary> /// update to be called when the observable (the score) notifies the observer (difficulty context) /// of a change in the score. /// </summary> public override void update() { //check if the thresholds have been reached and change state if they have if (((Score)subject).ScoreVal > hardThreshold) { diffState = new HardState(); } else if (((Score)subject).ScoreVal > mediumThreshold) { diffState = new MediumState(); } else { diffState = new EasyState(); } }
/// <summary> /// update to be called when the observable (the score) notifies the observer (difficulty context) /// of a change in the score. /// </summary> public override void update() { //check if the thresholds have been reached and change state if they have if(((Score)subject).ScoreVal>hardThreshold) { diffState = new HardState(); } else if(((Score)subject).ScoreVal>mediumThreshold) { diffState = new MediumState(); } else { diffState = new EasyState(); } }