// Use this for initialization
    void Start()
    {
        Vector3 aVector;
        Vector3 bVector;

        player         = GameObject.Find("Player");
        Xwaypoints     = (waveConfig.GetWaypoints());
        waypoints      = new Vector3[2];
        waypoints[0].x = Xwaypoints[0].transform.position.x;
        waypoints[0].y = Xwaypoints[0].transform.position.y;
        waypoints[1].x = Xwaypoints[1].transform.position.x;
        waypoints[1].y = Xwaypoints[1].transform.position.y;
        //  Debug.Log(waypoints[0])

        // aVector.x = Random.Range(-8.5f, 8.5f);
        aVector.x      = player.transform.position.x + Random.Range(-0.1f, 0.1f);
        waypoints[0].x = aVector.x;
        waypoints[1].x = aVector.x;

        //  waypoints[1].transform.position = bVector;
        transform.position = waypoints[0];
        moveSpeed          = waveConfig.GetmoveSpeed();
        thisEnemyIndex     = GetComponent <enemy>().thisEnemyIndex;
        agent = FindObjectOfType <LaserAgent>();
    }
Exemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     waypoints          = waveConfig.GetWaypoints();
     transform.position = waypoints[0].transform.position;
     moveSpeed          = waveConfig.GetmoveSpeed();
     thisEnemyIndex     = GetComponent <enemy>().thisEnemyIndex;
     agent = FindObjectOfType <LaserAgent>();
 }
Exemplo n.º 3
0
 private IEnumerator SpawnAllEnemiesInWave(waveConfig waveConfig)
 {
     for (int i = 0; i < waveConfig.GetnumberOfEnemies(); i++)
     {
         var newEnemy = Instantiate(
             waveConfig.GetEnemyPrefab(),
             waveConfig.GetWaypoints()[0].transform.position,
             Quaternion.identity);
         newEnemy.GetComponent <EnemyPath>().SetWaveConfig(waveConfig);
         yield return(new WaitForSeconds(waveConfig.GettimeBetweenSpawns()));
     }
 }
Exemplo n.º 4
0
 private IEnumerator SpawnAllObstaclesinWaveRoutine(waveConfig particularWaveConfig)
 {
     for (int i = 0; i < particularWaveConfig.GetNumberOfObstaclesSpawned(); i++)
     {
         var newObstacle = Instantiate(
             particularWaveConfig.GetObstaclePrefab(),
             particularWaveConfig.GetWaypoints()[0].transform.position,
             Quaternion.identity);
         newObstacle.GetComponent <obstaclePath>().SetWaveConfig(particularWaveConfig);
         yield return(new WaitForSeconds(particularWaveConfig.GetTimeBetweenSpawns()));
     }
 }
    private IEnumerator SpawnAllEnemiesInWave(waveConfig waveConfig)
    {
        float aDelay = waveConfig.GettimeBetweenSpawns() / ((float)DifficultyLevel);

        for (int i = 0; i < waveConfig.GetnumberOfEnemies(); i++)
        {
            var newEnemy = Instantiate(
                waveConfig.GetEnemyPrefab(),
                waveConfig.GetWaypoints()[0].transform.position,
                Quaternion.identity);
            newEnemy.GetComponent <EnemyPath>().SetWaveConfig(waveConfig);
            yield return(new WaitForSeconds(aDelay));
        }
        // yield return new WaitForSeconds(waveConfig.FinalTime());
    }
Exemplo n.º 6
0
 // Use this for initialization
 void Start()
 {
     waypoints          = waveConfig.GetWaypoints();
     transform.position = waypoints[0].transform.position;
     moveSpeed          = waveConfig.GetmoveSpeed();
 }
Exemplo n.º 7
0
 // Start is called before the first frame update
 void Start()
 {
     waypoints          = particularWaveConfig.GetWaypoints();
     transform.position = waypoints[waypointIndex].transform.position;
 }