About 'WaveConfig For Path & Speed'!

In this video (objectives)…

  1. Separate the movement speed and path away from the enemy prefab.
  2. Dig deeper into using paramaters on a public method to set our wave config.

After watching (learning outcomes)… Able to feed the wave config information to the enemy path.

(Unique Video Reference: 16_LD_CUD)

We would love to know…

  • What you found good about this lecture?
  • What we could do better?

Remember that you can reply to this topic, or create a new topic. The easiest way to create a new topic is to follow the link in Resources. That way the topic will…

  • Be in the correct forum (for the course).
  • Be in the right sub-forum (for the section)
  • Have the correct lecture tag.

Enjoy your stay in our thriving community!

So far, so good. Looking forward to the rest of this section! Like seeing the “plan moving forward” breakdowns every few lessons. Bumping up against the edge of the 2018 content, it gives me a direction to focus my “get-ahead” so I have something of a small code-review as things progress while what I’ve done is fresh in my mind.

Keep up the great work!

1 Like

Hey Rick,

I have so far enjoyed the class immensely, it is very informative and useful. I admit to not paying full attention in the beginning like many students and starting the course on Unity 2018.3+, this has lead to some pretty substantial issues throughout the course. I found a strange workaround that you may want to add to the end of this section for people who made the same mistake I did. If you leave the " waveConfig "and “waypoints” lists serialized as listed below (in the EnemyPathing.cs Script), you don’t get the issue that doesn’t allow your instantiated enemies to move.

using System.Collections.Generic;
using UnityEngine;

public class EnemyPathing : MonoBehaviour
{
    //connecting the script for which wave we are dealing with to the enemy pathing script.
    [SerializeField] WaveConfig waveConfig; //IF YOU LEAVE THIS SERIALIZED IN THE MORE UP TO DATE VERSIONS OF UNITY, IT WON'T CAUSE SOME OF THE ISSUES
    [SerializeField] List<Transform> waypoints; //IF YOU LEAVE THIS SERIALIZED IN THE MORE UP TO DATE VERSIONS OF UNITY, IT WON'T CAUSE SOME OF THE ISSUES

    int waypointIndex = 0;

    // Start is called before the first frame update
    void Start()
    {
        transform.position = waypoints[waypointIndex].transform.position;
    }

    // Update is called once per frame
    void Update()
    {
        Move();
        waypoints = waveConfig.GetWayPoints();
    }

    public void SetWaveConfig(WaveConfig waveConfig)
    {
        this.waveConfig = waveConfig;

    }

    private void Move()
    {
        if (waypointIndex <= waypoints.Count - 1)
        {
            var targetPosition = waypoints[waypointIndex].transform.position;
            var movementThisFrame = waveConfig.GetMoveSpeedOfEnemies() * Time.deltaTime;
            transform.position = Vector2.MoveTowards
                (transform.position, targetPosition, movementThisFrame);

            if (transform.position == targetPosition)
            {
                waypointIndex++;
            }

        }
        else
        {
            waypointIndex = 0;

        }
    }
}

“What you found good about this lecture?”
It feels like one of those “pro” topics I’d love to understand and master.

“What we could do better”
Explaining it. I’ve been following all the lectures with no problems. When difficult or confusing I would just stop and take my time to understand what’s going on. But, after reviewing the comments from other users, I can with say with good certainty that this lecture is not explained well. Something about the language use and the concepts applied. Please, make this lecture more digestible, or perhaps link us to somewhere else to have an additional lecture about this?

Course is awesome so far! Thanks for everything.

1 Like

Privacy & Terms