Exemple #1
0
    public void AssignMonument(List <string> monumentArgs)
    {
        string type     = monumentArgs[0];
        string name     = monumentArgs[1];
        int    affinity = int.Parse(monumentArgs[2]);

        IMonument monument = monumentFactory.CreateMonument(type, name, affinity);

        this.monumentsByNation[type].Add(monument);
    }
    public IMonument CreateMonument(string type, string name, int affinity)
    {
        Type monumentType = Assembly.GetExecutingAssembly()
                            .GetTypes()
                            .Where(t => t.IsClass)
                            .FirstOrDefault(t => t.Name == type + MonumentSuffix);

        if (monumentType == null)
        {
            throw new ArgumentNullException(nameof(monumentType), "Unknown monument");
        }

        IMonument monument = (IMonument)Activator.CreateInstance(monumentType, name, affinity);

        return(monument);
    }
 public void AddMonument(IMonument monument) => this.monuments.Add(monument);
Exemple #4
0
    public void AssignMonument(List <string> monumentArgs)
    {
        IMonument monument = monumentFactory.CreateMonument(monumentArgs);

        monuments.Add(monument);
    }