Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

Error CS0019

$
0
0
I need help I made a script which gives me error CS0019 for someone to help me and correct it, the script is: using UnityEngine; using System.Collections; public class EnemyBullet : MonoBehaviour { float speed; //the bullet speed Vector2 _direction; //the direction of the bullet bool isReady;//to know when the bullet direction is set //set default values in Awake function void Awake() { speed = 5f; isReady = false; } //Use this for initialization void Start () { } //Function to set the bullet's direction public void SetDirection(Vector2 Direction) { //set the direction normalized, to get an unit vector _direction = Direction.normalized; isReady = true;//set flag to true } // Update is called once per frame void Update () { if (isReady) { //get the bullet's current position Vector2 Position = transform.position; //compute the bullet's new position Position += _direction * speed * Time.deltaTime; //update the bullet's position transform.position = Position; //Next we need to remove the bullet from our game //if the bullet goes outside the screen //this is the bottom-left point of the screen Vector2 min = Camera.main.ViewportToWorldPoint (new Vector2 (0, 0)); //this is the top-right point of the screen Vector2 max = Camera.main.ViewportToWorldPoint (new Vector2 (1, 1)); //if the bullet goes outside the screen, then destroy it if ((transform.position.x < min.x) || (transform.position.x) || (transform.position.x < min.y) || (transform.position.y)) { Destroy (gameObject); } } } }

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>