public override TaskStatus OnUpdate()
    {
        int index;

        storeGameObject.Value = FindNearest.FindNearestGameObject(pathPointList.Value, position.Value, out index);
        storeIndex.Value      = index;

        return(TaskStatus.Success);
    }
Ejemplo n.º 2
0
        public override void UpdateSensor()
        {
            var state = memory.GetWorldState();
            var type  = typeof(T).ToString();

            bool hasAvailable = ts.Any(Criteria);

            state.Set($"Has Role {type}", hasAvailable);

            if (hasAvailable)
            {
                var query = from x in ts
                            where Criteria(x)
                            select x.gameObject;
                var list = query.ToList();

                int index;
                var nearest = FindNearest.FindNearestGameObject(list, transform.position, out index);
                state.Set($"Nearest {type}", nearest.GetComponent <T>());
            }
        }