Exemple #1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            //INITIALIZE YOUR BASE NOW!
            //This makes sure that the textures and fonts will be loaded in before they're measured.
            base.Initialize();

            //Set up your spritefont and dimensions and stuff.
            titleDimensions = titleScreen.MeasureString("Boy Meets Girl");
            characterDimension = flowerTexture.MeasureString("X");
            statsDimensions = statsFont.MeasureString("X");

            //Set up the game world.
            //You'll notice that the right and bottom margins are adjust to make sure nothing spawns half way on the screen.
            world = new World(20,
                (int)titleDimensions.Y, width - 40 - (int)characterDimension.X,
                height - (int)titleDimensions.Y - 100 - (int)characterDimension.Y, 0, 3);
        }
Exemple #2
0
        /// <summary>
        /// Fun with constructors, eh?
        /// </summary>
        /// <param name="x">xposition of person</param>
        /// <param name="y">yposition of person</param>
        /// <param name="world">Hook back to the current world.</param>
        public Person(int x, int y, World world, bool controlled)
            : base(x, y, Main.colors.Length - 1, "P")
        {
            inventory = new List<int>();

            //Everybody starts with one flower of each color.
            inventory.Add(1); inventory.Add(2); inventory.Add(0);

            knownCausality = new List<Action>();
            peopleOfInterest = new Dictionary<Person, int>();
            this.world = world;
            this.controlled = controlled;

            //Set up the basic knowledge - picking flowers of a certain color will make you happy.
            favoriteColor = Main.random.Next(0, Main.colors.Length - 1);
            flowerInterest = Main.random.Next(0, 10);
            intelligence = 9;
            dissapointment = Main.random.Next(0, 10);

            //Start off knowing how to pick up a flower.
            knownCausality.Add(new Action(this, pickFlower, null, new dynamic[] { this.favoriteColor}, 100, flowerInterest));
        }