本文整理汇总了C#中EnemyHealth.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# EnemyHealth.ToString方法的具体用法?C# EnemyHealth.ToString怎么用?C# EnemyHealth.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EnemyHealth
的用法示例。
在下文中一共展示了EnemyHealth.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnTriggerStay2D
void OnTriggerStay2D (Collider2D other) {
float currHit = 0f;
int currScore = 0;
if (other.tag == "Lazer") {
currHit = lazerDamage;
currScore = lazerScore;
try {
eHealthScript = gameObject.GetComponentInChildren <EnemyHealth> ();
UIControl.Instance.AddScore (currScore);
if (eHealthScript.EnemyIsDead (currHit)) {
if (gameObject.name == "core"){
// boss died
UIControl.Instance.AddScore (5000);
// for now its game over
SceneManager.LoadScene("WinGame");
}
Instantiate (explosion, transform.position, transform.rotation);
Destroy (gameObject);
}
} catch {
print ("could not get " + gameObject.ToString () + " Script!");
print ("script: " + eHealthScript.ToString());
}
} else {
return;
}
}
示例2: OnTriggerEnter2D
void OnTriggerEnter2D(Collider2D other)
{
if (other.tag == "Boundary")
{
return;
}
if (other.tag == "Player")
{
//tick sheld health down and also destory a side missle launcher
GameObject[] rockets;
GameObject[] shield;
shield = GameObject.FindGameObjectsWithTag("boss01_shield");
if (leftside == true)
{
rockets = GameObject.FindGameObjectsWithTag("boss01_left_rocket");
}
else
{
rockets = GameObject.FindGameObjectsWithTag("boss01_right_rocket");
}
foreach (GameObject r in rockets)
{
try
{
print(r.transform.position);
Instantiate(explosion, r.transform.position, r.transform.rotation);
Destroy(r);
}
catch
{
print("could not get " + r.gameObject.ToString() + " Script!");
print("script: " + eHealthScript.ToString());
}
}
Destroy(gameObject);
foreach (GameObject s in shield)
{
try
{
eHealthScript = s.GetComponentInChildren<EnemyHealth>();
float currHit = -2600f;
if (eHealthScript.EnemyIsDead(currHit))
{
Instantiate(explosion, transform.position, transform.rotation);
Destroy(s);
My_GameController = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<GameController_Boss>();
My_GameController.shield_destoryed = true;
}
}
catch
{
print("could not get " + s.gameObject.ToString() + " Script!");
print("script: " + eHealthScript.ToString());
}
}
}
}