当前位置: 首页>>代码示例>>C#>>正文


C# Level.Load方法代码示例

本文整理汇总了C#中Level.Load方法的典型用法代码示例。如果您正苦于以下问题:C# Level.Load方法的具体用法?C# Level.Load怎么用?C# Level.Load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Level的用法示例。


在下文中一共展示了Level.Load方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

        // Use this for initialization
        void Start()
        {
            Level model = new Level();
            model = model.Load(path);

            foreach (Enemy e in model.Enemies)
            {
                GameObject prefab = (GameObject)Resources.Load("Prefabs/" + e.TypeName);

                GameObject enemy = Instantiate(prefab);

                enemy.GetComponent<NavMeshAgent>().speed = e.MoveSpeed;

                enemy.GetComponent<EnemyAttack>().timeBetweenAttacks = e.AttackSpeed;
                enemy.GetComponent<EnemyAttack>().attackDamage = e.Damage;

                enemy.GetComponent<EnemyHealth>().startingHealth = e.Health;
                enemy.GetComponent<EnemyHealth>().scoreValue = e.ScoreValue;

                PrefabUtility.ReplacePrefab(enemy, PrefabUtility.CreateEmptyPrefab("Assets/Resources/Prefabs/" + e.TypeName + ".prefab"));

                AddManager(e.TypeName, e.SpawnTime);

                Destroy(enemy);
            }
            /*foreach (Component m in copy.GetComponents(typeof(Component))) {
                Type t = m.GetType();
                enemy.AddComponent(m);
            }*/
        }
开发者ID:eivhyl,项目名称:PG5200_Innlevering1,代码行数:31,代码来源:GameManager.cs

示例2: LoadLevel

 public static void LoadLevel(int level)
 {
     CurrentLevel = levels[level - 1];
     CurrentLevel.Load();
 }
开发者ID:holtkampw,项目名称:UH-Sample-XNA-Project,代码行数:5,代码来源:LevelManager.cs

示例3: ImportLevel

        /// <summary>
        /// Goes through the xml file and translates the information
        /// </summary>
        /// <param name="filename">Name of the file we are importing</param>
        /// <returns>A level object</returns>
        public Level ImportLevel(Level level)
        {
            XElement xLevel;
            #if XBOX360
            xLevel = XElement.Load("Content\\Levels\\" + level.Name + ".xml");
            #else
            xLevel = XElement.Load("..\\..\\..\\Content\\Levels\\" + level.Name + ".xml");
            #endif

            //Gets all the information for a level and places it into the level object
            foreach (var item in xLevel.Elements())
            {
                if (item.Name == XmlKeys.Name)
                    level.Name = item.Value;
                if (item.Name == XmlKeys.Size && !level.IsMainMenu)
                    level.Size = GridSpace.GetDrawingCoord(new Vector2(int.Parse(item.Attribute(XName.Get("X", "")).Value),
                        int.Parse(item.Attribute(XName.Get("Y", "")).Value)));
                if (item.Name == XmlKeys.Background)
                    level.Load(_mContent, item.Value);
                if (item.Name == "Entities")
                    foreach (var element in item.Elements())
                        _mEntities.Add(new EntityInfo(element));
            }

            if(!level.IsMainMenu)
                GetPlayerStart(level);

            return level;
        }
开发者ID:DizWARE,项目名称:Mr-Gravity,代码行数:34,代码来源:Importer.cs

示例4: SwitchToLevel

        internal void SwitchToLevel(MetaLevel meta)
        {
            Level level = LevelFactory.CreateLevelFromMetaLevel(meta, this);
            if (level == null) {
                return;
            }

            if (state == GameState.MENU) {
                /* Transition from the menu to the level. Don't dispose MENU. */
                currentLevel = level;
                currentLevel.Load();

                mainMenu.Sound = false;
                state = GameState.LEVEL;
            } else if (state == GameState.LEVEL) {
                /* Transition from the prior level to the new level. Dispose resources immediately. */
                if (currentLevel != null) {
                    currentLevel.Unload();
                }
                currentLevel = level;
                currentLevel.Load();
            }
            currentView = currentLevel;
            currentView.Sound = true;
        }
开发者ID:ncallaway,项目名称:Song-of-Ice,代码行数:25,代码来源:SongOfIce.cs


注:本文中的Level.Load方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。