private uint findLowestFreeId() { for (uint i = 1; i < uint.MaxValue; i++) { if (!NPCPool.ContainsKey(i)) { return(i); } } throw new Exception("No free ids"); }
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); }
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(); }
private void Reset() { pool = GetComponent <NPCPool>(); spawnPositions = GetComponentsInChildren <SpawnPoint>(); }
private void EnsurePet(ref NPC npc, NPCPool pool) { npc = pool.CreateMob(); npc.EnsureInWorldAndLiving(); }
private static void EnsureNPC(ref NPC npc, NPCPool pool) { //npc = pool.CreateTrainer(); npc.EnsureInWorldAndLiving(); }
private static void EnsureNPC(ref NPC npc, NPCPool pool) { npc = pool.CreateVendor(); npc.EnsureInWorldAndLiving(); }