Skip to content

Commit

Permalink
Add demo for glider for Evans rules
Browse files Browse the repository at this point in the history
  • Loading branch information
wfowler1 committed Apr 25, 2024
1 parent 8d8a309 commit 7ed896a
Show file tree
Hide file tree
Showing 3 changed files with 306 additions and 1 deletion.
279 changes: 279 additions & 0 deletions Assets/Objects/UI/UIRoot.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,273 @@ RectTransform:
m_AnchoredPosition: {x: 40, y: -80}
m_SizeDelta: {x: 360, y: 40}
m_Pivot: {x: 0, y: 1}
--- !u!1 &1780534048715817021
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7948281243533085820}
- component: {fileID: 7701729552564752241}
- component: {fileID: 8768929978860031869}
m_Layer: 5
m_Name: Text (TMP)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &7948281243533085820
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1780534048715817021}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 5928330275372727177}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &7701729552564752241
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1780534048715817021}
m_CullTransparentMesh: 1
--- !u!114 &8768929978860031869
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1780534048715817021}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: Evans Glider
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4281479730
m_fontColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 24
m_fontSizeBase: 24
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &1801763052912339468
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5928330275372727177}
- component: {fileID: 6806752260868826070}
- component: {fileID: 7552822080388774282}
- component: {fileID: 891653614451899058}
m_Layer: 5
m_Name: EvansGliderButton
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &5928330275372727177
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1801763052912339468}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 7948281243533085820}
m_Father: {fileID: 605698986000459351}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -160}
m_SizeDelta: {x: 0, y: 40}
m_Pivot: {x: 0, y: 0}
--- !u!222 &6806752260868826070
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1801763052912339468}
m_CullTransparentMesh: 1
--- !u!114 &7552822080388774282
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1801763052912339468}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!114 &891653614451899058
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1801763052912339468}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Navigation:
m_Mode: 3
m_WrapAround: 0
m_SelectOnUp: {fileID: 0}
m_SelectOnDown: {fileID: 0}
m_SelectOnLeft: {fileID: 0}
m_SelectOnRight: {fileID: 0}
m_Transition: 1
m_Colors:
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
m_ColorMultiplier: 1
m_FadeDuration: 0.1
m_SpriteState:
m_HighlightedSprite: {fileID: 0}
m_PressedSprite: {fileID: 0}
m_SelectedSprite: {fileID: 0}
m_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_SelectedTrigger: Selected
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 7552822080388774282}
m_OnClick:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 3269660516333964131}
m_TargetAssemblyTypeName: PresetsMenu, Assembly-CSharp
m_MethodName: OnEvansGliderClicked
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!1 &2143611283524672426
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -3949,6 +4216,10 @@ PrefabInstance:
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.data[0].m_MethodName
value: OnB4163S40804DClicked
objectReference: {fileID: 0}
- target: {fileID: 4031635562773390548, guid: 8d5e151a0bde63b44a8ebac44b921aad, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4134890027404094659, guid: 8d5e151a0bde63b44a8ebac44b921aad, type: 3}
propertyPath: m_AnchoredPosition.y
value: -280
Expand Down Expand Up @@ -4072,8 +4343,16 @@ PrefabInstance:
- targetCorrespondingSourceObject: {fileID: 803348358928203557, guid: 8d5e151a0bde63b44a8ebac44b921aad, type: 3}
insertIndex: 0
addedObject: {fileID: 647585523203815330}
- targetCorrespondingSourceObject: {fileID: 6768829574570626307, guid: 8d5e151a0bde63b44a8ebac44b921aad, type: 3}
insertIndex: -1
addedObject: {fileID: 5928330275372727177}
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 8d5e151a0bde63b44a8ebac44b921aad, type: 3}
--- !u!224 &605698986000459351 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 6768829574570626307, guid: 8d5e151a0bde63b44a8ebac44b921aad, type: 3}
m_PrefabInstance: {fileID: 6163271362701945684}
m_PrefabAsset: {fileID: 0}
--- !u!114 &3269660516333964131 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 8712350148901675063, guid: 8d5e151a0bde63b44a8ebac44b921aad, type: 3}
Expand Down
20 changes: 19 additions & 1 deletion Assets/Scripts/Presets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ public static void SimpleGlider3D(this GameOfLife gol, int xAxis = 0, int yAxis
gol.SetStateByAxes(true, xAxis, 1, yAxis, 9, zAxis, 2);
gol.SetStateByAxes(true, xAxis, 2, yAxis, 9, zAxis, 2);

gol.currentBehavior = "Simple glider 3D";
gol.currentBehavior = "Simple Glider 3D";
}

public static void Glider4555(this GameOfLife gol, int xAxis = 0, int yAxis = 1, int zAxis = 2)
Expand Down Expand Up @@ -522,6 +522,24 @@ public static void GliderB5S47(this GameOfLife gol, int xAxis = 0, int yAxis = 1
gol.currentBehavior = "B5/S4,7 Glider";
}

public static void EvansGlider(this GameOfLife gol, int xAxis = 0, int yAxis = 1, int zAxis = 2)
{
gol.EvansRules();
gol.SetDimensions(xAxis, 5, yAxis, 16, zAxis, 5);
gol.wrap = true;

gol.Clear();

gol.SetStateByAxes(true, xAxis, 1, yAxis, 0, zAxis, 1);
gol.SetStateByAxes(true, xAxis, 1, yAxis, 0, zAxis, 2);
gol.SetStateByAxes(true, xAxis, 2, yAxis, 0, zAxis, 1);
gol.SetStateByAxes(true, xAxis, 2, yAxis, 0, zAxis, 2);
gol.SetStateByAxes(true, xAxis, 2, yAxis, 2, zAxis, 3);
gol.SetStateByAxes(true, xAxis, 3, yAxis, 2, zAxis, 2);

gol.currentBehavior = "Evans Glider";
}

private static void SetDimensions(this GameOfLife gol, int xAxis, int x, int yAxis = -1, int y = 1, int zAxis = -1, int z = 1, int wAxis = -1, int w = 1)
{
int width = 1;
Expand Down
8 changes: 8 additions & 0 deletions Assets/Scripts/UI/PresetsMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -355,4 +355,12 @@ public void OnB5S47GliderClicked()
root.gameCamera.distance = 32 * 1.6f;
HideMenuAndDoUpdates();
}

public void OnEvansGliderClicked()
{
root.gameBehaviour.game.EvansGlider();
root.gameBehaviour.Refresh();
root.gameCamera.distance = 16 * 1.6f;
HideMenuAndDoUpdates();
}
}

0 comments on commit 7ed896a

Please sign in to comment.