void Update() // * * * * * * * * * * * * * * * * * * Update { if (moving) { if (!biting) // . . . . . . . . . . . . . . . . . If not biting and can move, move randomly, moves based on - or + scale { if (move) { if (this.transform.localScale.x < 0) { colliderA.AddForce(new Vector2(-Random.Range(50.0f, 100.0f), Random.Range(-10.0f, 30.0f))); } else { colliderA.AddForce(new Vector2(Random.Range(50.0f, 100.0f), Random.Range(-10.0f, 30.0f))); } soundManScript.PlaySound("angularmove", false, false, this.transform.position, 0.2f); move = false; } } if (bite) // . . . . . . . . . . . . . . . . . . If biting and player is in collider, hit player { if (!bitten) { if (hitPlayer) { if (nomming) { perDataScript.AddNearAngle(-1); } player.GetComponent <Player>().getHit(this.gameObject); } bitten = true; } nomming = false; } else { if (bitten) { bitten = false; } }// . . . . . . . . . . . . . . . . . . . . Delete if off edge of screen if (this.transform.localScale.x < 0) { if (this.transform.position.x < (Camera.main.ScreenToWorldPoint(new Vector3(0.0f, 0.0f, 0.0f)).x - 5.0f)) { Destroy(this.gameObject); } } else { if (this.transform.position.x > (Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, 0.0f, 0.0f)).x + 5.0f)) { Destroy(this.gameObject); } } } }