Esempio n. 1
0
        //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;
        }
Esempio n. 2
0
        //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);
        }
Esempio n. 3
0
        //Overloaded method to return just basic EnemyClone
        public EnemySubclass spawnEnemy()
        {
            //create our clone
            EnemySubclass EnemyClone = (EnemySubclass)getEnemy(Original);

            return(EnemyClone);
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        //Impportant piece. This is the bit of code that calls the super (aka 'base' in C#)
        //Of the ICloneable to return the cloned object.
        public Enemy CloneCopy()
        {
            EnemySubclass EnemyObject = null;

            try
            {
                EnemyObject = (EnemySubclass)base.MemberwiseClone();
            }
            catch
            {
                Console.Write("We have a problem");
            }



            return(EnemyObject);
        }
Esempio n. 6
0
        /// <summary>
        /// method to add enemy
        /// </summary>
        public void spawnEnemy()
        {
            if (enemiesOnScreen.Count < maxEnemies)
            {
                //spawn enemy
                EnemySubclass enemy = spawner.spawnEnemy(diffContext.getState());
                int[]         Start = enemy.getStartPos();
                //create vector for the enemy's start destination
                Vector2 CurrentEnemyVector = new Vector2(Start[0], Start[1]);
                //create destination for the enemy
                enemy.Destination = createDestination(Start[0], Start[1]);

                //add enemy position to enemies vector list
                enemiesVector.Add(CurrentEnemyVector);
                //add enemy to enemy list
                enemiesOnScreen.Add(enemy);
            }
        }
Esempio n. 7
0
 //constructor
 public SpawnerProto(int WindowX, int WindowY)
 {
     this.WindowX = WindowX;
     this.WindowY = WindowY;
     Original = new EnemySubclass(WindowX,WindowY);
 }
Esempio n. 8
0
 //constructor
 public SpawnerProto(int WindowX, int WindowY)
 {
     this.WindowX = WindowX;
     this.WindowY = WindowY;
     Original     = new EnemySubclass(WindowX, WindowY);
 }