Witam,tworzę sobie właśnie grę w stylu angry birds z tego poradnika http://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/making-angry-birds-style-game-pt2
Ale napotykam pewne problemy,ponieważ w 22 minucie gdy meteor wychodzi poza kwadrat to powinno się wszystko zresetować,ale tak sie nie dzieje.
Poniżej zamieszczam skrypt na Resetowanie
using UnityEngine;
using System.Collections;
public class Resettter : MonoBehaviour {
public Rigidbody2D projectile;
public float resetSpeed = 0.025f;
private float resetSpeedSqr;
private SpringJoint2D spring;
// Use this for initialization
void Start () {
resetSpeedSqr = resetSpeed * resetSpeed;
spring = projectile.GetComponent<SpringJoint2D> ();
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown (KeyCode.R))
{
Reset();
}
if (spring == null && projectile.velocity.sqrMagnitude < resetSpeedSqr)
{
Reset();
}
}
void OnTriggerExit2D(Collider2D other)
{
if (other.rigidbody == projectile)
{
Reset();
}
}
void Reset()
{
Application.LoadLevel (Application.loadedLevel);
}
}