本文整理汇总了C#中Enemy.isDead方法的典型用法代码示例。如果您正苦于以下问题:C# Enemy.isDead方法的具体用法?C# Enemy.isDead怎么用?C# Enemy.isDead使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Enemy
的用法示例。
在下文中一共展示了Enemy.isDead方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: movingAI
//gives the orders to the AI
void movingAI(){
//checks if there is a player controlling the sorcerer
if(checkAIPlayingStatus()){
int randomTech = Random.Range(randomMinValue,randomMaxValue);
nearestEnemy = checkNearestEnemy();
sorcerer.target = nearestEnemy;
//checks if there is a nearby enemy in respect to the fighter, otherwise it will ignore any enemies
if(nearestEnemy != null && Vector3.Distance (fighter.transform.position, nearestEnemy.transform.position) < radiusCheck * 2 &&
timeOut < 0 && !(nearestEnemy.isDead()) && Vector3.Distance (fighter.transform.position, sorcerer.transform.position) < radiusCheck * 2
&& determineNextMove() && (!animation.isPlaying || !animation.IsPlaying("run"))){
sorcerer.stopMoving();
//will decide what to use based on probability, which can be tweeked
//randomTech determines the next attack
//This represents the default attack
if(randomTech <= basicRanged && timeOut < 0 && determineNextAttack()){
sorcerer.activeSkill5.useSkill();
timeOut = basicTimeOutReset;
}
//skill chance of happeining is 0.5%
if((randomTech == skillThreshold1) && fighter.energy >= energyCheck && timeOut < 0 && determineNextAttack()){
sorcerer.activeSkill2.useSkill();
timeOut = timeOutReset;
}
//skill chance of happeining is 0.5%
if((randomTech == skillThreshold2) && fighter.energy >= energyCheck && timeOut < 0 && determineNextAttack()){
sorcerer.activeSkill3.useSkill();
timeOut = timeOutReset;
}
//skill chance of happeining is 0.5%
if((randomTech == skillThreshold3) && fighter.energy >= energyCheck && timeOut < 0 && determineNextAttack()){
sorcerer.activeSkill4.useSkill();
timeOut = timeOutReset;
}
//skill chance of happeining is 0.5%
if((randomTech == skillThreshold4) && fighter.energy >= energyCheck && timeOut <= 0 && determineNextAttack()){
sorcerer.activeSkill1.useSkill();
timeOut = timeOutReset;
}
//skill chance of happeining is 2%
if(fighter.health < fighter.maxHealth * 0.50 && fighter.energy >= energyCheck && (randomTech > basicRanged && randomTech < healValue) && timeOut <= 0){
sorcerer.activeSkill6.useSkill();
timeOut = basicTimeOutReset;
}
}
//if the fighter is too far, go to him, ignore everyone else
else if(Vector3.Distance (fighter.transform.position, sorcerer.transform.position)> radiusCheck){
//Determine the direction in which the sorcerer moves, he has to be close to the fighter
direction = sorcerer.transform.position - fighter.transform.position;
direction.Normalize();
goalPosition = direction;
sorcerer.startMoving(fighter.transform.position + goalPosition);
}
//if the fighter is nearby, stop
else if (Vector3.Distance(sorcerer.transform.position,goalPosition) < radiusCheck){
sorcerer.stopMoving();
}
else if(nearestEnemy != null){
if(nearestEnemy.isDead()){
sorcerer.animateIdle();
}
}
}
}