예제 #1
0
 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));
 }
예제 #2
0
 private void Exterminate(CarnivoreType carnType)
 {
     while (m_Carnivores.ContainsKey(carnType) && m_Carnivores[carnType].Count > 0)
     {
         KillCarnivore(m_Carnivores[carnType].First());
     }
 }
예제 #3
0
    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);
    }
예제 #4
0
    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);
    }
예제 #5
0
 public SpawnableCreatureAttribute(string name, CarnivoreType type, Type spawnPlacerType = null)
     : this(name, (Enum)type, spawnPlacerType)
 {
 }
예제 #6
0
 public static CarnivoreBase InstantiateCarnivore(Vector3 pos, Quaternion rot, CarnivoreType type)
 {
     return(m_Singleton.InternalInstantiateCarnivore(pos, rot, type));
 }