Exemplo n.º 1
0
    public static SceneObject Create(SceneState _scene)
    {
        SceneObject scene = null;

        switch (_scene)
        {
        case SceneState.StartScreen:
            scene = new StartScreen();
            break;

        case SceneState.Level1:
            scene = new Level1();
            break;

        case SceneState.Level2:
            scene = new Level2();
            break;

        case SceneState.Level3:
            scene = new Level3();
            break;

        case SceneState.Level4:
            scene = new Level4();
            break;

        case SceneState.SummaryScreen:
            scene = new SummaryScreen();
            break;

        default:
            return(null);
        }
        return(scene);
    }
Exemplo n.º 2
0
        public CalculationLevel1(Level1 mutation)
        {
            //לבדוק אם כמו שלב 1
            UnusualGenotypeResult = new Dictionary <int, List <string> >();
            UnusualGenotypeResult.Add(1, new List <string>()
            {
                "WFS", "R558C", "0167I"
            });
            UnusualGenotypeResult.Add(2, new List <string>()
            {
                "CN", "693", "0038U"
            });

            UnusualPink = new Dictionary <int, List <string> >();
            UnusualPink.Add(1, new List <string>()
            {
                "BL", "2281", "0054U"
            });                                                              //1
            UnusualPink.Add(2, new List <string>()
            {
                "POL", "3761INSG", "0225I"
            });
            UnusualPink.Add(3, new List <string>()
            {
                "GAL", "687INSCA", "0228I"
            });

            IfGenotypePosNotStart(mutation);
            WhichMutation(mutation);
        }
Exemplo n.º 3
0
        public void Should_activate_all_upstream_dependencies_when_chain_deep()
        {
            var defaultsOrder = new List <Feature>();

            var level1 = new Level1
            {
                OnDefaults = f => defaultsOrder.Add(f)
            };
            var level2 = new Level2
            {
                OnDefaults = f => defaultsOrder.Add(f)
            };
            var level3 = new Level3
            {
                OnDefaults = f => defaultsOrder.Add(f)
            };

            //the orders matter here to expose a bug
            featureSettings.Add(level3);
            featureSettings.Add(level2);
            featureSettings.Add(level1);

            featureSettings.SetupFeatures(null, null);

            Assert.True(level1.IsActive, "Level1 wasn't activated");
            Assert.True(level2.IsActive, "Level2 wasn't activated");
            Assert.True(level3.IsActive, "Level3 wasn't activated");

            Assert.IsInstanceOf <Level1>(defaultsOrder[0], "Upstream dependencies should be activated first");
            Assert.IsInstanceOf <Level2>(defaultsOrder[1], "Upstream dependencies should be activated first");
            Assert.IsInstanceOf <Level3>(defaultsOrder[2], "Upstream dependencies should be activated first");
        }
        private void btnPlay_Click(object sender, EventArgs e)
        {
            Level1 lv1 = new Level1();

            this.Hide();
            lv1.Show();
        }
Exemplo n.º 5
0
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here

            // Load level
            //Tile.Content = Content;
            lv1   = new Level1(Content);
            lv2   = new Level2(Content);
            level = lv1;

            // Load menu content
            btnPlay.Load(Content.Load <Texture2D>("Menu/start_normal"), new Vector2(280, 150));
            btnQuit.Load(Content.Load <Texture2D>("Menu/quit_normal"), new Vector2(300, 280));
            deadTextTexture   = Content.Load <Texture2D>("Menu/deadText");
            deadTextRectangle = new Rectangle(100, 0, deadTextTexture.Width, deadTextTexture.Height);

            camera = new Camera(GraphicsDevice.Viewport);

            // Load players content
            textureHero = Content.Load <Texture2D>("Players/thief");

            initialzeGameObjects();
        }
Exemplo n.º 6
0
        static void Main(string[] args)
        {
            int x = default(int);

            Console.WriteLine("The default value is " + x);
            Console.WriteLine();

            Form myForm = default(Form);

            Console.WriteLine("Is the default value for Form is null? " + (myForm == null));
            Console.WriteLine();

            //The default vaule for enum is decided by the numeric order. The first value is the default value.
            Level1 l1 = default(Level1);

            Console.WriteLine("The default value is " + l1);
            Console.WriteLine();

            //The default vaule for enum could be changed by giving different values to different levels.
            Level2 l2 = default(Level2);

            Console.WriteLine("The default value is " + l2);
            Console.WriteLine();

            //If the levels in enum does not have a value of "0", there will be a problem.
            Level3 l3 = default(Level3);

            Console.WriteLine("The default value is " + l3);
            Console.WriteLine();
        }
Exemplo n.º 7
0
	// Use this for initialization
	void Start () {
        pancaked = false;
        audioSource = GetComponent<AudioSource>();
        baconpancakes = Resources.Load<AudioClip>("Sounds/pekoni");
        cookingTime = 0.0f;
        level = FindObjectOfType<Level1>();
	}
Exemplo n.º 8
0
        private void UpdateGameStart(GameTime gameTime, KeyboardState keyState, MouseState mouseState, ContentManager content, GraphicsDevice graphicsDevice)
        {
            this.levelOne.Update(gameTime, keyState, mouseState, this.spriteBatch, this.GameState, this.gameFont);

            if (this.levelOne.IsPlayerAlive() && this.levelOne.IsLevelCompleted())
            {
                this.levelOne  = new Level1(content, graphicsDevice);
                this.GameState = GameState.GameWin;
            }
            else if (!this.levelOne.IsPlayerAlive())
            {
                if (this.levelOne.NumberOfLives() <= 0)
                {
                    // Start new game
                    this.levelOne  = new Level1(content, graphicsDevice);
                    this.GameState = GameState.GameOver;
                }
                else
                {
                    // TODO: Lower lives and continue
                    this.levelOne  = new Level1(content, graphicsDevice);
                    this.GameState = GameState.GameOver;
                }
            }

            if (this.levelOne.Pause())
            {
                this.GameState = GameState.PAUSE;
            }
        }
Exemplo n.º 9
0
    void Start()
    {
        CellList.CheckEmpty();

        var levelSource = new Level1();

        Map      = levelSource.CreateMap(Game.Ksids);
        Game.Map = Map;

        foreach (var pair in levelSource.Placeables(PrefabsStore))
        {
            pair.Item1.Instantiate(Map, transform, pair.Item2);
        }

        if (PlaceablesRoots != null)
        {
            foreach (var root in PlaceablesRoots)
            {
                if (root.gameObject.activeInHierarchy)
                {
                    foreach (var p in root.GetComponentsInChildren <Placeable>())
                    {
                        p.PlaceToMap(Map);
                    }
                }
            }
        }

        mapCreated = true;
    }
Exemplo n.º 10
0
        public Game1()
        {
            FileHandler.writeToFile(systemOptions, @"Content\Data\system_variables.xml", new XmlSerializer(typeof(SystemOptions)));
            systemOptions = FileHandler.readFromFile(@"Content\Data\system_variables.xml", new XmlSerializer(typeof(SystemOptions)));

            new GraphicsDeviceManager(this)
            {
                PreferredBackBufferWidth  = systemOptions.resolutionWidth,
                PreferredBackBufferHeight = systemOptions.resolutionHeight,
                IsFullScreen = systemOptions.fullScreen
            };

            Components.Add(new InputHandler(this));
            stateManager = new GameStateManager(this);
            Components.Add(stateManager);

            screenRectangle         = new Rectangle(0, 0, systemOptions.resolutionWidth, systemOptions.resolutionHeight);
            startMenuScreen         = new StartMenuScreen(this, stateManager);
            Level1                  = new Level1(this, stateManager);
            Level2                  = new Level2(this, stateManager);
            characterCreationScreen = new CharacterCreationScreen(this, stateManager);
            pauseScreen             = new PauseScreen(this, stateManager);
            optionsScreen           = new OptionsScreen(this, stateManager);
            loadGameScreen          = new LoadGameScreen(this, stateManager);
            gameLoseScreen          = new GameLoseScreen(this, stateManager);
            lobbyScreen             = new LobbyScreen(this, stateManager);
            highScoreScreen         = new HighScoresScreen(this, stateManager);

            stateManager.ChangeState(startMenuScreen);
        }
Exemplo n.º 11
0
 /// <summary>
 /// Restart level
 /// </summary>
 /// <param name="spawnPosHero">Start positie van de hero</param>
 /// <param name="currentLevel">Huidige level</param>
 /// <param name="collisionObjects">Lijst met alle objecten die kunnen colliden</param>
 /// <param name="hero">Hero object dat we besturen</param>
 private void RestartLevel(Vector2 spawnPosHero, ref Level currentLevel, List <ICollide> collisionObjects, Hero hero)
 {
     collisionObjects.Clear();
     currentLevel = new Level1(content);
     currentLevel.CreateWorld(content, collisionObjects);
     SetHeroSpawnLocation(spawnPosHero, hero);
 }
Exemplo n.º 12
0
            public override string ToString()
            {
                var text = string.Empty;

                if (Level1 <= 0)
                {
                    return(text);
                }

                text = Level1.ToString();
                if (Level2 <= 0)
                {
                    return(text);
                }

                text = $"{Level1}.{Level2}";
                if (Level3 <= 0)
                {
                    return(text);
                }

                text = $"{Level1}.{Level2}.{Level3}";
                if (Level4 <= 0)
                {
                    return(text);
                }

                text = $"{Level1}.{Level2}.{Level3}.{Level4}";
                if (Level5 > 0)
                {
                    text = $"{Level1}.{Level2}.{Level3}.{Level4}.{Level5}";
                }
                return(text);
            }
Exemplo n.º 13
0
        public void ShowEnglishTranslation(Level1 Lvl1)
        {
            string chosenRandomWord = new Level1().GenerateRandomWord(Lvl1.RussianWord);

            ViewData["GenerateRandomWord"] = chosenRandomWord;
            ViewData["EnglishTranslation"] = Lvl1.EnglishWord[Lvl1.GetRussianIndex(chosenRandomWord)];
        }
Exemplo n.º 14
0
        public static void Init()
        {
            Level1.Init();
            AreaInfo.HALinfo.WriteAreaPrefix("Hardware setup under way...");
            PCISetup();
            DetectHyperVisor();
            GraphicsHardwareSetup();

            /* These tests are only to be uncommented if testing
             *             on a pre-setup virtual machine or on real hardware */

            // Tests the floppy controller if a disk is inserted:
            //FDD_Test();

            // Tests the CD Drive if a disk is inserted:


            //ATAPI_Test();


            //AreaInfo.HALDevInfo.WriteDevicePrefix("COM", "Initializing serial communications stack...");
            //HAL.COM1 = new Drivers.SerialPort1();
            //HAL.COM2 = new Drivers.SerialPort2();
            //HAL.COM2.Initialize();
            //AreaInfo.HALDevInfo.WriteDevicePrefix("IDE", "Initializing IDE driver...");
            //AreaInfo.HALDevInfo.WriteDevicePrefix("AHCI", "Initializing AHCI driver...");
            //AreaInfo.HALDevInfo.WriteDevicePrefix("PS2", "Initializing PS2 controller...");
        }
Exemplo n.º 15
0
        public void Test()
        {
            Level1  L1  = new Level1();
            Level2  L2  = new Level2();
            Level3  L3  = new Level3();
            Level4A L4A = new Level4A();
            Level4B L4B = new Level4B();

            Console.WriteLine("TEST APPLICATION");

            Console.WriteLine("\nTESTING Level1");
            L1.Method1();

            Console.WriteLine("\nTESTING Level2");
            L2.Method1();
            L2.Method2();

            Console.WriteLine("\nTESTING Level3");
            L3.Method1();
            L3.Method2();
            L3.Method3();

            Console.WriteLine("\nTESTING Level4A");
            L4A.Method1();
            L4A.Method2();
            L4A.Method3();

            Console.WriteLine("\nTESTING Level4B");
            L4B.Method1();
            L4B.Method2();
            L4B.Method3();

            Pause();
        }
Exemplo n.º 16
0
        public static void WhichMutation(Level1 mutation)
        {
            int index = 1;

            if (mutation.DyDis.Equals(UnusualGenotypeResult[1][0]) && mutation.DyMut.Equals(UnusualGenotypeResult[1][1]) && mutation.MutID.Equals(UnusualGenotypeResult[1][2]))
            {
                index = mutation.GenotypeAlt.Split(',').ToList().IndexOf("T") + 1;
                mutation.ColorDyName = ColorMutation.Yellow.ToString();
            }
            else if (mutation.DyDis.Equals(UnusualGenotypeResult[2][0]) && mutation.DyMut.Equals(UnusualGenotypeResult[2][1]) && mutation.MutID.Equals(UnusualGenotypeResult[2][2]))
            {
                index = mutation.GenotypeAlt.Split(',').ToList().IndexOf("A") + 1;
                mutation.ColorDyName = ColorMutation.Yellow.ToString();
            }
            else if (mutation.GenotypeAlt.IndexOf(',') > -1)
            {
                index = mutation.GenotypeAlt.Split(',').ToList().IndexOf(mutation.Alt) + 1;
            }
            if (mutation.DyDis.Equals(UnusualPink[1][0]) && mutation.DyMut.Equals(UnusualPink[1][1]) && mutation.MutID.Equals(UnusualPink[1][2]) ||
                mutation.DyDis.Equals(UnusualPink[2][0]) && mutation.DyMut.Equals(UnusualPink[2][1]) && mutation.MutID.Equals(UnusualPink[2][2]) ||
                mutation.DyDis.Equals(UnusualPink[3][0]) && mutation.DyMut.Equals(UnusualPink[3][1]) && mutation.MutID.Equals(UnusualPink[3][2]))
            {
                mutation.ColorDyName = ColorMutation.Pink.ToString();
            }

            SetColorInListPerson(mutation.ListPerson, index);
        }
Exemplo n.º 17
0
        private void PlayButtonLW_Click(object sender, RoutedEventArgs e)
        {
            Level1 l1 = new Level1();

            l1.Show();
            this.Close();
        }
Exemplo n.º 18
0
        public void CloneClassWorks()
        {
            var source = new Level1();
            for (int i = 0; i < 3; i++)
            {
                var l2 = new Level2();
                for (int j = 0; j < 5; j++)
                {
                    l2.Level3s.Add(new Level3 { Value = j });
                }

                source.Level2s.Add(l2);
            }

            var dest = ReflectionClone.DeepCopy(source);

            Assert.AreEqual(source.Name, dest.Name);
            Assert.AreEqual(source.Num, dest.Num);

            for (int i = 0; i < source.Level2s.Count; i++)
            {
                Assert.AreEqual(source.Level2s[i].SomeField, dest.Level2s[i].SomeField);
                for (int j = 0; j < source.Level2s[i].Level3s.Count; j++)
                {
                    Assert.AreEqual(source.Level2s[i].Level3s[j].Value, dest.Level2s[i].Level3s[j].Value);
                }
            }
        }
Exemplo n.º 19
0
        public void HandleCollision(CollisionDetector.Collision collision, Level1 level)
        {
            PlayerContext player = null;

            if (collision.entity1 is PlayerContext)
            {
                player = (PlayerContext)collision.entity1;
            }
            else if (collision.entity2 is PlayerContext)
            {
                player = (PlayerContext)collision.entity2;
            }


            CollisionDetector.CollisionSide side = collision.GetSide();

            if (collision.entity2 is GreenKoopaSprite || collision.entity2 is RedKoopaSprite || collision.entity2 is RedGoombaSprite)
            {
                if (side == CollisionDetector.CollisionSide.Bottom)
                {
                    side = CollisionDetector.CollisionSide.Top;
                    level.Remove(collision.entity2);
                    //make this damage them instead of remove
                }
            }
            else if (side == CollisionDetector.CollisionSide.Top)
            {
                level.Remove(collision.entity1);
            }
        }
Exemplo n.º 20
0
        /// <summary>
        /// Start the task.
        /// </summary>
        public void Start()
        {
            if (State == TaskStateType.Dormant)
            {
                // Create a Level1 object
                level1 = new Level1(Instrument);

                // Wire up the event handler for server response
                level1.PublicationResponse += level1_PublicationResponse;

                // Request the appropriate price
                string error;
                if (Price == PriceWatchType.Bid)
                {
                    level1.RequestProperty("BidPrice", out error);
                }
                else if (Price == PriceWatchType.Ask)
                {
                    level1.RequestProperty("AskPrice", out error);
                }

                // Subscribe
                State = TaskStateType.Live;
                level1.Subscribe();
            }
        }
Exemplo n.º 21
0
 public AllLevels(ContentManager content)
 {
     startScherm = new Startscherm(content);
     eindScherm  = new Eindscherm(content);
     level1      = new Level1(content);
     level2      = new Level2(content);
     huidigLevel = startScherm;  //dient aangepast te worden naar startscherm
 }
Exemplo n.º 22
0
    // Use this for initialization
    void Start()
    {
        this.gm         = GameObject.Find("GM").GetComponent <GameManager> ();
        this.audioFiles = GameObject.Find("GM").GetComponent <AudioFilesLevel1> ();
        this.level1     = GameObject.Find("GM").GetComponent <Level1> ();

        didTouchWallBehindCollider = false;
    }
Exemplo n.º 23
0
 private void setLevelStory1()
 {
     levelStory1     = new Level1(names, dialogs, playerName);
     names           = levelStory1.getNames();
     dialogs         = levelStory1.getDialogs();
     backdrop.sprite = (Sprite)Resources.Load("Tutorial/level1", typeof(Sprite));
     newStory        = "PlayLevel1";
 }
		public void DeepClone_NestedWithMultipleVisibility(TypeModel model)
		{
			var obj = new Level1("1", 2, "3", "4", "5", new DateTime(2012, 05, 04), new ItemClass() { Message = "7" }, 8, 9, 10);

			var clone = (Level1)model.DeepClone(obj);

			Assert.AreEqual(obj.ToString(), clone.ToString());
		}
Exemplo n.º 25
0
        public void IfGenotypePosNotStart(Level1 mutation)
        {
            if (mutation.GenotypePos != mutation.Start)

            {
                throw new Exception(mutation.Chrom + " " + mutation.Start + " " + mutation.End + " - in mutation START not worth to Genotype_POS .");
            }
        }
        /// <summary>
        /// Build SubjectBrowseOutput object from collection of Categories.
        /// </summary>
        /// <remarks>
        /// The FetchCategories stored procedure returns Category results in a specific order, e.g.
        /// Level 1:    .A - Art
        /// Level 2:        .A.1 - Animation / Multimedia Software
        /// Level 3:            CC.31 - Animation Software (Use)
        /// Level 3:            CC.3111 - 3d Studio (Animation Software)
        /// Level 3:            CC.3122 - Flash (Animation Software)
        /// Level 2:        .A.10 - Graphics Software
        /// Level 3:            CC.34 - Drawing / Painting Software (Use)
        /// Level 3:            CC.34 - Graphics Software (Use)
        /// Level 1:    .ACE - Adult and Continuing Education
        /// Level 2:        .ACE.2 - Job Preparation
        /// Level 3:            HC.1 - Career Planning
        /// ... etc.
        /// This code expects the results to be in this sequence.
        /// </remarks>
        /// <param name="categories">Categories collection.</param>
        /// <returns>Populated SubjectBrowseOutput object.</returns>
        private static SubjectBrowseOutput BuildSubjectBrowseOutput(List <Category> categories)
        {
            SubjectBrowseOutput subjectBrowseOutput = new SubjectBrowseOutput();
            List <Level1>       level1s             = new List <Level1>();
            List <Level2>       level2s             = new List <Level2>();
            List <CategoryInfo> level3s             = new List <CategoryInfo>();

            Level1       currentLevel1 = null;
            Level2       currentLevel2 = null;
            CategoryInfo currentLevel3;

            foreach (Category category in categories)
            {
                switch (category.Level)
                {
                case 1:
                    currentLevel1 = BuildLevel1(category);
                    level1s.Add(currentLevel1);

                    // clear the level 2's so we don't have the
                    // previous level 1 level 2's in there
                    level2s.Clear();
                    break;

                case 2:
                    currentLevel2 = BuildLevel2(category);
                    if (currentLevel1.Level2 != null)
                    {
                        level2s = currentLevel1.Level2.ToList();
                    }
                    level2s.Add(currentLevel2);
                    currentLevel1.Level2 = level2s.ToArray();

                    // clear the level 3's so we don't have the
                    // previous level 2 level 3's in there
                    level3s.Clear();
                    break;

                case 3:
                    currentLevel3 = BuildCategoryInfo(category);
                    if (currentLevel2.Level3 != null)
                    {
                        level3s = currentLevel2.Level3.ToList();
                    }
                    level3s.Add(currentLevel3);
                    currentLevel2.Level3 = level3s.ToArray();
                    break;

                default:
                    break;
                }
            }

            subjectBrowseOutput.Level1 = level1s.ToArray();

            return(subjectBrowseOutput);
        }
Exemplo n.º 27
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()
        {
            // TODO: Add your initialization logic here
            consoleManager = new ConsoleManager(this);
            Components.Add(consoleManager);

            base.Initialize();
            Level1 firstLevel = new Level1();
        }
        /// <summary>
        /// Build Level1 object from Category data.
        /// </summary>
        /// <param name="category">Category data to use.</param>
        /// <returns>Populated Level1 object.</returns>
        private static Level1 BuildLevel1(Category category)
        {
            Level1 level1 = new Level1();

            level1.LDCS         = BuildLdcsInfoType(category);
            level1.CourseCounts = category.CourseCount.ToString();

            return(level1);
        }
Exemplo n.º 29
0
        public void SettingValueToBranch_ChangesTheUnderlyingProperty()
        {
            var level1 = new Level1();

            var branch = new ObservablePropertyBranch(level1, new PropertyPath("Level2.Level3.Property"));

            branch.Value = 3;
            Assert.Equal(3, level1.Level2.Level3.Property);
        }
Exemplo n.º 30
0
 public bool Equals(Spatial target)
 {
     return(TessellationSchema?.ToLower() == target.TessellationSchema?.ToLower() &&
            Level1?.ToLower() == target.Level1?.ToLower() &&
            Level2?.ToLower() == target.Level2?.ToLower() &&
            Level3?.ToLower() == target.Level3?.ToLower() &&
            Level4?.ToLower() == target.Level4?.ToLower() &&
            CellsPerObject == target.CellsPerObject);
 }
Exemplo n.º 31
0
        protected override void LoadContent()
        {
            // level
            Level = new Level1();
            Level.Init();
            TTFactory.CreateScriptlet(Level);

            base.LoadContent();
        }
        public async Task <ActionResult <IEnumerable <Level1> > > GetLevel1()
        {
            Level1 level1 = new Level1();

            level1.Name = "Test";
            _context.Level1.Add(level1);
            await _context.SaveChangesAsync();

            return(await _context.Level1.ToListAsync());
        }
Exemplo n.º 33
0
        public void SettingValueToUnderlyingProperty_ChangesTheValueInBranch()
        {
            var level1 = new Level1();

            level1.Level2.Level3.Property = 3;

            var branch = new ObservablePropertyBranch(level1, new PropertyPath("Level2.Level3.Property"));

            Assert.Equal(3, branch.Value);
        }
Exemplo n.º 34
0
    public static Level1 LoadLevel(Hashtable o, int tilesX, int tilesY)
    {
        var level = new Level1 {
            Name = (string)o["name"],
            Width = Convert.ToInt32(o["width"]),
            Height = Convert.ToInt32(o["height"])
        };

        level.Grid = LoadGrid(o, level);

        return level;
    }
Exemplo n.º 35
0
    public LevelManager()
    {
        _level1 = new Level1("ship1");
        _level1.SetPosition(0.0f, 0.0f);
        _level1.SetAnchor(0.0f, 0.0f);

        //_levelContainer.AddChild(_level1);
        AddChild(_level1);

        addDoors();
        scrambleDoors();
    }
        public void Insert_ItemWithSimpleArrayValues_ValuesAreStoredInDb()
        {
            var item = new Level1();
            item.Integers = new[] { 1, 1, 2 };
            item.Strings = new[] { "A", "A", "B" };
            item.Dates = new[] { new DateTime(2010, 1, 2, 3, 4, 5, 6), new DateTime(2010, 1, 2, 3, 4, 5, 6), new DateTime(2010, 1, 2, 3, 4, 5, 7) };
            item.Bytes = BitConverter.GetBytes(42);
            item.Level2Items = new[]
            {
                new Level2 { StringValue= "StringA" },
                new Level2 { StringValue = "StringA" },
                new Level2
                {
                    StringValue = "StringB",
                    IntegerValue = 1,
                    Strings = new []{"Strings1", "Strings2"},
                    Integers = new []{0,1,2,4,8},
                    Level3Items = new []
                    {
                        new Level3 { Integers = new []{1,3} },
                        new Level3 { Integers = new []{2,4} }
                    }
                }
            };

            using (var unitOfWork = Database.CreateUnitOfWork())
            {
                unitOfWork.Insert(item);
                unitOfWork.Commit();
            }

            var level1IntegersHash = SisoDbEnvironment.MemberNameGenerator.Generate("Integers");
            var level1StringsHash = SisoDbEnvironment.MemberNameGenerator.Generate("Strings");
            var level1DatesHash = SisoDbEnvironment.MemberNameGenerator.Generate("Dates");
            var level1BytesHash = SisoDbEnvironment.MemberNameGenerator.Generate("Bytes");
            var level2StringValueMemberHash = SisoDbEnvironment.MemberNameGenerator.Generate("Level2Items.StringValue");
            var level2IntegerValueMemberHash = SisoDbEnvironment.MemberNameGenerator.Generate("Level2Items.IntegerValue");
            var level2StringsMemberHash = SisoDbEnvironment.MemberNameGenerator.Generate("Level2Items.Strings");
            var level2IntegersMemberHash = SisoDbEnvironment.MemberNameGenerator.Generate("Level2Items.Integers");
            var level3IntegersMemberHash = SisoDbEnvironment.MemberNameGenerator.Generate("Level2Items.Level3Items.Integers");
            var indexesTable = DbHelper.GetTableBySql("select * from dbo.Level1Indexes");
            Assert.AreEqual(1, indexesTable.Rows.Count);
            Assert.IsFalse(indexesTable.Columns.Contains(level1BytesHash));
            Assert.AreEqual("<$1$><$2$>", indexesTable.Rows[0][level1IntegersHash]);
            Assert.AreEqual("<$A$><$B$>", indexesTable.Rows[0][level1StringsHash]);
            Assert.AreEqual("<$2010-01-02 03:04:05.006$><$2010-01-02 03:04:05.007$>", indexesTable.Rows[0][level1DatesHash]);
            Assert.AreEqual("<$StringA$><$StringB$>", indexesTable.Rows[0][level2StringValueMemberHash]);
            Assert.AreEqual("<$0$><$1$>", indexesTable.Rows[0][level2IntegerValueMemberHash]);
            Assert.AreEqual("<$$><$Strings1$><$Strings2$>", indexesTable.Rows[0][level2StringsMemberHash]);
            Assert.AreEqual("<$$><$0$><$1$><$2$><$4$><$8$>", indexesTable.Rows[0][level2IntegersMemberHash]);
            Assert.AreEqual("<$$><$1$><$3$><$2$><$4$>", indexesTable.Rows[0][level3IntegersMemberHash]);
        }
Exemplo n.º 37
0
    public void OnEnable()
    {
        _cm = GetComponent<CreateMesh>();

        var json = Resources.Load("level1", typeof(TextAsset)).ToString();
        _level = Level1.LoadLevel((Hashtable)JSON.JsonDecode(json), _cm.NumTilesX, _cm.NumTilesY);

        _cm.CreatePlane(_level.Width, _level.Height);

        for (var y = 0; y < _level.Height; y++) {
            for (var x = 0; x < _level.Width; x++) {
                _cm.UpdateGrid(new Vector2(x, y), _level.Grid[x, y]);
            }
        }
    }
        public void ReturnCorrectObject()
        {

            var scope = new ProcessingScope();
            var o1 = new Level1();
            var o2 = new Level1();
            var o2_1 = new Level2();

            scope.Set(o1);
            Assert.AreSame(o1, scope.Current<Level1>());

            scope.Set(o2);
            Assert.AreSame(o2, scope.Current<Level1>());

            var childScope = scope.CreateChildScope(new DummyMapper()).Set(o2_1);
            Assert.AreSame(o2_1, childScope.Current<Level2>());
            Assert.AreSame(o2, childScope.Current<Level1>());
        }
Exemplo n.º 39
0
    private static Vector2[,] LoadGrid(IDictionary o, Level1 level)
    {
        var grid = new Vector2[level.Width, level.Height];
        var theGrid = (ArrayList)o["grid"];

        Debug.Log("w/h " + level.Width + "," + level.Height);

        for (var y = 0; y < level.Height; y++) {
            var columns = (ArrayList)theGrid[y];
            for (var x = 0; x < level.Width; x++)
            {
                var index = (ArrayList)columns[x];
                var tx = Convert.ToInt32(index[0]);
                var ty = Convert.ToInt32(index[1]);
                grid[x, y] = new Vector2(tx, ty);
                Debug.Log(grid[x, y].x + "," + grid[x, y].y);
            }
        }

        return grid;
    }
Exemplo n.º 40
0
 private void StartState()
 {
     switch (_state)
     {
         case "MainMenu":
             _menu = new MainMenu(this);
             AddChild(_menu);
             break;
         case "HighScores":
             _scores = new HighScores(this);
             AddChild(_scores);
             break;
         case "Credits":
             _credits = new Credits(this);
             AddChild(_credits);
             break;
         case "Level1":
             _level1 = new Level1(this);
             AddChild(_level1);
             break;
         case "Level2":
             _level2 = new Level2(this, 5); //Would have _lives instead of 5 if pickups were implemented
             AddChild(_level2);
             break;
         case "Level3":
             _level3 = new Level3(this, 5); //Idem ditto
             AddChild(_level3);
             break;
         case "WonGame":
             _wonGame = new WonGame(this);
             AddChild(_wonGame);
             break;
         case "Exit":
             Environment.Exit(0);
             break;
         default:
             throw new Exception("You tried to load a non-existant state");
     }
 }
Exemplo n.º 41
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            // Set the sharing mode of the graphics device to turn on XNA rendering
            SharedGraphicsDeviceManager.Current.GraphicsDevice.SetSharingMode(true);

            //MainPage.myGame.GameManager.SinglePlayerTools.StartPractice(null);
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(SharedGraphicsDeviceManager.Current.GraphicsDevice);

            Config.timeDropChance = 200;

            Config.shieldDropChance = 8 + (int)Math.Round(((float)8 / 100) * Config.PowerupDropChance);

            Config.projectileDropChance = 38 + (int)Math.Round(((float)38 / 100) * Config.PowerupDropChance);
            Config.missileDropChance = 68 + (int)Math.Round(((float)68 / 100) * Config.PowerupDropChance);
            Config.firerateDropChance = 128 + (int)Math.Round(((float)128 / 100) * Config.PowerupDropChance);
            Config.laserDropChance = 188 + (int)Math.Round(((float)158 / 100) * Config.PowerupDropChance);

            //Config.projectileDropChance = 68 + (int)Math.Round(((float)38 / 100) * Config.PowerupDropChance);
            //Config.missileDropChance = 98 + (int)Math.Round(((float)68 / 100) * Config.PowerupDropChance);
            //Config.firerateDropChance = 158 + (int)Math.Round(((float)128 / 100) * Config.PowerupDropChance);
            //Config.laserDropChance = 218 + (int)Math.Round(((float)158 / 100) * Config.PowerupDropChance);

            Config.CoinsCollected = 0;
            multiplierTracker = 2;
            Config.KillStreak = 0;
            Config.KillStreakBuildpoints = 0;
            Config.Score = 0;
            Config.Multi = 1;
            Config.AIScore = 0;
            Config.AIMulti = 1;
            Config.EmemiesKilled = 0;
            Config.CoinsCollected = 0;
            Config.EnemySpeed = 6;
            playerLives = Config.PlayerLives;

            playerAbilityUses = Config.PlayerSpecialAbilityUses;
            if (Config.boostPrepared > 0)
            {
                playerAbilityUses++;
                Config.boostPrepared--;
            }

            if (Config.boostShieldsUp > 0)
            {
                boostShieldsUpActive = true;
            }

            if (Config.boostLastStand > 0)
            {
                boostLastStandActive = true;
            }

            KillStreakBarBackground = new Bar(200, 20, new Color(0, 0, 0, 128));
            KillStreakBarBackground.Position = new Vector2(300, 455);
            KillStreakBarBackground.Percent = 1f;

            KillStreakBar = new Bar(200, 20, new Color(0, 128, 0, 128));
            KillStreakBar.Position = new Vector2(300, 455);


            laserCharges = "0";

            thumbstick = contentManager.Load<Texture2D>("thumbstick2");

            //thumbstick = content.Load<Texture2D>("thumbstick2");
            //introExtermination = content.Load<Texture2D>(@"Gamescreens\AlterEgo");
            phaserTexture = contentManager.Load<Texture2D>(@"phaser");

            levelTimeColorInterval = new Timer();
            levelTimeColorInterval.Fire += new NotifyHandler(levelTimeColorInterval_Fire);

            switch (Config.Level)
            {
                case LevelSelect.One:
                    stars = contentManager.Load<Texture2D>(@"Background\Stars3");
                    backgroundClouds2 = contentManager.Load<Texture2D>(@"Background\BackgroundClouds2");
                    //musicLevel1 = contentManager.Load<Song>(@"Music\throughthestars");
                    //musicLevel1 = contentManager.Load<Song>(@"Music\throughthestars");
                    levelTime = 300;
                    (Application.Current as App).TryPlayBackgroundMusic(1);
                    break;
                case LevelSelect.Two:
                    stars = contentManager.Load<Texture2D>(@"Background\Stars2");
                    //backgroundClouds2 = content.Load<Texture2D>(@"Background\cloudlayer2");
                    backgroundClouds2 = contentManager.Load<Texture2D>(@"Background\BackgroundClouds2");
                    //musicLevel1 = contentManager.Load<Song>(@"Music\galacticstruggle");
                    levelTime = 300;
                    levelTimeColor = Color.Green;
                    (Application.Current as App).TryPlayBackgroundMusic(2);
                    break;
                case LevelSelect.Three:
                    //stars = content.Load<Texture2D>(@"Background\stars");
                    //backgroundClouds2 = content.Load<Texture2D>(@"Background\nova2");
                    //backgroundClouds1 = content.Load<Texture2D>(@"Background\stars4");
                    stars = contentManager.Load<Texture2D>(@"Background\Stars8");
                    backgroundClouds2 = contentManager.Load<Texture2D>(@"Background\stars7");
                    backgroundClouds1 = contentManager.Load<Texture2D>(@"Background\cloudlayer2");
                    //musicLevel1 = contentManager.Load<Song>(@"Music\survival");
                    levelTime = 300;
                    playerLives = 3;
                    respawnTime = TimeSpan.FromSeconds(5);
                    (Application.Current as App).TryPlayBackgroundMusic(3);
                    break;
                case LevelSelect.Four:
                    stars = contentManager.Load<Texture2D>(@"Background\stars");
                    backgroundClouds2 = contentManager.Load<Texture2D>(@"Background\stars10");
                    backgroundClouds1 = contentManager.Load<Texture2D>(@"Background\stars7");
                    //musicLevel1 = contentManager.Load<Song>(@"Music\holo");
                    levelTime = 300;
                    playerLives = 3;
                    respawnTime = TimeSpan.FromSeconds(5);
                    (Application.Current as App).TryPlayBackgroundMusic(4);
                    break;
                case LevelSelect.Five:
                    //stars = content.Load<Texture2D>(@"Background\Stars5");
                    //backgroundClouds2 = content.Load<Texture2D>(@"Background\Stars4");
                    //backgroundClouds1 = content.Load<Texture2D>(@"Background\cloudlayer2");
                    stars = contentManager.Load<Texture2D>(@"Background\Stars5");
                    backgroundClouds2 = contentManager.Load<Texture2D>(@"Background\Stars4");
                    backgroundClouds1 = contentManager.Load<Texture2D>(@"Background\stars7");
                    //musicLevel1 = contentManager.Load<Song>(@"Music\giantrobotsfighting");
                    levelTime = 60;
                    (Application.Current as App).TryPlayBackgroundMusic(5);
                    break;
                case LevelSelect.Six:
                    stars = contentManager.Load<Texture2D>(@"Background\stars");
                    backgroundClouds2 = contentManager.Load<Texture2D>(@"Background\nova2");
                    backgroundClouds1 = contentManager.Load<Texture2D>(@"Background\stars4");
                    //musicLevel1 = contentManager.Load<Song>(@"Music\AgainstTheOdds");
                    levelTime = 300;
                    (Application.Current as App).TryPlayBackgroundMusic(6);
                    break;
                case LevelSelect.Practise:
                    //UIdescription = content.Load<Texture2D>(@"Gamescreens\UIdescription");
                    stars = contentManager.Load<Texture2D>(@"Background\Stars3");
                    backgroundClouds2 = contentManager.Load<Texture2D>(@"Background\BackgroundClouds2");
                    //musicLevel1 = contentManager.Load<Song>(@"Music\throughthestars");
                    levelTime = 300;
                    (Application.Current as App).TryPlayBackgroundMusic(1);
                    break;
            }

            font = contentManager.Load<SpriteFont>(@"Fonts\Tahoma14");
            floatingScoreFont = contentManager.Load<SpriteFont>(@"Fonts\Andy22");
            floatingPowerupFont = contentManager.Load<SpriteFont>(@"Fonts\Andy22");
            floatingMultiplierMsgFont = contentManager.Load<SpriteFont>(@"Fonts\Andy48");
            andy14 = contentManager.Load<SpriteFont>(@"Fonts\Andy14");
            andy18 = contentManager.Load<SpriteFont>(@"Fonts\Andy18");
            andy22 = contentManager.Load<SpriteFont>(@"Fonts\Andy22");
            andy48 = contentManager.Load<SpriteFont>(@"Fonts\Andy48");

            SpriteSheet.LoadContent(contentManager, SharedGraphicsDeviceManager.Current.GraphicsDevice);

            cam = new Camera2D(SharedGraphicsDeviceManager.Current.GraphicsDevice, worldBounds.Right, worldBounds.Bottom);

            //GameStateManagementGame.Instance.soundManager.LoadSound("Shot3", @"SoundEffects\Shot3");
            //GameStateManagementGame.Instance.soundManager.LoadSound("coin", @"SoundEffects\coin");
            //GameStateManagementGame.Instance.soundManager.LoadSound("ShipSpawn", @"SoundEffects\ShipSpawn");
            //GameStateManagementGame.Instance.soundManager.LoadSound("ShipExplode", @"SoundEffects\ShipExplode");

            Player.SpawnShip();

            //Player = new Player();
            switch (Config.Level)
            {
                case LevelSelect.One:
                    level1 = new Level1();
                    break;
                case LevelSelect.Two:
                    level2 = new Level2();
                    break;
                case LevelSelect.Three:
                    level3 = new Level3();
                    Player.SpawnEnemyShip();
                    break;
                case LevelSelect.Four:
                    level4 = new Level4();
                    Player.SpawnEnemyShip();
                    break;
                case LevelSelect.Five:
                    level5 = new Level5();
                    break;
                case LevelSelect.Six:
                    level6 = new Level6();
                    break;
                case LevelSelect.Practise:
                    practise = new Practise();
                    break;
            }
            //bud = new BuddyMissile(Config.BuddySpriteSheet);
            //bud.Position = Player.Ship.Position;

            //if (Player.Ship == null)
            //{
            //    Player.SpawnShip();
            //}
            //ParticleEngineEffect = new ParticleEffects(graphicsDeviceManager, cam, GraphicsDevice);
            ParticleEffects.Initialize(SharedGraphicsDeviceManager.Current, SharedGraphicsDeviceManager.Current.GraphicsDevice);
            //ParticleEngineEffect.LoadContent(content);
            ParticleEffects.LoadContent(contentManager);

            FloatingScoreList = new SpriteFontFloatScores();

            //FloatingScore = new SpriteFontFloatScore();

            //FloatingScore.Color = Color.Green;
            //FloatingScore.Score = "+";
            //FloatingScore.SpriteFont = floatingScoreFont;
            //FloatingScore.LifeSpan = 1000f;
            //FloatingScore.SizeTime = 500f;
            //FloatingScore.ShadowEffect = false;
            //FloatingScore.EndPosition = new Vector2(20, -20);

            FloatingPowerupText = new SpriteFontFloatScore();

            FloatingPowerupText.Color = Color.White;
            FloatingPowerupText.Score = "+";
            FloatingPowerupText.SpriteFont = floatingPowerupFont;
            FloatingPowerupText.LifeSpan = 1000f;
            FloatingPowerupText.SizeTime = 500f;
            FloatingPowerupText.ShadowEffect = false;
            FloatingPowerupText.EndPosition = new Vector2(20, -20);
            FloatingPowerupText.LayerDepth = 0.7f;

            FloatingMultiplierText = new SpriteFontFloatScore();

            FloatingMultiplierText.Color = Color.Green;
            FloatingMultiplierText.Score = "Multiplyer";
            FloatingMultiplierText.SpriteFont = floatingMultiplierMsgFont;
            FloatingMultiplierText.LifeSpan = 1000f;
            FloatingMultiplierText.SizeTime = 500f;
            FloatingMultiplierText.ShadowEffect = true;
            FloatingMultiplierText.EndPosition = Vector2.Zero;
            FloatingPowerupText.LayerDepth = 1.0f;

            //if (queueBullet.queue.Count < 1)
            //{
            //    for (int i = 0; i < 100; i++)
            //    {

            //        queueBullet.queue.Enqueue(new queueBullet(Config.BulletSheetEnergyPurple));
            //    }
            //}
            //if (Config.MusicOn && MediaPlayer.GameHasControl)
            //    GameStateManagementGame.Instance.musicManager.Play(musicLevel1);

            //GameStateManagementGame.Instance.musicManager.Stop();

            Bar.Texture = contentManager.Load<Texture2D>("Textures/Fill22");

            multiHud = new Sprite(Config.MultiHud);
            multiHud.Scale = 0.5f;
            multiHud.Color = Color.Green;
            multi = (Math.Round(Config.Multi, 2)).ToString() + "x";

            healthHud = new Sprite(Config.MultiHud);
            healthHud.Scale = 0.3f;
            healthHud.Color = Color.Red;

            shieldHud = new Sprite(Config.MultiHud);
            shieldHud.Scale = 0.5f;
            shieldHud.Color = Color.RoyalBlue;

            AImultiHud = new Sprite(Config.MultiHud);
            AImultiHud.Scale = 0.5f;
            AImultiHud.Color = Color.Green;
            AImulti = (Math.Round(Config.AIMulti, 2)).ToString() + "x";

            AIHealthHud = new Sprite(Config.MultiHud);
            AIHealthHud.Scale = 0.3f;
            AIHealthHud.Color = Color.Red;

            AIShieldHud = new Sprite(Config.MultiHud);
            AIShieldHud.Scale = 0.5f;
            AIShieldHud.Color = Color.RoyalBlue;



            GC.Collect();


            // once the load has finished, we use ResetElapsedTime to tell the game's
            // timing mechanism that we have just finished a very long frame, and that
            // it should not try to catch up.
            //ScreenManager.Game.ResetElapsedTime();

            // Start the timer
            timer.Start();

            if (Config.ControlOption == 3)
                AccelerometerHelper.Instance.Active = true;

            PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Disabled;

            base.OnNavigatedTo(e);
        }
Exemplo n.º 42
0
        protected override void OnNavigatedFrom(NavigationEventArgs e)
        {
            // Stop the timer
            timer.Stop();

            // Set the sharing mode of the graphics device to turn off XNA rendering
            SharedGraphicsDeviceManager.Current.GraphicsDevice.SetSharingMode(false);

            //for (int i = 0; i < 100; i++)
            //{
            //    queueBullet.queue.Clear();
            //}

            //if (Guide.IsTrialMode)
            //{
            //    if (Config.Coins > 5000)
            //        Config.Coins = 5000;
            //}
            //else
            //{
                //if (Config.Coins > 10000)
                //    Config.Coins = 10000;
            //}

            foreach (Node node in Node.Nodes)
            {
                node.Remove();
            }

            //GameStateManagementGame.Instance.soundManager.UnloadContent();

            level1 = null;
            level2 = null;
            level3 = null;
            level4 = null;
            level5 = null;
            level6 = null;
            practise = null;

            Bar.Bars.Clear();
            PlayerShip.PlayerShips.Clear();
            Timer.Timers.Clear();
            SpriteSheet.SpriteSheets.Clear();
            Node.Nodes.Clear();
            Enemy.Enemies.Clear();
            Buddy.Buddys.Clear();
            Projectile.Projectiles.Clear();
            enemyProjectile.EnemyProjectiles.Clear();
            AIProjectile.AIProjectiles.Clear();
            queueBullet.queue.Clear();
            EnemyPlayerShip.EnemyPlayerShips.Clear();
            levelTimeColorInterval.Stop();

            Player.Ship = null;
            Player.EnemyPlayer = null;
            //PlayerShip.PlayerShips = null;
            //EnemyPlayerShip.EnemyPlayerShips = null;

            //Node.RemoveDead();

            //levelContent.Unload();

            //content.Unload();
            //#if WINDOWS_PHONE
            //            Microsoft.Phone.Shell.PhoneApplicationService.Current.State.Remove("PlayerPosition");
            //            Microsoft.Phone.Shell.PhoneApplicationService.Current.State.Remove("EnemyPosition");
            //#endif
            Config.EnemySpeed = 6;
            //ScreenManager.ScreenManagerInput = true;
            //Guide.IsScreenSaverEnabled = true;
            AccelerometerHelper.Instance.Active = false;
            PhoneApplicationService.Current.UserIdleDetectionMode = IdleDetectionMode.Enabled;
            GC.Collect();

            (Application.Current as App).TryPlayBackgroundMusic(0);

            base.OnNavigatedFrom(e);
        }
 //-------------------------------------------------------------------------
 /*!
 ** Allow one observer to register.
 */
 public void Register(Level1 observer)
 {
     this.observer = observer;
 }
Exemplo n.º 44
0
        /// <summary>
        /// Unload graphics content used by the game.
        /// </summary>
        public override void Unload()
        {
            //for (int i = 0; i < 100; i++)
            //{
            //    queueBullet.queue.Clear();
            //}
                
            if (Guide.IsTrialMode)
            {
                if (Config.Coins > 5000)
                    Config.Coins = 5000;
            }
            else
            {
                if (Config.Coins > 10000)
                    Config.Coins = 10000;
            }

            foreach (Node node in Node.Nodes)
            {
                node.Remove();
            }

            //GameStateManagementGame.Instance.soundManager.UnloadContent();

            level1 = null;
            level2 = null;
            level3 = null;
            level4 = null;
            level5 = null;
            level6 = null;
            practise = null;

            Bar.Bars.Clear();
            PlayerShip.PlayerShips.Clear();
            Timer.Timers.Clear();
            SpriteSheet.SpriteSheets.Clear();
            Node.Nodes.Clear();
            Enemy.Enemies.Clear();
            Buddy.Buddys.Clear();
            Projectile.Projectiles.Clear();
            enemyProjectile.EnemyProjectiles.Clear();
            AIProjectile.AIProjectiles.Clear();
            queueBullet.queue.Clear();
            EnemyPlayerShip.EnemyPlayerShips.Clear();
            levelTimeColorInterval.Stop();

            Player.Ship = null;
            Player.EnemyPlayer = null;
            //PlayerShip.PlayerShips = null;
            //EnemyPlayerShip.EnemyPlayerShips = null;

            //Node.RemoveDead();

            //levelContent.Unload();

            //content.Unload();
//#if WINDOWS_PHONE
//            Microsoft.Phone.Shell.PhoneApplicationService.Current.State.Remove("PlayerPosition");
//            Microsoft.Phone.Shell.PhoneApplicationService.Current.State.Remove("EnemyPosition");
//#endif
            Config.EnemySpeed = 6;
            //ScreenManager.ScreenManagerInput = true;
            Guide.IsScreenSaverEnabled = true;
            GC.Collect();
        }
        public void TestNesting()
        {
            var scope1 = new ProcessingScope();
            var scope2 = scope1.CreateChildScope(new DummyMapper());
            var scope3 = scope2.CreateChildScope(new DummyMapper());

            var o1 = new Level1();
            var o1_1 = new Level2();
            var o1_1_1 = new Level3();
            var o1_1_2 = new Level3();
            var o1_2 = new Level2();
            var o2 = new Level1();
            var o2_1 = new Level2();
            var o3 = new Level1();
            var o3_1 = new Level2();
            var o3_2 = new Level2();
            var o3_2_1 = new Level3();
            var o3_3 = new Level2();
            var o3_3_1 = new Level3();
            var o3_3_2 = new Level3();

            scope1.Set(o1);
            Assert.AreEqual(1, scope1.GlobalIndex);
            scope2.Set(o1_1);
            Assert.AreEqual(1, scope2.Index<Level1>());
            Assert.AreEqual(1, scope2.Index<Level2>());

            scope3.Set(o1_1_1);
            Assert.AreEqual(1, scope3.Index<Level1>());
            Assert.AreEqual(1, scope3.Index<Level2>());
            Assert.AreEqual(1, scope3.Index<Level3>());
            scope3.Set(o1_1_2);
            Assert.AreEqual(2, scope3.Index<Level1>());
            Assert.AreEqual(2, scope3.Index<Level2>());
            Assert.AreEqual(2, scope3.Index<Level3>());
            Assert.AreEqual(2, scope3.ChildIndex);
            Assert.AreEqual(2, scope3.GlobalIndex);

            scope2.Set(o1_2);
            Assert.AreEqual(2, scope2.Index<Level1>());
            Assert.AreEqual(2, scope2.Index<Level2>());
            Assert.AreEqual(2, scope2.ChildIndex);
            Assert.AreEqual(2, scope3.GlobalIndex);

            scope1.Set(o2);
            Assert.AreEqual(2, scope1.GlobalIndex);
            scope2 = scope2.Set(o2_1);
            Assert.AreEqual(1, scope2.Index<Level1>());
            Assert.AreEqual(3, scope2.GlobalIndex);

            scope1.Set(o3);
            Assert.AreEqual(3, scope1.GlobalIndex);
            scope2 = scope2.Set(o3_1);
            Assert.AreEqual(1, scope2.Index<Level1>());
            Assert.AreEqual(4, scope2.GlobalIndex);

            scope2.Set(o3_2);
            Assert.AreEqual(2, scope2.Index<Level1>());
            Assert.AreEqual(5, scope2.GlobalIndex);

            scope3.Set(o3_2_1);
            Assert.AreEqual(1, scope3.Index<Level1>());
            Assert.AreEqual(1, scope3.Index<Level2>());
            Assert.AreEqual(3, scope3.GlobalIndex);

            scope2.Set(o3_3);
            Assert.AreEqual(3, scope2.Index<Level1>());
            Assert.AreEqual(6, scope2.GlobalIndex);

            scope3.Set(o3_3_1);
            Assert.AreEqual(2, scope3.Index<Level1>());
            Assert.AreEqual(1, scope3.Index<Level2>());
            Assert.AreEqual(4, scope3.GlobalIndex);

            scope3.Set(o3_3_2);
            Assert.AreEqual(3, scope3.Index<Level1>());
            Assert.AreEqual(2, scope3.Index<Level2>());
            Assert.AreEqual(5, scope3.GlobalIndex);

            //Check that the objects are correctly assigned

            Assert.AreSame(o3, scope3.Current<Level1>());
            Assert.AreSame(o3_3, scope3.Current<Level2>());
            Assert.AreSame(o3_3_2, scope3.Current<Level3>());

            Assert.AreSame(o3, scope2.Current<Level1>());
            Assert.AreSame(o3_3, scope2.Current<Level2>());

            Assert.AreSame(o3, scope1.Current<Level1>());
        }
Exemplo n.º 46
0
        public void Should_activate_all_upstream_dependencies_when_chain_deep()
        {
            var defaultsOrder = new List<Feature>();
           
            var level1 = new Level1
            {
                OnDefaults = f => defaultsOrder.Add(f)
            };
            var level2 = new Level2
            {
                OnDefaults = f => defaultsOrder.Add(f)
            };
            var level3 = new Level3
            {
                OnDefaults = f => defaultsOrder.Add(f)
            };

            //the orders matter here to expose a bug
            featureSettings.Add(level3);
            featureSettings.Add(level2);
            featureSettings.Add(level1);

            featureSettings.SetupFeatures(null, null);

            Assert.True(level1.IsActive, "Level1 wasn't activated");
            Assert.True(level2.IsActive, "Level2 wasn't activated");
            Assert.True(level3.IsActive, "Level3 wasn't activated");

            Assert.IsInstanceOf<Level1>(defaultsOrder[0], "Upstream dependencies should be activated first");
            Assert.IsInstanceOf<Level2>(defaultsOrder[1], "Upstream dependencies should be activated first");
            Assert.IsInstanceOf<Level3>(defaultsOrder[2], "Upstream dependencies should be activated first");
        }
Exemplo n.º 47
0
        public void Should_activate_all_upstream_deps_when_chain_deep()
        {
            var order = new List<Feature>();

           
            var level1 = new Level1
            {
                OnActivation = f => order.Add(f)
            };
            var level2 = new Level2
            {
                OnActivation = f => order.Add(f)
            };
            var level3 = new Level3
            {
                OnActivation = f => order.Add(f)
            };

            var settings = new SettingsHolder();
            var featureSettings = new FeatureActivator(settings);

            //the orders matter here to expose a bug
            featureSettings.Add(level3);
            featureSettings.Add(level2);
            featureSettings.Add(level1);

            featureSettings.SetupFeatures(new FeatureConfigurationContext(null));


            Assert.True(level1.IsActive, "Level1 wasn't activated");
            Assert.True(level2.IsActive, "Level2 wasn't activated");
            Assert.True(level3.IsActive, "Level3 wasn't activated");

            Assert.IsInstanceOf<Level1>(order[0], "Upstream deps should be activated first");
            Assert.IsInstanceOf<Level2>(order[1], "Upstream deps should be activated first");
            Assert.IsInstanceOf<Level3>(order[2], "Upstream deps should be activated first");
        }
Exemplo n.º 48
0
        public void TagDeepNestedResolveTest()
        {
            var level1 = new Level1
            {
                Level2 = new Level2
                {
                    Level3 = new Level3
                    {
                        Value = 42
                    }

                }
            };
            var model = new TagModel(level1);
            model.PushTagStack();

            Assert.That(model["Level2.Level3.Value"], Is.EqualTo(42));
        }
Exemplo n.º 49
0
        /// <summary>
        /// Load graphics content for the game.
        /// </summary>
        public override void Activate(bool instancePreserved)
        {
            if (!instancePreserved)
            {
                if (content == null)
                    content = new ContentManager(ScreenManager.Game.Services, "Content");

                //Example message box for error display
                //List<string> MBOPTIONS = new List<string>();
                //MBOPTIONS.Add("OK");
                //string msg = "Text that was typed on the keyboard will be displayed here.\nClick OK to continue...";
                //Guide.BeginShowMessageBox("Pause", msg, MBOPTIONS, 0, MessageBoxIcon.Alert, null, null);

                // if memory leak, try using a new content manager and unloading.
                //ContentManager levelContent = new ContentManager(services, "Content");

                //extensions.initialise_texture(ScreenManager.SpriteBatch);
                Config.timeDropChance = 200;

                Config.shieldDropChance = 8 + (int)Math.Round(((float)8 / 100) * Config.PowerupDropChance);

                Config.projectileDropChance = 38 + (int)Math.Round(((float)38 / 100) * Config.PowerupDropChance);
                Config.missileDropChance = 68 + (int)Math.Round(((float)68 / 100) * Config.PowerupDropChance);
                Config.firerateDropChance = 128 + (int)Math.Round(((float)128 / 100) * Config.PowerupDropChance);
                Config.laserDropChance = 188 + (int)Math.Round(((float)158 / 100) * Config.PowerupDropChance);

                //Config.projectileDropChance = 68 + (int)Math.Round(((float)38 / 100) * Config.PowerupDropChance);
                //Config.missileDropChance = 98 + (int)Math.Round(((float)68 / 100) * Config.PowerupDropChance);
                //Config.firerateDropChance = 158 + (int)Math.Round(((float)128 / 100) * Config.PowerupDropChance);
                //Config.laserDropChance = 218 + (int)Math.Round(((float)158 / 100) * Config.PowerupDropChance);

                multiplierTracker = 2;
                Config.KillStreak = 0;
                Config.KillStreakBuildpoints = 0;
                Config.Score = 0;
                Config.Multi = 1;
                Config.AIScore = 0;
                Config.AIMulti = 1;
                Config.EmemiesKilled = 0;
                Config.CoinsCollected = 0;
                Config.EnemySpeed = 6;
                playerLives = Config.PlayerLives;

                playerAbilityUses = Config.PlayerSpecialAbilityUses;

                KillStreakBarBackground = new Bar(200, 20, new Color(0, 0, 0, 128));
                KillStreakBarBackground.Position = new Vector2(300, 455);
                KillStreakBarBackground.Percent = 1f;

                KillStreakBar = new Bar(200, 20, new Color(0,128,0,128));
                KillStreakBar.Position = new Vector2(300, 455);


                laserCharges = "0";

                thumbstick = content.Load<Texture2D>("thumbstick2");
                //introExtermination = content.Load<Texture2D>(@"Gamescreens\AlterEgo");
                phaserTexture = content.Load<Texture2D>(@"phaser");

                levelTimeColorInterval = new Timer();
                levelTimeColorInterval.Fire += new NotifyHandler(levelTimeColorInterval_Fire);

                switch (Config.Level)
                {
                    case LevelSelect.One:
                        stars = content.Load<Texture2D>(@"Background\Stars3");
                        backgroundClouds2 = content.Load<Texture2D>(@"Background\BackgroundClouds2");
                        musicLevel1 = content.Load<Song>(@"Music\throughthestars");
                        musicLevel1 = content.Load<Song>(@"Music\throughthestars");
                        levelTime = 300;
                        break;
                    case LevelSelect.Two:
                        stars = content.Load<Texture2D>(@"Background\Stars2");
                        //backgroundClouds2 = content.Load<Texture2D>(@"Background\cloudlayer2");
                        backgroundClouds2 = content.Load<Texture2D>(@"Background\BackgroundClouds2");
                        musicLevel1 = content.Load<Song>(@"Music\galacticstruggle");
                        levelTime = 300;
                        levelTimeColor = Color.Green;
                        break;
                    case LevelSelect.Three:
                        //stars = content.Load<Texture2D>(@"Background\stars");
                        //backgroundClouds2 = content.Load<Texture2D>(@"Background\nova2");
                        //backgroundClouds1 = content.Load<Texture2D>(@"Background\stars4");
                        stars = content.Load<Texture2D>(@"Background\Stars8");
                        backgroundClouds2 = content.Load<Texture2D>(@"Background\stars7");
                        backgroundClouds1 = content.Load<Texture2D>(@"Background\cloudlayer2");
                        musicLevel1 = content.Load<Song>(@"Music\survival");
                        levelTime = 300;
                        playerLives = 3;
                        respawnTime = TimeSpan.FromSeconds(5);
                        break;
                    case LevelSelect.Four:
                        stars = content.Load<Texture2D>(@"Background\stars");
                        backgroundClouds2 = content.Load<Texture2D>(@"Background\stars10");
                        backgroundClouds1 = content.Load<Texture2D>(@"Background\stars7");
                        musicLevel1 = content.Load<Song>(@"Music\holo");
                        levelTime = 300;
                        playerLives = 3;
                        respawnTime = TimeSpan.FromSeconds(5);
                        break;
                    case LevelSelect.Five:
                        //stars = content.Load<Texture2D>(@"Background\Stars5");
                        //backgroundClouds2 = content.Load<Texture2D>(@"Background\Stars4");
                        //backgroundClouds1 = content.Load<Texture2D>(@"Background\cloudlayer2");
                        stars = content.Load<Texture2D>(@"Background\Stars5");
                        backgroundClouds2 = content.Load<Texture2D>(@"Background\Stars4");
                        backgroundClouds1 = content.Load<Texture2D>(@"Background\stars7");
                        musicLevel1 = content.Load<Song>(@"Music\giantrobotsfighting");
                        levelTime = 60;
                        break;
                    case LevelSelect.Six:
                        stars = content.Load<Texture2D>(@"Background\stars");
                        backgroundClouds2 = content.Load<Texture2D>(@"Background\nova2");
                        backgroundClouds1 = content.Load<Texture2D>(@"Background\stars4");
                        musicLevel1 = content.Load<Song>(@"Music\AgainstTheOdds");
                        levelTime = 300;
                        break;
                    case LevelSelect.Practise:
                        //UIdescription = content.Load<Texture2D>(@"Gamescreens\UIdescription");
                        stars = content.Load<Texture2D>(@"Background\Stars3");
                        backgroundClouds2 = content.Load<Texture2D>(@"Background\BackgroundClouds2");
                        musicLevel1 = content.Load<Song>(@"Music\throughthestars");
                        levelTime = 300;
                        break;
                }

                font = content.Load<SpriteFont>(@"Fonts\Tahoma14");
                floatingScoreFont = content.Load<SpriteFont>(@"Fonts\Andy22");
                floatingPowerupFont = content.Load<SpriteFont>(@"Fonts\Andy22");
                floatingMultiplierMsgFont = content.Load<SpriteFont>(@"Fonts\Andy48");
                andy14 = content.Load<SpriteFont>(@"Fonts\Andy14");
                andy18 = content.Load<SpriteFont>(@"Fonts\Andy18");
                andy22 = content.Load<SpriteFont>(@"Fonts\Andy22");
                andy48 = content.Load<SpriteFont>(@"Fonts\Andy48");

                SpriteSheet.LoadContent(content, ScreenManager.GraphicsDevice);

                cam = new Camera2D(ScreenManager.GraphicsDevice, worldBounds.Right, worldBounds.Bottom);

                //GameStateManagementGame.Instance.soundManager.LoadSound("Shot3", @"SoundEffects\Shot3");
                //GameStateManagementGame.Instance.soundManager.LoadSound("coin", @"SoundEffects\coin");
                //GameStateManagementGame.Instance.soundManager.LoadSound("ShipSpawn", @"SoundEffects\ShipSpawn");
                //GameStateManagementGame.Instance.soundManager.LoadSound("ShipExplode", @"SoundEffects\ShipExplode");

                Player.SpawnShip();

                //Player = new Player();
                switch (Config.Level)
                {
                    case LevelSelect.One:
                        level1 = new Level1();
                        break;
                    case LevelSelect.Two:
                        level2 = new Level2();
                        break;
                    case LevelSelect.Three:
                        level3 = new Level3();
                        Player.SpawnEnemyShip();
                        break;
                    case LevelSelect.Four:
                        level4 = new Level4();
                        Player.SpawnEnemyShip();
                        break;
                    case LevelSelect.Five:
                        level5 = new Level5();
                        break;
                    case LevelSelect.Six:
                        level6 = new Level6();
                        break;
                    case LevelSelect.Practise:
                        practise = new Practise();
                        break;
                }
                //bud = new BuddyMissile(Config.BuddySpriteSheet);
                //bud.Position = Player.Ship.Position;

                //if (Player.Ship == null)
                //{
                //    Player.SpawnShip();
                //}
                //ParticleEngineEffect = new ParticleEffects(graphicsDeviceManager, cam, GraphicsDevice);
                ParticleEffects.Initialize(ScreenManager.GraphicsDeviceManager, ScreenManager.GraphicsDevice);
                //ParticleEngineEffect.LoadContent(content);
                ParticleEffects.LoadContent(content);

                FloatingScoreList = new SpriteFontFloatScores();

                //FloatingScore = new SpriteFontFloatScore();

                //FloatingScore.Color = Color.Green;
                //FloatingScore.Score = "+";
                //FloatingScore.SpriteFont = floatingScoreFont;
                //FloatingScore.LifeSpan = 1000f;
                //FloatingScore.SizeTime = 500f;
                //FloatingScore.ShadowEffect = false;
                //FloatingScore.EndPosition = new Vector2(20, -20);

                FloatingPowerupText = new SpriteFontFloatScore();

                FloatingPowerupText.Color = Color.White;
                FloatingPowerupText.Score = "+";
                FloatingPowerupText.SpriteFont = floatingPowerupFont;
                FloatingPowerupText.LifeSpan = 1000f;
                FloatingPowerupText.SizeTime = 500f;
                FloatingPowerupText.ShadowEffect = false;
                FloatingPowerupText.EndPosition = new Vector2(20, -20);
                FloatingPowerupText.LayerDepth = 0.7f;

                FloatingMultiplierText = new SpriteFontFloatScore();

                FloatingMultiplierText.Color = Color.White;
                FloatingMultiplierText.Score = "Multiplyer";
                FloatingMultiplierText.SpriteFont = floatingMultiplierMsgFont;
                FloatingMultiplierText.LifeSpan = 1000f;
                FloatingMultiplierText.SizeTime = 500f;
                FloatingMultiplierText.ShadowEffect = true;
                FloatingMultiplierText.EndPosition = Vector2.Zero;
                FloatingPowerupText.LayerDepth = 1.0f;

                //if (queueBullet.queue.Count < 1)
                //{
                //    for (int i = 0; i < 100; i++)
                //    {

                //        queueBullet.queue.Enqueue(new queueBullet(Config.BulletSheetEnergyPurple));
                //    }
                //}
                if (Config.MusicOn && MediaPlayer.GameHasControl)
                    GameStateManagementGame.Instance.musicManager.Play(musicLevel1);

                //GameStateManagementGame.Instance.musicManager.Stop();

                Bar.Texture = content.Load<Texture2D>("Textures/Fill22");

                multiHud = new Sprite(Config.MultiHud);
                multiHud.Scale = 0.5f;
                multiHud.Color = Color.Green;
                multi = (Math.Round(Config.Multi, 2)).ToString() + "x";

                healthHud = new Sprite(Config.MultiHud);
                healthHud.Scale = 0.3f;
                healthHud.Color = Color.Red;

                shieldHud = new Sprite(Config.MultiHud);
                shieldHud.Scale = 0.5f;
                shieldHud.Color = Color.RoyalBlue;

                AImultiHud = new Sprite(Config.MultiHud);
                AImultiHud.Scale = 0.5f;
                AImultiHud.Color = Color.Green;
                AImulti = (Math.Round(Config.AIMulti, 2)).ToString() + "x";

                AIHealthHud = new Sprite(Config.MultiHud);
                AIHealthHud.Scale = 0.3f;
                AIHealthHud.Color = Color.Red;

                AIShieldHud = new Sprite(Config.MultiHud);
                AIShieldHud.Scale = 0.5f;
                AIShieldHud.Color = Color.RoyalBlue;



                GC.Collect();


                // once the load has finished, we use ResetElapsedTime to tell the game's
                // timing mechanism that we have just finished a very long frame, and that
                // it should not try to catch up.
                ScreenManager.Game.ResetElapsedTime();
            }

//#if WINDOWS_PHONE
//            if (Microsoft.Phone.Shell.PhoneApplicationService.Current.State.ContainsKey("PlayerPosition"))
//            {
//                playerPosition = (Vector2)Microsoft.Phone.Shell.PhoneApplicationService.Current.State["PlayerPosition"];
//                enemyPosition = (Vector2)Microsoft.Phone.Shell.PhoneApplicationService.Current.State["EnemyPosition"];
//            }
//#endif
        }
Exemplo n.º 50
0
        public void TagDeepNestedResolveWithNullValueTest()
        {
            var level1 = new Level1
            {
                Level2 = new Level2
                {
                    Level3 = new Level3
                    {
                        Value = default(int?)
                    }

                }
            };
            var model = new TagModel(level1);
            model.PushTagStack();

            Assert.That(model["Level2.Level3.Value"], Is.EqualTo(default(int?)));
        }
Exemplo n.º 51
0
Arquivo: dish4.cs Projeto: s1vh/GGJ16
 // Use this for initialization
 void Start()
 {
     level1 = backgroundLevel1.GetComponent<Level1>();
 }
Exemplo n.º 52
0
	// Use this for initialization
	void Start () {
        level = FindObjectOfType<Level1>();
	}
Exemplo n.º 53
0
 private void setLevelStory1()
 {
     levelStory1 = new Level1 (names, dialogs, playerName);
     names = levelStory1.getNames ();
     dialogs = levelStory1.getDialogs ();
     backdrop.sprite = (Sprite)Resources.Load("Tutorial/level1", typeof(Sprite));
     newStory = "PlayLevel1";
 }