Skip to content

Commit

Permalink
Got main menu looking amazing
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviathevampire committed Feb 5, 2023
1 parent 46a3df0 commit 76ca4c6
Show file tree
Hide file tree
Showing 13 changed files with 397 additions and 8 deletions.
17 changes: 14 additions & 3 deletions Assets/Contact.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
using System;
using UnityEngine;

public class Contact : MonoBehaviour {

public GameObject winPanel;
private Rigidbody2D _rb;

private void Start() {
_rb = GetComponent<Rigidbody2D>();
}

private void OnTriggerEnter2D(Collider2D col) {
if (!col.gameObject.CompareTag("Plug")) return;
col.gameObject.GetComponentInChildren<LineController>().plugged = true;
col.gameObject.GetComponentInChildren<LineController>().timer.timerIsRunning = false;
var lineController = col.gameObject.GetComponentInChildren<LineController>();
col.gameObject.GetComponent<FixedJoint2D>().connectedBody = _rb;
col.gameObject.GetComponent<FixedJoint2D>().connectedAnchor = new Vector2(-0.2f, 0.1f);
lineController.plugged = true;
lineController.timer.timerIsRunning = false;
// Invoke(nameof(ActivateWinPanel), 2f);
}

private void ActivateWinPanel() {
winPanel.SetActive(true);
}

Expand Down
Binary file added Assets/Gfx/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
124 changes: 124 additions & 0 deletions Assets/Gfx/logo.png.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Assets/Prefabs/Room.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -1857,9 +1857,9 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6378293532928595158}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 27.984, y: -3.15, z: 0}
m_LocalScale: {x: 2, y: 2, z: 1}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 28.424997, y: -2.8456001, z: 0}
m_LocalScale: {x: 1.1, y: 1.58, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 7873170991585880319}
Expand Down
99 changes: 98 additions & 1 deletion Assets/Scenes/Game.unity
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,83 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1058821529}
m_CullTransparentMesh: 1
--- !u!1 &1209871868
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1209871869}
- component: {fileID: 1209871870}
m_Layer: 0
m_Name: GameObject
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1209871869
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1209871868}
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: 1393013044}
m_RootOrder: -1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!61 &1209871870
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1209871868}
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_ForceSendLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ForceReceiveLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ContactCaptureLayers:
serializedVersion: 2
m_Bits: 4294967295
m_CallbackLayers:
serializedVersion: 2
m_Bits: 4294967295
m_IsTrigger: 0
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: 0.26608944, y: 0}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0, y: 0}
oldSize: {x: 0, y: 0}
newSize: {x: 0, y: 0}
adaptiveTilingThreshold: 0
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
serializedVersion: 2
m_Size: {x: 0.46782112, y: 1}
m_EdgeRadius: 0
--- !u!1 &1275444373
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1217,6 +1294,11 @@ GameObject:
m_CorrespondingSourceObject: {fileID: 6378293532928595158, guid: 9e58726673eadc44eb88decaf9b93e4c, type: 3}
m_PrefabInstance: {fileID: 493535962621856055}
m_PrefabAsset: {fileID: 0}
--- !u!4 &1393013044 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 7695096060863478958, guid: 9e58726673eadc44eb88decaf9b93e4c, type: 3}
m_PrefabInstance: {fileID: 493535962621856055}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1393013049
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1687,6 +1769,18 @@ PrefabInstance:
propertyPath: anchorPosition
value:
objectReference: {fileID: 1502658496}
- target: {fileID: 5903465201437275450, guid: 9e58726673eadc44eb88decaf9b93e4c, type: 3}
propertyPath: m_ConnectedAnchor.x
value: 48.754997
objectReference: {fileID: 0}
- target: {fileID: 5903465201437275450, guid: 9e58726673eadc44eb88decaf9b93e4c, type: 3}
propertyPath: m_ConnectedAnchor.y
value: 20.9144
objectReference: {fileID: 0}
- target: {fileID: 7695096060863478958, guid: 9e58726673eadc44eb88decaf9b93e4c, type: 3}
propertyPath: m_LocalPosition.x
value: 28.431
objectReference: {fileID: 0}
- target: {fileID: 7873170991585880319, guid: 9e58726673eadc44eb88decaf9b93e4c, type: 3}
propertyPath: m_RootOrder
value: 1
Expand Down Expand Up @@ -1737,7 +1831,10 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedGameObjects:
- targetCorrespondingSourceObject: {fileID: 7695096060863478958, guid: 9e58726673eadc44eb88decaf9b93e4c, type: 3}
insertIndex: -1
addedObject: {fileID: 1209871869}
m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 6378293532928595158, guid: 9e58726673eadc44eb88decaf9b93e4c, type: 3}
insertIndex: -1
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Movement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private void TogglePickup() {

private void FixedUpdate() {

if (plugJoint.enabled) {
if (plugJoint.enabled && plugJoint.connectedBody == _rb) {
var plugTargetPos = (Vector2)plugPoint.localPosition;
if (_facingLeft) plugTargetPos.x = -plugTargetPos.x;
plugJoint.connectedAnchor =
Expand Down
8 changes: 8 additions & 0 deletions Assets/Scripts/UI Gradients.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions Assets/Scripts/UI Gradients/UICornerGradient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//Taken from https://github.com/azixMcAze/Unity-UIGradient with credit
using UnityEngine;
using UnityEngine.UI;

[AddComponentMenu("UI/Effects/4 Corners Gradient")]
public class UICornersGradient : BaseMeshEffect {
public Color m_topLeftColor = Color.white;
public Color m_topRightColor = Color.white;
public Color m_bottomRightColor = Color.white;
public Color m_bottomLeftColor = Color.white;

public override void ModifyMesh(VertexHelper vh) {
if (!enabled) return;
var rect = graphic.rectTransform.rect;
var localPositionMatrix = UIGradientUtils.LocalPositionMatrix(rect, Vector2.right);

var vertex = default(UIVertex);
for (var i = 0; i < vh.currentVertCount; i++) {
vh.PopulateUIVertex(ref vertex, i);
var normalizedPosition = localPositionMatrix * vertex.position;
vertex.color *= UIGradientUtils.Bilerp(m_bottomLeftColor, m_bottomRightColor, m_topLeftColor,
m_topRightColor, normalizedPosition);
vh.SetUIVertex(vertex, i);
}
}
}
11 changes: 11 additions & 0 deletions Assets/Scripts/UI Gradients/UICornerGradient.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions Assets/Scripts/UI Gradients/UIGradient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//Taken from https://github.com/azixMcAze/Unity-UIGradient with credit
using UnityEngine;
using UnityEngine.UI;

[AddComponentMenu("UI/Effects/Gradient")]
public class UIGradient : BaseMeshEffect {
public Color m_color1 = Color.white;
public Color m_color2 = Color.white;
[Range(-180f, 180f)] public float m_angle;
public bool m_ignoreRatio = true;

public override void ModifyMesh(VertexHelper vh) {
if (!enabled) return;
var rect = graphic.rectTransform.rect;
var dir = UIGradientUtils.RotationDir(m_angle);

if (!m_ignoreRatio)
dir = UIGradientUtils.CompensateAspectRatio(rect, dir);

var localPositionMatrix = UIGradientUtils.LocalPositionMatrix(rect, dir);

var vertex = default(UIVertex);
for (var i = 0; i < vh.currentVertCount; i++) {
vh.PopulateUIVertex(ref vertex, i);
var localPosition = localPositionMatrix * vertex.position;
vertex.color *= Color.Lerp(m_color2, m_color1, localPosition.y);
vh.SetUIVertex(vertex, i);
}
}
}
3 changes: 3 additions & 0 deletions Assets/Scripts/UI Gradients/UIGradient.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 76ca4c6

Please sign in to comment.