public IEnumerator AddTrainingProperties() { // Given a ISceneObject. // Required for ColliderWithTriggerProperty SceneObject.GameObject.AddComponent <BoxCollider>().isTrigger = true; foreach (Type propertyType in TrainingProperties) { // When adding the ISceneObjectProperty to the ISceneObject. SceneObject.AddTrainingProperty(propertyType); yield return(null); // Then assert that the ISceneObjectProperty is part of ISceneObject. Assert.That(SceneObject.GameObject.GetComponent(propertyType)); } int totalOfPublicProperties = TrainingProperties.Count(); int totalOfAddedProperties = SceneObject.Properties.Count; // Then assert that the ISceneObject.Properties considers all the ISceneObjectProperty added to ISceneObject. Assert.AreEqual(totalOfAddedProperties, totalOfPublicProperties); }
private void SceneObjectAutomaticSetup(GameObject selectedSceneObject, Type valueType) { ISceneObject sceneObject = selectedSceneObject.GetComponent <TrainingSceneObject>() ?? selectedSceneObject.AddComponent <TrainingSceneObject>(); if (RuntimeConfigurator.Configuration.SceneObjectRegistry.ContainsGuid(sceneObject.Guid) == false) { // Sets a UniqueName and then registers it. sceneObject.SetSuitableName(); } if (typeof(ISceneObjectProperty).IsAssignableFrom(valueType)) { sceneObject.AddTrainingProperty(valueType); } isUndoOperation = true; }