Beispiel #1
0
        public void AddMob(
            Mob mob)
        {
            Debug.Assert(mob.ID >= 0);

            GetRequestRoomCache(mob.RoomKey).AddMob(mob);
        }
Beispiel #2
0
        public static Mob CreateMob(Mobs dbMob, MobTypeSet mobTypes)
        {
            Mob mob = new Mob();

            mob.m_room_key = new RoomKey(dbMob.GameID, dbMob.RoomX, dbMob.RoomY, dbMob.RoomZ);
            mob.m_mob_id = dbMob.MobID;
            mob.m_mob_type= mobTypes.GetMobTypeById(dbMob.MobTypeID);
            mob.m_position = new Point3d((float)dbMob.X, (float)dbMob.Y, (float)dbMob.Z);
            mob.m_angle = (float)dbMob.Angle;
            mob.m_health = dbMob.Health;
            mob.m_energy = dbMob.Energy;
            mob.m_ai_data = ParseJsonAIData(dbMob.AiData);

            if (mob.m_ai_data == null)
            {
                mob.m_ai_data = new MobAIState();
                //Utilities.LogWarning(string.Format("Mob:CreateMob(id={0}) - Unable to parse AI State. Creating new state.", dbMob.MobID));
            }

            return mob;
        }
Beispiel #3
0
 public void AddMob(Mob mob)
 {
     m_mobs.Add(mob.ID, mob);
 }
Beispiel #4
0
        public static Mob CreateMob(MobSpawner spawner, MobType mobType)
        {
            Mob mob = new Mob();

            mob.m_room_key = new RoomKey(spawner.RoomKey);
            mob.m_mob_id= -1; // mob ID not set until this gets saved into the DB
            mob.m_mob_type= mobType;
            mob.m_position = new Point3d(spawner.Position);
            mob.m_angle = 0f; //TODO: Add a spawn facing to the mob spawner
            mob.m_health= mobType.MaxHealth;
            mob.m_energy= mobType.MaxEnergy;
            mob.m_ai_data = new MobAIState(spawner);

            return mob;
        }