// Update is called once per frame protected void Update() { if (moving == true) { transform.position += (-Vector3.right * speed * Time.deltaTime); if (Time.time - lifeTimer >= lifeSpan) { Destroy(gameObject); } } if (attacking == true) { if (Mathf.Abs(GameEngine.Player.transform.position.x - transform.position.x) <= 10.0f) { egg.ReleaseEgg(speed); attacking = false; } } }