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


C# GameData.SpawnPlayer方法代码示例

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


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

示例1: NewGame

    public static void NewGame()
    {
        auto = false;
        data = new GameData();
        enemyController = new EnemyController();
        ILevelBuilder generator = new LevelGenerator();

        data.level = generator.Generate();
        for (int i = 0; i < data.level.doors.Count; i++)
        {
            data.level.doors[i].Init();
        }

        data.SpawnPlayer();
        //DEBUG STUFF
        //data.inventory.Add(ItemLibrary.Get().items[5], 1);

        foreach (IGameDataChangeListener listener in GAMEDATA_CHANGE_LISTENERS)
        {
            listener.OnGameDataChange(data);
        }

        //ConsolePseudoRaycast.CastRay(new Vector2(14, 1), new Vector2(16, 3));
        //Console.ReadKey();
    }
开发者ID:kevinwegner,项目名称:ConsoleDungeonCrawler,代码行数:25,代码来源:Application.cs

示例2: TakeDamage

    public void TakeDamage(float value, string dmgtype, float pen)
    {
        data = Application.GetData();
        Armor armor = this.Armor.content;

        //DAMAGE CALC WITH DAMAGE TYPE AND ARMOR TYPE AND STUFF
        value = ApplyArmor(value, dmgtype, armor, pen);
        health -= Math.Max((int)value, 0);

        if (this != data.player)
        {
            data.combatlog.Add("...Enemy took " + (int)value + " damage");
        }
        if (this == data.player)
        {
            data.combatlog.Add("Hit. " + (int)value + " damage taken");
        }

        data.score.AddScore((int)value);

        if (this != data.player && health <= 0)
        {
            data.combatlog.Add(name + " defeated");
            #region scores
            if (this.name == "alien_assaulter")
            {
                data.score.AddScore(25);
                data.player.AddExperience(10);
            }
            if (this.name == "alien_trooper")
            {
                data.score.AddScore(20);
                data.player.AddExperience(10);
            }
            if (this.name == "cyberbear")
            {
                data.score.AddScore(75);
                data.player.AddExperience(50);
            }
            #endregion

            data.level.enemies.Remove(this);
            data.collision.Remove(this);
        }
        if (this == data.player && health <= 0)
        {
            data.collision.Remove(data.player);
            data.player = new Actor();
            data.SpawnPlayer();

            Console.WriteLine("YOU DIED");
            Console.WriteLine("Press any key to continue\n");
            Application.ChangeGameState(GameStates.FINISH);
        }
    }
开发者ID:kevinwegner,项目名称:ConsoleDungeonCrawler,代码行数:55,代码来源:Actor.cs


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