#Hey, I'm having trouble getting my head

1 messages · Page 1 of 1 (latest)

knotty sluice
#
using UnityEngine;
[System.Serializable]

public class Waypoints {
     public Transform[] points;
}```
#
    public int waypointIndex = 0;
    public static Transform points;
    private Transform[] pointsToCalculate;

    // Calculating the length of the path
    public static float totalLength = 0;
    public int counter, calculatePath = 0;

    void Start ()
    {
        counter = waypoint.Length;
        StartCoroutine(CalculateWaypoints());
        //PathLength();
        
    }


    IEnumerator CalculateWaypoints()
    {
        Waypoints waypoints = waypoint[waypointIndex];

        for (int i = 0; i < counter; i++)
        {
            WayPoints();    
        }
    }```
#

I worked on this a lot while I was tired so I'm not even sure what state this is in

#

The various path from this will be used by the enemy class

            {
                if(enemy.enemySpawn != null)
                {
                    //spawnPoint = enemy.enemySpawn;
                }
                else
                {
                    spawnPoint = defaultSpawnPoint;
                }
                Refactor(enemy);

                yield return new WaitForSeconds(1.0f / enemy.enemyRate);
            }```
remote turret
#

your code does not make it very clear what exactly you are trying to achieve. please actually explain what you are trying to do

knotty sluice
#

It's a TD game, I had a class called "Wavespawner" which I'm now trying to edit to include multiple paths i maay create... but I don't want to have to edit all my movement scripts... so I'm hoping to feed "Spawnpoint & child elements" which is the path it will follow

#

I calculate the length of the path to use elsewhere in my code

#

I'm just confused at how I reference waypoint[i] to create "pathOne" > [i]...

remote turret
#

yeah that isn't really making it any clearer

knotty sluice
#

🤣 damn

#

should I pastebin the whole script?

#

Hopefully this is better?