コード例 #1
0
    FlockManager flockManager;                                 //script flockManager
    protected override JobHandle OnUpdate(JobHandle inputDeps) //ao atualizar
    {
        flockManager.UpdateData();                             //atualizar os dados

        MoveForwardJob moveForward = new MoveForwardJob        //setar variaveis necessarias
        {
            timeDT         = Time.deltaTime,
            driveFactor    = flockManager.driveFactor,
            maxSpeed       = flockManager.maxSpeed,
            squareMaxSpeed = flockManager.squareMaxSpeed,
            //neighborRadius = flockManager.neighborRadius,
            possibleNearEntitiesT  = flockManager.flockAgents_ECS_T,
            possibleNearEntitiesR  = flockManager.flockAgents_ECS_R,
            possibleNearEntitiesFW = flockManager.flockAgents_ECS_FW,
            qtdBehaviors           = flockManager.behaviorsWeights.Length,
            behaviorsWeights       = flockManager.behaviorsWeightsNArray,
            agentSmoothTime        = flockManager.agentSmoothTime,
            radius           = flockManager.radius,
            radiusCenter     = flockManager.radiusCenter,
            radiusLimiterPer = flockManager.radiusLimiterPer,
            //squareAvoidanceRadius = flockManager.squareAvoidanceRadius,
            flocksQuantityPerLayer = flockManager.flocksQuantityPerLayer,
            layersQuantity         = flockManager.layersQuantity,
            startingCount          = flockManager.startingCount,
            //avoidanceRadiusMultiplier = flockManager.avoidanceRadiusMultiplier,
            possibleNearObjectsT            = flockManager.objectAgents_ECS_T,
            qtdObjects                      = flockManager.qtdObjects,
            neighborRadiusNArray            = flockManager.neighborRadiusNArray,
            squareAvoidanceRadiusNArray     = flockManager.squareAvoidanceRadiusNArray,
            avoidanceRadiusMultiplierNArray = flockManager.avoidanceRadiusMultiplierNArray
        };

        return(moveForward.Schedule(this, inputDeps)); //colocar job para funcionar
    }