本文整理汇总了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();
}
示例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;
}
}
示例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));
}
示例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;
}
示例5: PlayUniqueEncounter
public void PlayUniqueEncounter( Enemy.EnemyType type ) { Debug.Log("Playing Unique Encounter Line for..." + type.ToString()); }