Beispiel #1
0
    //TODO: make this method more modular to accept unique constructors for unique entities
    //      or different prefabs
    //
    /// <summary>
    /// Used to create an entity at a given location
    /// </summary>
    /// <param name="grid">The <see cref="HexGrid"/> the entity exists within</param>
    /// <param name="position">The hex position of the entity within the grid</param>
    /// <returns>An Entity Component, attached to the BasicEntity Prefab</returns>
    public Entity CreateEntity(int maxHealth)
    {
        //construct new entity prefab
        GameObject entityObj = new GameObject("Entity");//Instantiate(entityPrefab);

        AddRenderComponent(entityObj);
        HealthComponent.AddHealthComponent(entityObj, maxHealth);
        Entity entComponent = entityObj.AddComponent <Entity>();

        entComponent.Initialize();
        return(entComponent);
    }