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


C# Enemy.ToString方法代码示例

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


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

示例1: DrawEnemyTypeAboveObject

    /// <summary>
    /// Draws text above an object. Currently used to draw the enemyType, but can draw anything you pass in as second param.
    /// Create a new function to draw different objects above enemes
    /// </summary>
    /// <param name="gameObject">Target object we are drawing on top of </param>
    /// <param name="enemyType">should consider moving this to a different object, instead of enemyType</param>
    //[Conditional("DEBUG")]
    public static void DrawEnemyTypeAboveObject(GameObject gameObject, Enemy.EnemyType enemyType, int offsetX = 40, int offsetY = 40, int rectWidth = 90, int rectHeight = 40)
    {
        // Converts 3d space to 2d, to create a plane to draw text to
        var objectPos = Camera.main.WorldToScreenPoint(gameObject.transform.position);

        // BeginArea positioned in relation to my character
        GUILayout.BeginArea(new Rect((objectPos.x - offsetX), (Screen.height - objectPos.y) - offsetY, Screen.width, Screen.height));

        // Draw the text above the enemy
        GUI.Label(new Rect(gameObject.transform.position.x, gameObject.transform.position.y, rectWidth, rectHeight), enemyType.ToString());

        GUILayout.EndArea();
    }
开发者ID:imclab,项目名称:Unity-csharp-shmup-template,代码行数:20,代码来源:DebugUtils.cs

示例2: GetRandomEnemy

        private IEnemy GetRandomEnemy()
        {
            try
            {
                var enemiesFile = new IniFile(_enemiesFilename);

                var name = enemiesFile.IniReadValue("Enemy", "Name", "Unknown");
                var health = float.Parse(enemiesFile.IniReadValue("Enemy", "Health", "1"));
                var mana = float.Parse(enemiesFile.IniReadValue("Enemy", "Mana", "0"));
                var baseDamage = float.Parse(enemiesFile.IniReadValue("Enemy", "BaseDamage", "1"));

                var enemy = new Enemy(name: name, maxHp: health, maxMana: mana, baseDamage: baseDamage);

                Logger.WriteLine("Created enemy '{0}' from file: '{1}'", enemy.ToString(), _enemiesFilename);

                return enemy;
            }
            catch(Exception e)
            {
                Logger.WriteLine(e.Message);
                return null;
            }
        }
开发者ID:rokn,项目名称:HackBulgaria,代码行数:23,代码来源:Dungeon.cs

示例3: RecieveKill

 /// <summary>
 /// 
 /// </summary>
 /// <param name="enemy"></param>
 /// <param name="experience"></param>
 public void RecieveKill(Enemy.EnemyTypes enemy, int experience)
 {
     myExperience.Increase(experience);
     myPerformance.IncreaseKill(enemy.ToString());
     myScore.IncreaseScore(Mathf.CeilToInt(experience*SCOREEXPMODIFIER));
 }
开发者ID:syeager,项目名称:Knighthood,代码行数:11,代码来源:Player.cs

示例4: makeEnemies

 public static List<Sprite> makeEnemies(Enemy a, Enemy b = Enemy.Empty, Enemy c = Enemy.Empty, Enemy d = Enemy.Empty)
 {
     List<Sprite> result = new List<Sprite>();
     if (a != Enemy.Empty && !a.Equals(null))
         result.Add(FileUtils.CreateNewSprite(a.ToString()));
     if (b != Enemy.Empty && !b.Equals(null))
         result.Add(FileUtils.CreateNewSprite(b.ToString()));
     if (c != Enemy.Empty && !c.Equals(null))
         result.Add(FileUtils.CreateNewSprite(c.ToString()));
     if (d != Enemy.Empty && !d.Equals(null))
         result.Add(FileUtils.CreateNewSprite(d.ToString()));
     return result;
 }
开发者ID:CaKlassen,项目名称:Titanium,代码行数:13,代码来源:PartyUtils.cs

示例5: PlayUniqueEncounter

 public void PlayUniqueEncounter( Enemy.EnemyType type ) { Debug.Log("Playing Unique Encounter Line for..." + type.ToString()); }
开发者ID:wjSimon,项目名称:GD1014_s3p,代码行数:1,代码来源:Narrator.cs


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