This commit is contained in:
2021-07-23 17:00:30 +02:00
parent ebc97d0d2b
commit 4d0551d339
3 changed files with 30 additions and 12 deletions

View File

@@ -226,6 +226,7 @@ MonoBehaviour:
m_Bits: 32
sfx: {fileID: 1499575167}
mouse: {fileID: 1949375702}
sr: {fileID: 231727548}
--- !u!50 &231727551
Rigidbody2D:
serializedVersion: 4

View File

@@ -8,6 +8,9 @@ public class MenuPlay : MonoBehaviour
public LayerMask contactFilter;
public AudioSource sfx;
public MenuMouse mouse;
public SpriteRenderer sr;
private bool hover = false;
private bool previous_hover = false;
// Start is called before the first frame update
void Start()
{
@@ -17,11 +20,25 @@ public class MenuPlay : MonoBehaviour
// Update is called once per frame
void Update()
{
if (Input.GetMouseButtonDown(0)){
if(Physics2D.CircleCast(mouse.pos, 1f, Vector2.zero, 0f, contactFilter)){
if(Physics2D.CircleCast(mouse.pos, 1f, Vector2.zero, 0f, contactFilter)){
if (Input.GetMouseButtonDown(0)){
sfx.Play();
SceneManager.LoadScene("Tutorial");
}
previous_hover = hover;
hover = true;
} else {
previous_hover = hover;
hover = false;
}
if (hover != previous_hover) {
if(hover) {
sr.color = new Color(202f / 255f, 202f / 255f, 242f / 255f, 201f / 255f);
} else {
sr.color = new Color(149f / 255f, 189f / 255f, 253f / 255f, 201f / 255f);
}
}
}
}