private IEnumerable <TCarn> GetCarnivores <TCarn>(CarnivoreType type) where TCarn : CarnivoreBase { return(!m_Carnivores.ContainsKey(type) ? Enumerable.Empty <TCarn>() : m_Carnivores[type].Select(cb => (TCarn)cb)); }
private void Exterminate(CarnivoreType carnType) { while (m_Carnivores.ContainsKey(carnType) && m_Carnivores[carnType].Count > 0) { KillCarnivore(m_Carnivores[carnType].First()); } }
public GameObject SpawnCarnivore(Vector3 pos, Quaternion rot, CarnivoreType type) { var carn = CarnivoreFactory.InstantiateCarnivore(pos, rot, type); carn.transform.SetParent(transform); NetworkServer.Spawn(carn.gameObject); if (!m_Carnivores.ContainsKey(type)) { m_Carnivores.Add(type, new HashSet <CarnivoreBase>()); } m_Carnivores[type].Add(carn); OctreeManager.Get(OctreeType.Carnivore).Add(carn.transform); return(carn.gameObject); }
private CarnivoreBase InternalInstantiateCarnivore(Vector3 pos, Quaternion rot, CarnivoreType type) { switch (type) { case CarnivoreType.Jabarkie: return(Instantiate(JabarkiePrefab, pos, rot).GetComponent <CarnivoreBase>()); case CarnivoreType.Gnomehatz: return(Instantiate(GnomehatzPrefab, pos, rot).GetComponent <CarnivoreBase>()); case CarnivoreType.FellyJish: return(Instantiate(FellyJishPrefab, pos, rot).GetComponent <CarnivoreBase>()); } throw new ArgumentException("Unrecognized type: " + type); }
public SpawnableCreatureAttribute(string name, CarnivoreType type, Type spawnPlacerType = null) : this(name, (Enum)type, spawnPlacerType) { }
public static CarnivoreBase InstantiateCarnivore(Vector3 pos, Quaternion rot, CarnivoreType type) { return(m_Singleton.InternalInstantiateCarnivore(pos, rot, type)); }