Пример #1
0
        void Awake()
        {
            currentTile = Josh.World.worldInstance
                          .GetCellFromPosition(new Vector2(transform.position.x, transform.position.z))
                          .GetWorldTile();
            currentTile?.RegisterEntity(this);

            //stepables    = GetComponents<ISteppable>();
            StatusSteps = GetComponents <IStatusStep>();
            MoveSteps   = GetComponents <IMoveStep>();
            EatSteps    = GetComponents <IEatStep>();

            movementInfluencers = GetComponents <IMoveInfluencer>();
            cohesion            = GetComponent <MoveInfluencer_Cohesion>();
            alignment           = GetComponent <MoveInfluencer_Alignment>();

            floraReproduction = GetComponent <FloraReproduction>();

            eats    = GetComponent <Eats>();
            Edibles = GetComponents <IEdible>();

            animator = GetComponentInChildren <Animator>();

            // Calculate the maximum neighbor radius from the largest influencing distance
            foreach (var moveInfluencer in movementInfluencers)
            {
                maxNeighborRadius = Math.Max(maxNeighborRadius, moveInfluencer.MaxDistance);
            }

            initialized = true;
        }