Giter Club home page Giter Club logo

Comments (1)

ijisthee avatar ijisthee commented on June 25, 2024

Ohhh my... Today I've had a hard nut to crack. Haha.

Have a look at this code (https://github.com/acdamiani/schema/blob/main/Runtime/Proc/ExecutableNode.cs#L178):

bool isSub = current.IsSubTreeOf(node);
bool isPriority = current.IsLowerPriority(node);

switch (c.abortsType)
{
    case Conditional.AbortsType.Self when !isSub:
    case Conditional.AbortsType.LowerPriority when !isPriority:
    case Conditional.AbortsType.Both when !isPriority && !isSub:
        continue;
}

bool status = c.Evaluate(conditionalMemory[id][j], context.agent);
status = c.invert ? !status : status;

if (!lastConditionalStatus.TryGetValue(j, out bool last)) last = status;
lastConditionalStatus[j] = status;

if (last == status) continue;

switch (c.abortsWhen)
{
    case Conditional.AbortsWhen.OnSuccess when status:
    case Conditional.AbortsWhen.OnFailure when !status:
    case Conditional.AbortsWhen.Both:
        return true;
}

These kind of double negations is not made for a human brain. :)

For instance:

I have a class that returns true if the enemy has Mana to fight.
I want him to chase the player if there is no mana but abort the node if mana is back.

Sounds easy but the settings creates a knot in a humans head. Haha.

If you would create an if statement it would look like this:

if (!HasMana()) {
	ChasePlayer();
} else if (AbortType == AbortType.Self && HasMana()) {
	StopChasePlayer
}

image

I've create my own text for this Conditional to make it more clear.
Maybe you could also do that by default? I know it's not easy because of the different wordings. Believe me, in German it would be hell on earth to standardize that. Haha.

image

from schema.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.