|
@@ -285,6 +285,33 @@ export class GameController extends EventDispatcher{
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 是否有怪物可攻击
|
|
|
+ */
|
|
|
+ public get CanAttackMonster():boolean{
|
|
|
+ let monsterList:MonsterBase[];
|
|
|
+ let monsterLists:Array<Array<MonsterBase>>=[this.leftMonsterList,this.middleMonsterList,this.rightMonsterList];
|
|
|
+ let endNode:Node;
|
|
|
+ let monster:MonsterBase;
|
|
|
+ for (let index = 0; index < monsterLists.length; index++) {
|
|
|
+ monsterList = monsterLists[index];
|
|
|
+ for (let index = 0; index < monsterList.length; index++) {
|
|
|
+ monster = monsterList[index];
|
|
|
+ if(monster.config.startPos==0){
|
|
|
+ endNode=this.leftEndNode;
|
|
|
+ }else if(monster.config.startPos==1){
|
|
|
+ endNode=this.middleEndNode;
|
|
|
+ }else{
|
|
|
+ endNode=this.rightEndNode;
|
|
|
+ }
|
|
|
+ if(Vec3.distance(monster.node.worldPosition,endNode.worldPosition)<=this.weapon.weaponConfig.attackDistance){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 武器攻击
|
|
|
*/
|
|
@@ -402,6 +429,10 @@ export class GameController extends EventDispatcher{
|
|
|
GameModel.single.angerCount+=monster.config.anger;
|
|
|
//增加击杀量
|
|
|
GameModel.single.killCount++;
|
|
|
+ //增加积分
|
|
|
+ if(monster.config.integral>0){
|
|
|
+ GameModel.single.integral+=monster.config.integral;
|
|
|
+ }
|
|
|
//从列表中删除
|
|
|
monsterList.splice(index,1);
|
|
|
index--;
|