예제 #1
0
    protected override void OnInit()
    {
        WasAlive = true;

        Stamina   = Pawn.GetComponent <Stamina>();
        Abilities = Pawn.GetComponent <AbilityContainer>();

        Abilities.Init();

        this.InitList(ref AllModules);

        var foundModules = new List <AIModule>();

        foundModules.AddRange(GetComponentsInChildren <AIModule>());

        // Add Pawn modules, if they are present
        if (!Pawn.transform.IsChildOf(transform) && !transform.IsChildOf(Pawn.transform))
        {
            foundModules.AddRange(Pawn.GetComponentsInChildren <AIModule>());
        }

        foreach (var module in foundModules)
        {
            module.Init(this);
        }

        AllModules.AddRange(foundModules.Where(m => !m.DebugDisable));

        SwitchModule(PickBestModule());
    }