using System.Collections; using System.Collections.Generic; using UnityEngine; public class Kasa : MonoBehaviour { public float hiz; public Transform sise; // Update is called once per frame void Update() { if(Input.GetKey(KeyCode.LeftArrow)) { transform.Translate (-hiz,0f,0f); } if(Input.GetKey(KeyCode.RightArrow)) { transform.Translate (hiz,0f,0f); } } void OnCollisionEnter2D(Collision2D temas) { float random = Random.Range(-8f,8f); if (temas.gameObject.tag == "bottle") { sise.position = new Vector3(random,0f,0f); } } }