Exemple #1
0
        protected virtual T1 GetBlueprint(string name)
        {
            //if the user passed a string that was actually a Guid
            if (Guid.TryParse(name, out Guid g))
            {
                return(GetBlueprint(g));
            }

            return(Blueprints.FirstOrDefault(b => b.Is(name)) ??
                   throw new NamedObjectNotFoundException($"Could not find {typeof(T1).Name} Named {name}", name));
        }
Exemple #2
0
        public IRoom Create(IWorld world, Point3 location)
        {
            var exact = Blueprints.FirstOrDefault(b => Equals(location, b.FixedLocation));

            if (exact != null)
            {
                return(Create(world, exact));
            }

            return(Create(world));
        }
Exemple #3
0
 protected virtual T1 GetBlueprint(Guid guid)
 {
     return(Blueprints.FirstOrDefault(b => b.Is(guid)) ??
            throw new GuidNotFoundException($"Could not find {typeof(T1).Name} with Guid {guid}", guid));
 }