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


C# EnemyHealth.ToString方法代码示例

本文整理汇总了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;
		}
	}
开发者ID:DoveTailers,项目名称:Template,代码行数:27,代码来源:Shootable_DestoryByContact.cs

示例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());
                }
            }



            

        }


    }
开发者ID:DoveTailers,项目名称:Template,代码行数:70,代码来源:Boss_Puzzle_onCollect.cs


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