public void InitPanel(WorldLevel worldLevel)
    {
        textLevelName.text = worldLevel.levelName;
        textLevelNumber.text = "Level: " + worldLevel.levelID + 1;
        textLevelDescription.text = worldLevel.levelDescription;

        currLevel = worldLevel;
    }
Example #2
0
 protected void LoadLevel(WorldLevel level)
 {
     if (Level != null)
     {
         Level.Uninstall();
     }
     Level = level;
     Level.Install();
 }
Example #3
0
    public void defPlayerData()
    {
        lastDay      = DateTime.Today.ToString("yyyy-MM-dd");
        currentWorld = WorldType.house;
        WorldLocks   = new WorldIntDictionary();
        int maxHouseLevels = DataUtils.loadLevelAsset(WorldType.house).stageNames.Length;

        WorldLocks[currentWorld] = new WorldLevel(0, -1, new uint[maxHouseLevels], new ushort[maxHouseLevels]);
        lastPos = new Vector2Ser(0, 0);
    }
Example #4
0
        public WorldState(GameStateManager gameStateManager, WorldLevel level)
        {
            isPause       = false;
            canPause      = false;
            PauseCoolDown = Util.Instance.Hundred;

            spriteFont            = MenuFactory.Instance.CreateSpriteFont();
            this.gameStateManager = gameStateManager;
            timercounter          = Util.Instance.Zero;
            this.level            = level;
            timeFreeze            = false;
            changeWorldID();
            overTimer = 0;
        }
Example #5
0
    public void ReleaseWorld()
    {
        if (m_rootNodeGroup != null)
        {
            m_rootNodeGroup.BhvOnLeave();
            m_rootNodeGroup = null;
        }

        if (m_worldLevel != null)
        {
            m_worldLevel.ClearFirstLevel();
            m_worldLevel = null;
        }
    }
Example #6
0
    public override bool Equals(object obj)
    {
        if (!(obj is WorldLevel))
        {
            return(false);
        }

        WorldLevel mys = (WorldLevel)obj;

        // compare elements here
        return(this.hasPlayed == mys.hasPlayed &&
               this.level == mys.level &&
               this.starRating.SequenceEqual(mys.starRating) &&
               this.dailyPlays.SequenceEqual(mys.dailyPlays));
    }
Example #7
0
    public void CreateWorld()
    {
        m_worldLevel = new WorldLevel();

        if (m_worldLevel != null)
        {
            m_worldLevel.CreateFirstLevel();
        }

        m_rootNodeGroup = m_worldLevel;

        if (m_rootNodeGroup != null)
        {
            m_rootNodeGroup.BhvOnEnter();
        }
    }
Example #8
0
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here

            //Intro Buttons
            PlayBtn = new Button();
            QuitBtn = new Button();

            //Add all levels
            levels.Add(new FirstLevel(Content));
            levels.Add(new SecondLevel(Content));

            //Begin Level
            level = levels[i];

            //collision
            collisionManager = new CollisionManager(new CollisionHelper());

            base.Initialize();
        }
Example #9
0
    public void setWorldLevel(WorldType world, int level, int played, bool won, int maxLevels)
    {
        Debug.Log("set world: " + world + " / level: " + level + " / played: " + played + " / max levels: " + maxLevels);
        if (level < 0)
        {
            return;
        }

        WorldLevel WL;

        if (playerData.WorldLocks.TryGetValue(world, out WL) == false)
        {
            uint[] daily = new uint[maxLevels];
            WL = new WorldLevel(
                level,
                -1,
                daily,
                new ushort[maxLevels]);
        }
        else
        {
            WL.level     = level > WL.level ? level : WL.level;
            WL.hasPlayed = played > WL.hasPlayed ? played : WL.hasPlayed;
        }

        if (won)
        {
            WL.dailyPlays[level - 1] += 1;
        }

        playerData.WorldLocks[world] = WL;
        //if last level of the world..
        if (level == maxLevels)
        {
            //unlock connected worlds
            foreach (WorldType w in DataUtils.getConnectedWorlds(world))
            {
                setWorldLevel(w, 0, -1, false, DataUtils.loadLevelAsset(w).stageNames.Length);
            }
        }
    }
Example #10
0
 protected void Quit()
 {
     Level.Uninstall();
     Level  = null;
     Active = false;
 }
    public void ShowLevelInfo(WorldLevel worldLevel)
    {
        //Open map level info
        EnablePanel(panelMapLevelInfo);

        //Init panel with level info
        panelMapLevelInfo.GetComponent<MapLevelInfoPanel>().InitPanel(worldLevel);
    }
Example #12
0
 public WorldGraphNode(WorldLevel level)
 {
     Level = level;
 }
 public WorldParams(WorldLevel root, int size, float difficulty)
 {
     Root = root;
     Size = size;
     Difficulty = difficulty;
 }
Example #14
0
        protected override void Update(GameTime gameTime)
        {
            if (Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            if (EndGame)
            {
                /*Reset the intro booleans*/
                StartGame = false;
                //Sets back to First level
                i      = -1;
                hasWon = false;
            }
            if (!StartGame)
            {
                IntroScreen();
            }
            else
            {
                // TODO: Add your update logic here
                if (hasWon)
                {
                    //blob.reset();
                    i++;
                    if (i >= levels.Count)
                    {
                        //End of the whole game
                        EndGame           = true;
                        StartGame         = false;
                        PlayBtn.isClicked = false;
                    }
                    if (!EndGame && levels[i] != null)
                    {
                        level         = levels[i];
                        hasWon        = false;
                        blob.Position = level.StartPosition;
                    }
                }

                blob.Update(gameTime);

                foreach (var item in level.BlokArray)
                {
                    if (item != null)
                    {
                        collisionManager.ExecuteCollision(blob.CollisionRectangle, item.CollisionRectangle, level.Width, level.Height, blob);
                    }
                }

                camera.Update(blob.Position, level.Width, level.Height);

                foreach (var platform in level.Platforms)
                {
                    platform.animHandler(blob.hasJumped);
                }

                //Game over check
                hasWon = collisionManager.CheckEndCollision(blob.CollisionRectangle, level.endPlatform.CollisionRectangle);

                base.Update(gameTime);
            }
        }