コード例 #1
0
        // generate a completely new story
        public IStory generateStory(int numMainCharacters = 1, int numOfTargetCharacters = 1, int numOfAreas = 0)
        {
            // mkae sure there is data to use
            LoadData();
            // pick a plot to use
            IStory newStory = new Story(getPlot());
            Random randomNumber = new Random();

            // create a new random story

            // create main characters
            for (int i = 0; i < numMainCharacters; i++)
            {
               newStory.addMainCharacter(getCharacter()); // get random character
            }
            for (int i = 0; i < numOfTargetCharacters; i++)
            {
                newStory.addEnemyCharacter(getCharacter()); // get random character
            }

            // find how many areas to create
            if(numOfAreas == 0)
            {
                numOfAreas = getRandomNumber(3) + 3;
            }
            // create x amonut of areas
            for (int i = 0; i < numOfAreas; i++)
            {
                newStory.addAreaType(getAreaType()); // create areas
            }

            //  update plot based upon goal

            return newStory;
        }
コード例 #2
0
ファイル: Game.cs プロジェクト: chriswestwood/FYP
 public Game(Story newstory)
 {
     Story = newstory;
     Init();
 }