/// <summary> /// Adds a new entity to the corresponding entityregistry /// </summary> /// <param name="type">The entity type to register</param> /// <param name="theEntity">The actual entity to register</param> public void RegisterEntity(m_entityTypes type, GameObject theEntity) { switch (type) { case m_entityTypes.TYPE_ENEMY: { m_enemyRegistry.Add(theEntity); break; } case m_entityTypes.TYPE_BOSSENEMY: { m_bossRegistry.Add(theEntity); break; } case m_entityTypes.TYPE_PLAYER: { if (m_thePlayer != null) { Debug.LogError("A player entity was already registered! Something is going wrong..."); } else { m_thePlayer = theEntity; } break; } } }
/// <summary> /// Removes an entity from the corresponding registry /// </summary> /// <param name="type">The entity type</param> /// <param name="theEntity">The actual entity</param> public void RemoveEntity(m_entityTypes type, GameObject theEntity) { switch (type) { case m_entityTypes.TYPE_ENEMY: { m_enemyRegistry.Remove(theEntity); Destroy(theEntity); break; } case m_entityTypes.TYPE_BOSSENEMY: { m_bossRegistry.Remove(theEntity); Destroy(theEntity); break; } case m_entityTypes.TYPE_PLAYER: { if (m_thePlayer == null) { Debug.LogError("A player entity was not yet registered! Something is going wrong..."); } else { Destroy(m_thePlayer); m_thePlayer = null; } break; } } }
/// <summary> /// Sets the owner of the bullet /// </summary> /// <param name="entity">Entity type that shot the bullet</param> public void SetOwner(m_entityTypes entity) { m_bulletOwner = entity; }