public void PlaceEntity(Loc position) { GroundEntity placeableEntity = EntBrowser.CreateEntity(); if (placeableEntity == null) { return; } placeableEntity.Position = position; placeableEntity.EntName = ZoneManager.Instance.CurrentGround.FindNonConflictingName(placeableEntity.EntName); placeableEntity.SyncScriptEvents(); DiagManager.Instance.DevEditor.GroundEditor.Edits.Apply(new GroundEntityStateUndo(0)); if (placeableEntity.GetEntityType() == GroundEntity.EEntTypes.Character) { ZoneManager.Instance.CurrentGround.AddMapChar((GroundChar)placeableEntity); } else if (placeableEntity.GetEntityType() == GroundEntity.EEntTypes.Object) { ZoneManager.Instance.CurrentGround.AddObject((GroundObject)placeableEntity); } else if (placeableEntity.GetEntityType() == GroundEntity.EEntTypes.Marker) { ZoneManager.Instance.CurrentGround.AddMarker((GroundMarker)placeableEntity); } else if (placeableEntity.GetEntityType() == GroundEntity.EEntTypes.Spawner) { ZoneManager.Instance.CurrentGround.AddSpawner((GroundSpawner)placeableEntity); } }
public void RemoveEntity(GroundEntity ent) { if (ent == null) { return; } DiagManager.Instance.DevEditor.GroundEditor.Edits.Apply(new GroundEntityStateUndo(0)); if (ent.GetEntityType() == GroundEntity.EEntTypes.Character) { ZoneManager.Instance.CurrentGround.RemoveMapChar((GroundChar)ent); } else if (ent.GetEntityType() == GroundEntity.EEntTypes.Object) { ZoneManager.Instance.CurrentGround.RemoveObject((GroundObject)ent); } else if (ent.GetEntityType() == GroundEntity.EEntTypes.Marker) { ZoneManager.Instance.CurrentGround.RemoveMarker((GroundMarker)ent); } else if (ent.GetEntityType() == GroundEntity.EEntTypes.Spawner) { ZoneManager.Instance.CurrentGround.RemoveSpawner((GroundSpawner)ent); } }