<commit_before>using UnityEngine;
using System.Collections.Generic;

namespace TenPN.DecisionFlex.Demos
{
    [AddComponentMenu("TenPN/DecisionFlex/Demos/Timesliced/GruntConsiderationContextFactory")]
    public class GruntConsiderationContextFactory : ConsiderationContextFactory
    {
        // returns considerations of this grunt
        public override IList<IConsiderationContext> AllContexts(Logging loggingSetting)
        {
            var distanceToHealth = 
                Mathf.Max(0f, 
                          (m_healthArea.transform.position - transform.position).magnitude 
                          - m_healthArea.radius);
            m_context.SetContext("DistanceToHealth", distanceToHealth);

            var distanceToEnemy = 
                Mathf.Max(0f, 
                          (m_enemyArea.transform.position - transform.position).magnitude 
                          - m_enemyArea.radius);
            m_context.SetContext("DistanceToEnemy", distanceToEnemy);

            m_context.SetContext("HP", m_grunt.NormalizedHP);
            
            return m_allContexts;
        }

        //////////////////////////////////////////////////

        // avoid allocations by caching everything we can reuse
        private ConsiderationContextDictionary m_context = 
            new ConsiderationContextDictionary();
        private IConsiderationContext[] m_allContexts = new IConsiderationContext[1];

        private CircleCollider2D m_healthArea;
        private CircleCollider2D m_enemyArea;
        private Grunt m_grunt;

        //////////////////////////////////////////////////

        private void Start()
        {
            m_healthArea = (CircleCollider2D)GameObject.FindWithTag("Health").collider2D;
            m_enemyArea = (CircleCollider2D)GameObject.FindWithTag("Enemy").collider2D;
            m_grunt = transform.parent.GetComponent<Grunt>();
            m_allContexts[0] = m_context;
        }
    }
}<commit_msg>GruntConsiderationContextFactory can use awake not start<commit_after>using UnityEngine;
using System.Collections.Generic;

namespace TenPN.DecisionFlex.Demos
{
    [AddComponentMenu("TenPN/DecisionFlex/Demos/Timesliced/GruntConsiderationContextFactory")]
    public class GruntConsiderationContextFactory : ConsiderationContextFactory
    {
        // returns considerations of this grunt
        public override IList<IConsiderationContext> AllContexts(Logging loggingSetting)
        {
            var distanceToHealth = 
                Mathf.Max(0f, 
                          (m_healthArea.transform.position - transform.position).magnitude 
                          - m_healthArea.radius);
            m_context.SetContext("DistanceToHealth", distanceToHealth);

            var distanceToEnemy = 
                Mathf.Max(0f, 
                          (m_enemyArea.transform.position - transform.position).magnitude 
                          - m_enemyArea.radius);
            m_context.SetContext("DistanceToEnemy", distanceToEnemy);

            m_context.SetContext("HP", m_grunt.NormalizedHP);
            
            return m_allContexts;
        }

        //////////////////////////////////////////////////

        // avoid allocations by caching everything we can reuse
        private ConsiderationContextDictionary m_context = 
            new ConsiderationContextDictionary();
        private IConsiderationContext[] m_allContexts = new IConsiderationContext[1];

        private CircleCollider2D m_healthArea;
        private CircleCollider2D m_enemyArea;
        private Grunt m_grunt;

        //////////////////////////////////////////////////

        private void Awake()
        {
            m_healthArea = (CircleCollider2D)GameObject.FindWithTag("Health").collider2D;
            m_enemyArea = (CircleCollider2D)GameObject.FindWithTag("Enemy").collider2D;
            m_grunt = transform.parent.GetComponent<Grunt>();
            m_allContexts[0] = m_context;
        }
    }
}
{'fraction_non_alphanumeric': 0.11856317508163777, 'fraction_numerical': 0.005023863350916855, 'mean_word_length': 1.9452662721893492, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2368853', 'n_tokens_mistral': 1037, 'n_tokens_neox': 986, 'n_words': 163}