Example #1
0
 private uint findLowestFreeId()
 {
     for (uint i = 1; i < uint.MaxValue; i++)
     {
         if (!NPCPool.ContainsKey(i))
         {
             return(i);
         }
     }
     throw new Exception("No free ids");
 }
Example #2
0
 public ServerNPC(string name, uint model, Vector3 position, float heading)
 {
     if (NPCPool == null)
     {
         NPCPool = new Dictionary <uint, ServerNPC>();
     }
     this.name        = name;
     this.model       = model;
     this.position    = position;
     this.heading     = heading;
     currentVehicleId = 0;
     id = findLowestFreeId();
     NPCPool.Add(id, this);
 }
Example #3
0
    private void Awake()
    {
        var caveObject = new GameObject("Caves");

        _cave = caveObject.AddComponent <CaveHandler>();

        _shrooms  = new ShroomPool();
        _stals    = new StalPool();
        _moths    = new MothPool();
        _spiders  = new SpiderPool();
        _webs     = new WebPool();
        _triggers = new TriggerHandler();
        _npcs     = new NPCPool();
    }
Example #4
0
 private void Reset()
 {
     pool           = GetComponent <NPCPool>();
     spawnPositions = GetComponentsInChildren <SpawnPoint>();
 }
Example #5
0
 private void EnsurePet(ref NPC npc, NPCPool pool)
 {
     npc = pool.CreateMob();
     npc.EnsureInWorldAndLiving();
 }
Example #6
0
 private static void EnsureNPC(ref NPC npc, NPCPool pool)
 {
     //npc = pool.CreateTrainer();
     npc.EnsureInWorldAndLiving();
 }
Example #7
0
 private static void EnsureNPC(ref NPC npc, NPCPool pool)
 {
     npc = pool.CreateVendor();
     npc.EnsureInWorldAndLiving();
 }