Esempio n. 1
0
var Instance = function(opts){
  this.areaId = opts.id;
  this.type = opts.type;
  this.map = opts.map;

  //The map from player to entity
  this.players = {};
  this.users = {};
  this.entities = {};
  this.zones = {};
  this.items = {};
  this.channel = null;

  this.playerNum = 0;
  this.emptyTime = Date.now();
  //Init AOI
  this.aoi = aoiManager.getService(opts);

  this.aiManager = ai.createManager({area:this});
  this.patrolManager = patrol.createManager({area:this});
  this.actionManager = new ActionManager();

  this.timer = new Timer({
    area : this,
    interval : 100
  });

  this.start();
};
Esempio n. 2
0
exp.init = function(opts) {
	//Init Map
	id = opts.id;
	level = opts.level;

	opts.weightMap = true;
	map = new Map(opts);
	//Init AOI
	aoi = aoiManager.getService(opts);
	aoiEventManager.addEvent(aoi.aoi);

	//Init mob zones
	initMobZones(map.getMobZones());
	initNPCs(this);

	aiManager = ai.createManager();
	patrolManager = patrol.createManager({area:this});
	actionManager = new ActionManager();
	run();
};
Esempio n. 3
0
var Instance = function(map,instanceId){
  this.map =map;
  this.instanceId = instanceId;
  var opts=map.areaConfigData;
  logger.info("area create  areaId=",opts.id);
  this.areaId = opts.id;
  this.type = opts.type;
  this.areaKind = opts.kind;

  //The map from player to entity
  this.players = {};
  this.users = {};
  this.entities = {};
  this.zones = {};
  this.items = {};
  this.npcs = {};
  this.channel = null;

  this.playerNum = 0;
  this.emptyTime = Date.now();
  //Init AOI
  opts.towerWidth=300;
  opts.towerHeight=300;
  this.aoi = aoiManager.getService(opts);

  this.aiManager = ai.createManager({area:this});
  this.patrolManager = patrol.createManager({area:this});
  this.actionManager = new ActionManager();

  this.timer = new Timer(this);
  this.areaLogic=createAreaLogic(this);
  if(!this.areaLogic){
    logger.error("areaLogic=============>> areaId="+this.areaId);
    return;
  }
  this.areaLogic.startLogic();

};