// Update is called once per frame void Update() { GameObject bombCheck = GameObject.Find("potato_man_1"); PotatoMan potatoScript = bombCheck.GetComponent <PotatoMan>(); if (potatoScript.bombCollected == false) { gameObject.SetActive(false); } else { gameObject.SetActive(true); } }
// Update is called once per frame void Update() { GameObject spawnDeath = GameObject.Find("potato_man_1"); PotatoMan potatoScript = spawnDeath.GetComponent <PotatoMan>(); if (potatoScript.spawnObstacles == false) { transform.position = _startPos; speed = 0; } else { speed = -7; } transform.Translate(speed * Time.deltaTime, 0, 0); if (transform.position.x <= -10.5) { transform.position = _startPos; } }