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


C# Enemy.isDead方法代码示例

本文整理汇总了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();
				}
			}
		}
	}
开发者ID:marouen-lamiri,项目名称:Second-Soul,代码行数:64,代码来源:SorcererAI.cs


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