コード例 #1
0
        public void Reinitialize()
        {
            if ((level = ScreenManager.SharedManager.GetCurrentGameScreen().level) == null)
                throw new WTFException("We are currently not inside a GameScreen and cannot create an AIManager, or the level has not been initiated yet. Stop trying to get the AIManager before creating the level!");
            if ((map = level.levelMap) == null)
                throw new WTFException("The current map has not been initialized yet. Stop trying to get the AIManager before finishing building the level.");

            //Create the PriorityQueue
            enemiesToPath = new PriorityQueue<int, Enemy>();

            currentPursuit = new HashSet<Enemy>();
            isPursuitActive = false;
        }
コード例 #2
0
        /// <summary>
        /// Constructor for the AIManager class
        /// </summary>
        private AIManager()
        {
            //If an AIManager doesn't exist, create one.
            if (sharedManager == null)
                sharedManager = this;
            //If one does exist, something went so horribly, horribly wrong, that a "Well That Failed" exception may not truly convey the severity of what just happened.
            else
                throw new WTFException("An instance of AIManager already exists. This should never happen. If it does, congrats you just called a private method outside of the class it exists in.");

            //Get our level, map, and graph, otherwise throw exceptions because we're doing something wrong
            if ((level = ScreenManager.SharedManager.GetCurrentGameScreen().level) == null)
                throw new WTFException("We are currently not inside a GameScreen and cannot create an AIManager, or the level has not been initiated yet. Stop trying to get the AIManager before creating the level!");
            if((map = level.levelMap) == null)
                throw new WTFException("The current map has not been initialized yet. Stop trying to get the AIManager before finishing building the level.");

            //Create the PriorityQueue
            enemiesToPath = new PriorityQueue<int, Enemy>();

            currentPursuit = new HashSet<Enemy>();
            isPursuitActive = false;

            rand = new Random();
        }
コード例 #3
0
 // Initializes the level
 public void Initialize()
 {
     level = new Level(levelName);
     kState = Keyboard.GetState();
     previousState = Keyboard.GetState();
 }