Professional Documents
Culture Documents
Updated Script BRSPart3
Updated Script BRSPart3
Collections;
using System.Collections.Generic;
using UnityEngine;
[Header("Map Settings")]
public int MapSize = 8;
[Range(1,9)]
public int DropZoneRange = 8;
[Header("Plane Settings")]
public GameObject BRS_PlaneSpawn;
public float BRS_PlaneAltitude;
public float BRS_PlaneAirspeed = 100f;
void Start ()
{
Debug.Break();
PD_L = new Vector3[9];
PD_R = new Vector3[9];
do
{
Debug.Log("Planing optimal Route");
//Pick a Random startpoint
startFlightIndex = Random.Range(0, PD_L.Length);
startFlight = PD_L[startFlightIndex];
PlaneStart.transform.position = startFlight;
PlaneStop.transform.position = endFlight;
PlaneStart.transform.LookAt(PlaneStop.transform);
RaycastHit objectHit;
if (Physics.Raycast(PlaneStart.transform.position,
PlaneStart.transform.forward, out objectHit, 8000))
{
//Debug.Break();
GameObject.Destroy(objectHit.collider.gameObject);
}
numberOfAttempts++;
}
} while (VerifiedPath != true);
}
void LateUpdate()
{
if (VerifiedPath)
{
Debug.Break();
SpawnPlane();
}
}
void SpawnPlane()
{
PlaneStart.transform.LookAt (PD_R[endFlightIndex]);
Instantiate(BRS_PlaneSpawn, PlaneStart.transform.position,
PlaneStart.transform.rotation);
Debug.Break();
//VerifiedPath = false;
}
}