public void ApplyToLevelEditor(LevelEditorScreen scrn) { foreach (var old in scrn.GetEntities <ILeveleditorStub>()) { old.Kill(); } foreach (var e in Elements) { switch (e.StubType) { case SCCMLevelElement.SCCMStubType.Cannon: scrn.Entities.AddEntity(new CannonStub(scrn, e)); break; case SCCMLevelElement.SCCMStubType.Obstacle: scrn.Entities.AddEntity(new ObstacleStub(scrn, e)); break; case SCCMLevelElement.SCCMStubType.Portal: scrn.Entities.AddEntity(new PortalStub(scrn, e)); break; case SCCMLevelElement.SCCMStubType.Wall: scrn.Entities.AddEntity(new WallStub(scrn, e)); break; default: SAMLog.Error("SCCMLD::EnumSwitch_ATLE", "e.StubType: " + e.StubType); break; } } }
private void Update(LevelEditorScreen scrn) { Elements.Clear(); LastChanged = DateTime.UtcNow; foreach (var stub in scrn.GetEntities <ILeveleditorStub>()) { if (stub is CannonStub cannonStub) { Elements.Add(new SCCMLevelElement { StubType = SCCMLevelElement.SCCMStubType.Cannon, Cannon_Center = cannonStub.Center, Cannon_Scale = cannonStub.Scale, Cannon_Rotation = cannonStub.Rotation, Cannon_CannonType = cannonStub.CannonType, Cannon_CannonFrac = cannonStub.CannonFrac, }); } else if (stub is PortalStub portalStub) { Elements.Add(new SCCMLevelElement { StubType = SCCMLevelElement.SCCMStubType.Portal, Portal_Center = portalStub.Center, Portal_Normal = portalStub.Normal, Portal_Length = portalStub.Length, Portal_Group = portalStub.Group, Portal_Side = portalStub.Side }); } else if (stub is ObstacleStub obstacleStub) { Elements.Add(new SCCMLevelElement { StubType = SCCMLevelElement.SCCMStubType.Obstacle, Obstacle_Center = obstacleStub.Center, Obstacle_Rotation = obstacleStub.Rotation, Obstacle_Width = obstacleStub.Width, Obstacle_Height = obstacleStub.Height, Obstacle_PowerFactor = obstacleStub.Power, Obstacle_ObstacleType = obstacleStub.ObstacleType }); } else if (stub is WallStub wallStub) { Elements.Add(new SCCMLevelElement { StubType = SCCMLevelElement.SCCMStubType.Wall, Wall_Point1 = wallStub.Point1, Wall_Point2 = wallStub.Point2, Wall_WallType = wallStub.WallType, }); } else { SAMLog.Error("SCCMLD::EnumSwitch_UAS", "typeof(stub): " + stub?.GetType()); } } }