protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var job = new UpdatePlayerPos
        {
            Position = camera.transform.position
        };
        var job2 = new TagChunksUngenerated
        {
            Translation    = GetArchetypeChunkComponentType <Translation>(),
            PlayerPos      = camera.transform.position,
            entityType     = GetArchetypeChunkEntityType(),
            CommandBuffer  = system.CreateCommandBuffer().ToConcurrent(),
            RenderDistance = Settings.RenderDistance
        };

        //TODO potential issue here
        var h1 = job.Schedule <UpdatePlayerPos>(playerQuery, inputDeps);

        var h2 = job2.Schedule <TagChunksUngenerated>(query, h1);

        system.AddJobHandleForProducer(h2);

        return(JobHandle.CombineDependencies(h1, h2));
    }
示例#2
0
    // Use this for initialization
    void Start()
    {
        //Assign the blackboard
        blackboard = blackBoardObj.GetComponent <Blackboard>();

        //Create the nodes and populate the children Lists within them
        tree = new Selector();

        //Root of the spotted sub-tree
        Sequence spottedSequence = new Sequence();

        tree.children.Add(spottedSequence);
        //Player detected condition node
        PlayerDetected playerDetected = new PlayerDetected();

        spottedSequence.children.Add(playerDetected);
        //Add a Succeeder repeater for the melee sub-tree
        SucceederRepeater succeeder = new SucceederRepeater();

        spottedSequence.children.Add(succeeder);
        //Sequence for the melee sub-tree
        Sequence subSequence = new Sequence();

        succeeder.child = subSequence;
        //Add the melee weapon check to the sequence
        MeleeWeapon meleeWeapon = new MeleeWeapon();

        subSequence.children.Add(meleeWeapon);
        //Add in the persuit movement to
        PersuitMovement persuitMovement = new PersuitMovement();

        subSequence.children.Add(persuitMovement);
        CheckRange checkRange = new CheckRange();

        spottedSequence.children.Add(checkRange);
        CheckAttackCooldown checkCooldown = new CheckAttackCooldown();

        spottedSequence.children.Add(checkCooldown);
        AttackTarget attack = new AttackTarget();

        spottedSequence.children.Add(attack);

        //Root of the Search sub-tree
        Sequence searchSequence = new Sequence();

        tree.children.Add(searchSequence);
        //Flipper
        FlipperRepeater flipper = new FlipperRepeater();

        searchSequence.children.Add(flipper);
        //PlayerDetected
        playerDetected = new PlayerDetected();
        flipper.child  = playerDetected;
        flipper        = new FlipperRepeater();
        searchSequence.children.Add(flipper);
        //following sequence
        Sequence followingSequence = new Sequence();

        flipper.child = followingSequence;
        CheckFollowing checkFollowing = new CheckFollowing();

        followingSequence.children.Add(checkFollowing);
        persuitMovement = new PersuitMovement();
        followingSequence.children.Add(persuitMovement);
        UpdatePlayerPos updatePlayerPos = new UpdatePlayerPos();

        followingSequence.children.Add(updatePlayerPos);
        FollowCounter followCounter = new FollowCounter();

        followingSequence.children.Add(followCounter);
        EnableCurious enableCurious = new EnableCurious();

        followingSequence.children.Add(enableCurious);
        //Curious sub-tree
        Sequence curiousSequence = new Sequence();

        searchSequence.children.Add(curiousSequence);
        CheckCurious checkCurious = new CheckCurious();

        curiousSequence.children.Add(checkCurious);
        LookAround lookAround = new LookAround();

        curiousSequence.children.Add(lookAround);
        DisableCurious disableCurious = new DisableCurious();

        curiousSequence.children.Add(disableCurious);
    }