// Update is called once per frame void FixedUpdate() { rb = GetComponent<Rigidbody> (); rb.velocity = new Vector3 (Input.GetAxis ("Horizontal"), 0, Input.GetAxis ("Vertical")) * speed; Boundary1 boundary = new Boundary1 (); rb.transform.position = new Vector3 ( Mathf.Clamp (rb.position.x, boundary.xMin, boundary.xMax), 0.0f, Mathf.Clamp (rb.position.z, boundary.zMin, boundary.zMax) ); rb.rotation = Quaternion.Euler (0.0f, 0.0f, rb.velocity.x * tilt); }
// Use this for initialization void Start() { player = GameObject.Find ("Player"); currenthealth = maxhealth; GameObject enemytextobj = GameObject.Find ("EnemyText"); enemytext = enemytextobj.GetComponent<Text> (); enemytext.text = "Enemy Health:" + currenthealth; GameObject enemyhealthbarobj =GameObject.Find ("EnemyHealthbar"); enemyhealthbar = enemyhealthbarobj.GetComponent<Image> (); enemyhealthbar.fillAmount = 0; // enemyhealthbar =(Image) GameObject.Find ("EnemyHealthbar"); //gun1shotoffset = transform.position - gun1shotposition.position; boundary = new Boundary1 (); bossrigidbody = gameObject.GetComponent<Rigidbody> (); GameObject GameControllerObject = GameObject.FindWithTag ("GameController"); if (GameControllerObject != null) { gamecontroller = GameControllerObject.GetComponent <SinglePlayerGameController> (); } if (gamecontroller == null) { Debug.Log ("Cannot find 'GameController' script"); } //meshRenderer = gameObject.AddComponent<MeshRenderer>(); StartCoroutine(SpawnShots ()); GetComponent<Animation> ().Play (); move = new Vector3(0.5f, 0f, 0); bossrigidbody.velocity= move * -2.0f; }