void OnMouseOver() { if (Input.GetMouseButtonDown(0)) { Sprite goal = Resources.Load("goal", typeof(Sprite)) as Sprite; GameObject.Find("Player").GetComponent <PlayerContllore>().setStartMove(1); if (GetComponent <SpriteRenderer>().sprite == goal) { SceneContlloer.scenechenge(1); } Destroy(this.gameObject); } }
void Update() { if (start) { this.transform.position += transform.right * Time.deltaTime * moveSpeed; } if (!GetComponent <SpriteRenderer>().isVisible) { if (delete) { SceneContlloer.scenechenge(1); } } else { delete = true; } }