private void Start() { player = FindObjectOfType <FrogBehaviour>(); startingPos = player.transform.position; background = FindObjectOfType <script>(); win = false; duration = 0.2f; startDuration = duration; counter = 0; //topCounter = 200; }
//public GameObject lose; // Use this for initialization void Start() { rgb = GetComponent <Rigidbody2D>(); goal = FindObjectOfType <Goal>(); frog = FindObjectOfType <FrogBehaviour>(); //dir = Random.RandomRange(-1, 1); //speed= Random.RandomRange(4, 7); speed = 3; //lose.SetActive(false); //PlayerPrefs.GetInt("HigherScore",0); positionsY0 = new float[2] { -3.02f, 1.3f }; positionsY1 = new float[2] { -0.8f, 3.57f }; positionsX = new float[2] { -10.82f, 8.91f }; //Izquierda a derecha if (tipo == 0) { dir = 1; actualPosY = positionsY0[Random.Range(0, positionsY0.Length)]; actualPosX = positionsX[0]; } //Derecha a izquierda if (tipo == 1) { dir = -1; actualPosY = positionsY1[Random.Range(0, positionsY1.Length)]; actualPosX = positionsX[1]; } this.transform.position = new Vector2(actualPosX, actualPosY); }