本文整理汇总了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> ();
}
示例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;
}
}
示例3: Awake
void Awake()
{
minDistance = 2.0f;
enemyHealth = GetComponent <EnemyHealth> ();
_animation = GetComponent<Animation> ();
player = GameObject.FindGameObjectWithTag ("Player").transform;
}
示例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");
}
}
示例5: Awake
void Awake()
{
player = GameObject.Find("TP_Character");
playerHealth = player.GetComponent <TP_Health> ();
enemyHealth = GetComponent<EnemyHealth>();
anim = GetComponent <Animator>();
}
示例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> ();
}
示例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>();
}
示例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);
}
示例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>();
}
}
}
示例10: Awake
//SET UP
void Awake()
{
_player = GameObject.FindGameObjectWithTag ("Player");
_playerHealth = _player.GetComponent <PlayerHealth> ();//script reference
_enemyHealth = GetComponent<EnemyHealth>();//script reference
_anim = GetComponent <Animator> ();
}
示例11: Awake
// Use this for initialization
void Awake()
{
Player = GameObject.FindGameObjectWithTag("Player").transform;
playerHealth = Player.GetComponent<PlayerHealth>();
enemyHealth = GetComponent<EnemyHealth>();
nav = GetComponent<NavMeshAgent>();
}
示例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
}
示例13: Awake
void Awake()
{
// Setting up the references.
players = GameObject.FindGameObjectsWithTag("Player");
enemyHealth = GetComponent<EnemyHealth>();
anim = GetComponent<Animator>();
}
示例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;
}
示例15: Awake
void Awake()
{
player = GameObject.FindGameObjectWithTag ("Player");
//playerHealth = player.getComponent<PlayerHealth>();
enemyHealth = GetComponent<EnemyHealth>();
a = GetComponent<Animator> ();
}