UnitSpawner.Awake C# (CSharp) Method

Awake() public method

public Awake ( ) : void
return void
    public void Awake()
    {
        if (!Mathf.Approximately(Spawns.Sum(hS => hS.Chance), 1f))
            throw new UnityException(this.gameObject.name + ": Sum of chances must be == 1");

        animator = GetComponent<Animator>();
        units = new List<GameObject>();

        idle = new StateIdle(this);
        ready = new StateReady(this);
        wait = new StateWait(this);
        spawn = new StateSpawn(this);
        open = new StateOpen(this);
        push = new StatePush(this);
        close = new StateClose(this);

        ready.Wait = wait;
        wait.Spawn = spawn;
        spawn.Open = open;
        open.Push = push;
        push.Close = close;
        close.Ready = ready;

        currentState = ready;
        ready.OnStateEnter();
    }