jump-game/Jump Game/Assets/Scripts/World/Game.cs

31 lines
815 B
C#
Raw Normal View History

2020-04-29 21:04:48 +00:00
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using UnityEngine;
using UnityEngine.UI;
2022-04-01 05:47:42 +00:00
public class Game : MonoBehaviour
2020-04-29 21:04:48 +00:00
{
public Button button;
private GameObject player;
private Rigidbody2D rbody;
private GameObject camera;
void Start()
{
camera = GameObject.FindWithTag("MainCamera");
player = GameObject.FindWithTag("Player");
rbody = player.GetComponent<Rigidbody2D>();
button.onClick.AddListener(Respawn);
}
void Respawn()
{
rbody.velocity = new Vector3(0, 0, 0);
2022-04-01 05:47:42 +00:00
player.transform.position = new Vector3(-60.5f, 9.3f, -0.16f);
camera.transform.position = new Vector3(-51.7597f, 14.07621f, -32.28906f);
2020-04-29 21:04:48 +00:00
//CameraController.storedPosition = 0f;
}
}