void Start() { input = InputSwitch.get(); input_track = LaserTracker.get(); carrier = gameObject; //default pool //for(int i = 0; i < 30; i++){ add(); } kill(); }
protected void update_Lasers() { LaserTracker tracker = LaserTracker.get(); if (tracker == null) { return; } Vector2[] points = LaserTracker.get().getLasers(); int laserIdx = 0; //on clear les anciens while (laserPositions[laserIdx].x > -20f && laserIdx < laserPositions.Length) { laserPositions[laserIdx].x = LaserTracker.UNUSED_POSITION.x; laserPositions[laserIdx].y = LaserTracker.UNUSED_POSITION.y; laserIdx++; } //on choppe les nouveaux lasers laserIdx = 0; for (int i = 0; i < points.Length; i++) { //on prend pas les points 'null' if (points[i].x < -20f) { continue; } //transform la coord du laser dans l'écran vers le monde temp.x = (float)points[i].x; temp.y = (float)points[i].y; temp.z = -cam.transform.position.z; laserPositions[laserIdx] = cam.ScreenToWorldPoint(temp); laserIdx++; } }