Ejemplo n.º 1
0
    public void CreateNewPlayer()
    {
        for (int i = 0; i < EntityDecorator.Count; i++)
        {
            IEntityGenerator = EntityDecorator[i];


            if (EntityDecorator[i].GetType() == typeof(WeaponGenerator))
            {
                IEntityGenerator.Setup("AssaultRifle");
                myWeapon = EntityDecorator[i].Generate() as Weapon;
            }
            else if (EntityDecorator[i].GetType() == typeof(ArmorGenerator))
            {
                IEntityGenerator.Setup("NormalArmor");
                myArmor = EntityDecorator[i].Generate() as Armor;
            }
            else
            {
                IEntityGenerator.Setup("NormalUniform");
                mySkin = EntityDecorator[i].Generate() as Uniform;
            }
        }
        health = 100;
    }
Ejemplo n.º 2
0
        /// <summary>
        /// Generates and build prototype with resources informations within.
        /// </summary>
        public void Generate()
        {
            _dataLayer = new DataLayerManager(_configProvider, _prototype);

            Type data =
                Utils.LoadTypes(AppDomain.CurrentDomain.BaseDirectory)
                .Where(y => !y.IsAbstract && y.GetInterfaces().Contains(typeof(IBuilder)))
                .FirstOrDefault(type => ((IBuilder)Activator.CreateInstance(type)).IsPlatformSupported(_dataLayer.Platform));

            if (data == null)
            {
                throw new ArgumentException("Data cannot be prepared.");
            }
            _dataLayerBuilder = (IBuilder)Activator.CreateInstance(data);


            _prototypeGenerator.Generate(_dataLayer.GetGenerable(), _configProvider);
            _dataLayerBuilder.Build(_configProvider, _dataLayer);

            var supportedStorages = _entityGenerator.Setup(_prototype, _dataLayer, _configProvider);

            _entityGenerator.Generate();
            _dataLayer.Dispose();
            CleanOutput();

            GenerateApplications();
            BuildApplications();
        }