Getting ready

We need to define the template for the enemies to focus the next section on how to implement the main evolutionary algorithm. In this case, we will use a serializable class named EvolEnemy:

using UnityEngine;using UnityEngine.UI;[System.Serializable]public class EvolEnemy{  public Sprite sprite;  public int healthInit;  public int healthMax;  public int healthVariance;}

Get Unity 2018 Artificial Intelligence Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.