Esempio n. 1
0
        private Agent _CreateComponent(IBrain brain, Body body, List <IAction> actions, List <ISoul> souls = null)
        {
            List <IManipulatable> manipulatables = GetChildrenManipulatables();

            for (int i = 0; i < manipulatables.Count; i++)
            {
                manipulatables[i].SetManipulatableId(i); // just an ID
            }

            if (souls == null)
            {
                souls = new List <ISoul>()
                {
                    new GluttonySoul()
                };
            }

            body.Init(manipulatables, actions);
            brain.Init(
                manipulatables
                .Where(m => m.GetManipulatableDimention() > 0)
                .Select(m => m.GetManipulatableDimention()).ToList(),
                actions,
                souls);
            this.brain = brain;
            this.body  = body;
            return(this);
        }