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


C# EnemyHealth类代码示例

本文整理汇总了C#中EnemyHealth的典型用法代码示例。如果您正苦于以下问题:C# EnemyHealth类的具体用法?C# EnemyHealth怎么用?C# EnemyHealth使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Awake

 void Awake()
 {
     player = GameObject.Find("Player");
     playerHealth = player.GetComponent<PlayerHealth> ();
     health = GetComponent<EnemyHealth> ();
     anim = GetComponent<Animator> ();
 }
开发者ID:Mr-Zoidberg,项目名称:AlienSurvival,代码行数:7,代码来源:EnemyAttack.cs

示例2: 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

示例3: Awake

 void Awake()
 {
     minDistance = 2.0f;
     enemyHealth = GetComponent <EnemyHealth> ();
     _animation = GetComponent<Animation> ();
     player = GameObject.FindGameObjectWithTag ("Player").transform;
 }
开发者ID:kevinm1075,项目名称:City-Defense,代码行数:7,代码来源:EnemyAI.cs

示例4: Start

 void Start()
 {
     if(PlayerPrefs.GetString("level") == "Level2")
     {
         health1 = GameObject.FindWithTag("enemy1").GetComponent<EnemyHealth>();
         enemy1 = GameObject.FindWithTag("enemy1");
     }
     if(PlayerPrefs.GetString("level") == "Level3")
     {
         health1 = GameObject.FindWithTag("enemy2").GetComponent<EnemyHealth>();
         enemy1 = GameObject.FindWithTag("enemy2");
     }
     if(PlayerPrefs.GetString("level") == "Level4")
     {
         health1 = GameObject.FindWithTag("enemy3").GetComponent<EnemyHealth>();
         enemy1 = GameObject.FindWithTag("enemy3");
     }
     if(PlayerPrefs.GetString("level") == "Level5")
     {
         health1 = GameObject.FindWithTag("enemy4").GetComponent<EnemyHealth>();
         health2 = GameObject.FindWithTag("enemy5").GetComponent<EnemyHealth>();
         health3 = GameObject.FindWithTag("enemy6").GetComponent<EnemyHealth>();
         enemy1 = GameObject.FindWithTag("enemy4");
         enemy2 = GameObject.FindWithTag("enemy5");
         enemy3 = GameObject.FindWithTag("enemy6");
     }
 }
开发者ID:TomVerkerk,项目名称:Curse_of_the_Dutchman,代码行数:27,代码来源:EnemyColl.cs

示例5: Awake

 void Awake()
 {
     player = GameObject.Find("TP_Character");
     playerHealth = player.GetComponent <TP_Health> ();
     enemyHealth = GetComponent<EnemyHealth>();
     anim = GetComponent <Animator>();
 }
开发者ID:darinav,项目名称:ShooterSample,代码行数:7,代码来源:EnemyAttacks.cs

示例6: Awake

 void Awake()
 {
     player = GameObject.FindGameObjectWithTag ("Player").transform;  //finds the player in the scene
     playerHealth = player.GetComponent <PlayerHealth> ();
     enemyHealth = GetComponent <EnemyHealth> ();
     nav = GetComponent <NavMeshAgent> ();
 }
开发者ID:SGTMcClain,项目名称:COSC-330_TopDownShoot,代码行数:7,代码来源:EnemyMovement.cs

示例7: Awake

	float timer;                                // Timer for counting up to the next attack.
	
	
	void Awake ()
	{
		// Setting up the references.
		player = GameObject.FindGameObjectWithTag ("Player");
		playerHealth = player.GetComponent <PlayerHealth> ();
		enemyHealth = GetComponent<EnemyHealth>();
	}
开发者ID:lcwadle,项目名称:Programming-Panthers,代码行数:10,代码来源:EnemyAttack.cs

示例8: attack

    void attack()
    {
        timer = 0f;

        if (attackingList.Count <= 0)
            return;
        else
            currentTarget = attackingList [0].transform;

        for (int i = 0; i< attackingList.Count; i++) {

            if(currentTarget.GetComponent<EnemyHealth>().health > attackingList [i].transform.GetComponent<EnemyHealth>().health)
                currentTarget = attackingList [i].transform;

        }

        currentEnemyHealth = currentTarget.GetComponent<EnemyHealth> ();

        if(currentEnemyHealth.health<=attackingDamage)
        {
            attackingList.Remove (currentTarget);
            currentEnemyHealth.attack(attackingDamage);
        }

        else
            currentEnemyHealth.attack(attackingDamage);
    }
开发者ID:Chillli,项目名称:Wind-Turbine-MOOC,代码行数:27,代码来源:PumpAttacking.cs

示例9: Update

    void Update()
    {
        if (player != null)
        {
            timer += Time.deltaTime;

            if (timer >= timeBetweenAttacks && playerInRange && enemyHealth.currentHealth > 0)
            {
                Attack();
            }

            if (playerHealth.currentHealth <= 0)
            {
                anim.SetTrigger("PlayerDead");
            }
        }
        else {
            player = GameObject.FindGameObjectWithTag("Player");
            if (player != null)
            {
                playerHealth = player.GetComponent<PlayerHealth>();
                enemyHealth = GetComponent<EnemyHealth>();
                anim = GetComponent<Animator>();
            }
        }
    }
开发者ID:illyasviel,项目名称:project1,代码行数:26,代码来源:EnemyAttack.cs

示例10: Awake

 //SET UP
 void Awake()
 {
     _player = GameObject.FindGameObjectWithTag ("Player");
     _playerHealth = _player.GetComponent <PlayerHealth> ();//script reference
     _enemyHealth = GetComponent<EnemyHealth>();//script reference
     _anim = GetComponent <Animator> ();
 }
开发者ID:DiabelHanta,项目名称:COMP305-GAME-ASSIGNMENT01,代码行数:8,代码来源:EnemyAttack.cs

示例11: Awake

 // Use this for initialization
 void Awake()
 {
     Player = GameObject.FindGameObjectWithTag("Player").transform;
     playerHealth = Player.GetComponent<PlayerHealth>();
     enemyHealth = GetComponent<EnemyHealth>();
     nav = GetComponent<NavMeshAgent>();
 }
开发者ID:RomanHc,项目名称:SurvivalShooter,代码行数:8,代码来源:EnemyFollowPlayer.cs

示例12: Awake

	void Awake ()
	{
		player = GameObject.Find("Police");												//Find the police GameObject
		playerHealth = player.GetComponent <PlayerHealth> (); 							//get the PlayerHealth Script 
		enemyHealth = GetComponent <EnemyHealth>();										//Get EnemyHealth Script
	
	}
开发者ID:dunkelblume,项目名称:DND,代码行数:7,代码来源:EnemyAttack.cs

示例13: Awake

 void Awake()
 {
     // Setting up the references.
     players = GameObject.FindGameObjectsWithTag("Player");
     enemyHealth = GetComponent<EnemyHealth>();
     anim = GetComponent<Animator>();
 }
开发者ID:Smlep,项目名称:Illumnia,代码行数:7,代码来源:CrocoAttack.cs

示例14: Awake

    PlayerHealth playerHealth; // Reference to the player's health.

    #endregion Fields

    #region Methods

    void Awake()
    {
        enemyHealth = GetComponent<EnemyHealth>();
        nav = GetComponent<NavMeshAgent>();
        animation = GetComponent<Animation>();
        lebosspeutbouger = true;
    }
开发者ID:Smlep,项目名称:Illumnia,代码行数:13,代码来源:Boss1Move.cs

示例15: Awake

 void Awake()
 {
     player = GameObject.FindGameObjectWithTag ("Player");
     //playerHealth = player.getComponent<PlayerHealth>();
     enemyHealth = GetComponent<EnemyHealth>();
     a = GetComponent<Animator> ();
 }
开发者ID:repaulblic,项目名称:To-The-Stars,代码行数:7,代码来源:EnemyAttack.cs


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