GeoJam2021/Assets/Scripts/MenuMouse.cs

47 lines
1.1 KiB
C#
Raw Permalink Normal View History

2021-07-22 20:09:52 +02:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class MenuMouse : MonoBehaviour
{
public Vector3 pos;
// Start is called before the first frame update
void Start()
{
pos.y -= 4.69f;
pos.x -= 8.66f;
}
// Update is called once per frame
void Update()
{
2021-07-24 13:13:22 +02:00
if (Application.platform == RuntimePlatform.WebGLPlayer){
pos.x += Input.GetAxisRaw("Mouse X") * Time.deltaTime * 40f;
pos.y += Input.GetAxisRaw("Mouse Y") * Time.deltaTime * 40f;
}
else{
pos.x += Input.GetAxisRaw("Mouse X") * Time.deltaTime * 10f;
pos.y += Input.GetAxisRaw("Mouse Y") * Time.deltaTime * 10f;
}
2021-07-22 20:09:52 +02:00
pos.z = -8f;
if (pos.x > 8.62f){
pos.x = 8.62f;
}
if (pos.x < -8.62f){
pos.x = -8.62f;
}
if (pos.y > 4.81f){
pos.y = 4.81f;
}
if (pos.y < -4.68f){
pos.y = -4.68f;
}
transform.position = pos;
}
public void play(){
SceneManager.LoadScene("Tutorial");
}
}