private void ComponentsAttachmentTest() { Debug.Log(LogLevel.Display, "Starting " + MethodBase.GetCurrentMethod().Name + "..."); Actor actor = new Actor(); StaticMeshComponent staticMeshComponent = new StaticMeshComponent(actor, setAsRoot: true); InstancedStaticMeshComponent instancedStaticMeshComponent = new InstancedStaticMeshComponent(actor); SceneComponent sceneComponent = new SceneComponent(actor); sceneComponent.AttachToComponent(instancedStaticMeshComponent, AttachmentTransformRule.KeepRelativeTransform); if (!sceneComponent.IsAttachedToComponent(instancedStaticMeshComponent)) { Debug.Log(LogLevel.Error, "Component attachment check failed!"); return; } if (!sceneComponent.IsAttachedToActor(actor)) { Debug.Log(LogLevel.Error, "Component attachment to actor check failed!"); return; } Debug.Log(LogLevel.Display, "Test passed successfully"); }
public InstancedStaticMeshes() { actor = new("InstancedCubes"); sceneComponent = new(actor); transforms = new Transform[maxCubes]; instancedStaticMeshComponent = new(actor, setAsRoot : true); material = Material.Load("/Game/Tests/BasicMaterial"); rotationSpeed = 2.5f; }
private void ComponentsMatchingTest() { Debug.Log(LogLevel.Display, "Starting " + MethodBase.GetCurrentMethod().Name + "..."); Actor actor = new Actor(); StaticMeshComponent staticMeshComponent = new StaticMeshComponent(actor, setAsRoot: true); SceneComponent sceneComponent = actor.GetRootComponent <SceneComponent>(); InstancedStaticMeshComponent instancedStaticMeshComponent = actor.GetRootComponent <InstancedStaticMeshComponent>(); if (sceneComponent == null) { Debug.Log(LogLevel.Error, "Component obtainment with inherited type matching to the root component failed!"); return; } if (instancedStaticMeshComponent != null) { Debug.Log(LogLevel.Error, "Component obtainment with type matching to the root component failed!"); return; } if (actor.GetComponent <StaticMeshComponent>() == null) { Debug.Log(LogLevel.Error, "Component type matching failed!"); return; } if (actor.GetRootComponent <StaticMeshComponent>() == null) { Debug.Log(LogLevel.Error, "Component type matching to the root component failed!"); return; } Debug.Log(LogLevel.Display, "Test passed successfully"); }