Esempio n. 1
0
 public SceneViewModel(SceneListViewModel vm, Scene scene)
 {
     parentVM             = vm;
     EditSceneCommand     = new RelayCommand(new Action <object>(EditScene));
     MoveSceneUpCommand   = new RelayCommand(new Action <object>(MoveSceneUp));
     MoveSceneDownCommand = new RelayCommand(new Action <object>(MoveSceneDown));
     DeleteCommand        = new RelayCommand(new Action <object>(DeleteScene));
     EditStepsCommand     = new RelayCommand(new Action <object>(EditSteps));
     SaveChangesCommand   = new RelayCommand(new Action <object>(SaveChanges));
     if (scene == null)
     {
         this.scene = new Scene();
     }
     else
     {
         this.scene = scene;
     }
     while (this.scene.prefabs.Count < 4)
     {
         AddPrefab();
     }
     foreach (PrefabInfo prefabInfo in this.scene.prefabs)
     {
         Prefabs.Add(prefabInfo.modelName);
         PrefabPositions.Add(prefabInfo.position);
     }
 }
Esempio n. 2
0
 public VM_EntityConfig(DirectoryInfo dir)
 {
     foreach (var file in dir.GetFiles())
     {
         if (file.Extension.ToLower() == ".enf")
         {
             var info = EntityInfo.Get(file);
             Prefabs.Add(new VM_EntityPrefab()
             {
                 Model = info as EntityInfo, Key = file.Name
             });
         }
     }
 }
        /// <summary>Builds this Item</summary>
        protected override void Build()
        {
            //foreach (Identifiable.Id slime in Identifiable.SLIME_CLASS)
            //{
            // Make new Definition
            SlimeDefinition other  = SlimeUtils.GetDefinitionByID(Identifiable.Id.PINK_SLIME);
            SlimeDefinition newDef = Definition.CombineForLargo(other);

            // Translation
            DefTranslation.Add(newDef.IdentifiableId, Regex.Replace(Definition.Name, "(\\B[A-Z])", " $1") + " " + Regex.Replace(other.Name, "(\\B[A-Z])", " $1") + " Largo");

            //if (newDef == null)
            //	continue;

            // Get GameObjects
            Prefab      = PrefabUtils.CopyPrefab(BaseItem);
            Prefab.name = NamePrefix + Definition.Name + other.Name;
            Prefab.transform.localScale = Scale * newDef.PrefabScale;

            // PRIMARY SETUP
            // Load Components
            SlimeAppearanceApplicator app = Prefab.GetComponent <SlimeAppearanceApplicator>();
            SlimeVarietyModules       mod = Prefab.GetComponent <SlimeVarietyModules>();

            // Setup Components
            app.SlimeDefinition = newDef;
            mod.baseModule      = newDef.BaseModule;
            mod.slimeModules    = newDef.SlimeModules;

            mod.Assemble();

            // SECONDARY SETUP
            // Load Components
            SlimeEat    eat = Prefab.GetComponent <SlimeEat>();
            SlimeHealth hp  = Prefab.GetComponent <SlimeHealth>();

            Rigidbody    body = Prefab.GetComponent <Rigidbody>();
            Vacuumable   vac  = Prefab.GetComponent <Vacuumable>();
            Identifiable iden = Prefab.GetComponent <Identifiable>();

            // Setup Components
            eat.slimeDefinition    = newDef;
            eat.minDriveToEat      = MinDriveToEat;
            eat.drivePerEat        = DrivePerEat;
            eat.agitationPerEat    = AgitationPerEat;
            eat.agitationPerFavEat = AgitationPerFavEat;

            hp.maxHealth = Health;

            body.mass = Mass;
            vac.size  = Size;
            iden.id   = newDef.IdentifiableId;

            // TERTIARY SETUP
            // Load Components
            SlimeEmotions emot  = Prefab.GetComponent <SlimeEmotions>();
            SlimeEmotions emot2 = BaseItem.GetComponent <SlimeEmotions>();

            emot.initAgitation = emot2.initAgitation;
            emot.initFear      = emot2.initFear;
            emot.initHunger    = emot2.initHunger;

            // Add to Largo List
            Prefabs.Add(newDef.IdentifiableId, Prefab);
            //}
        }