Пример #1
0
    public void MakePowerUpCollectorAI()
    {
        m_distanceToPowerUp *= 3f;

        MakeAIBaseline();
        m_currentBehavior = EAIBehavior.COLLECTOR;
        InitializeAI();
    }
Пример #2
0
    public void MakeTryHardAI()
    {
        m_distanceToFollowKing *= 3.5f;

        MakeAIBaseline();
        m_currentBehavior = EAIBehavior.TRY_HARD;
        InitializeAI();
    }
Пример #3
0
    public void MakeAIBaseline()
    {
        m_behaviorTree = new BehaviorTree.BehaviorTree(
            new BehaviorTreeBuilder()
            .Selector("AI Behavior Main Selector")
            .Condition("Is Being Knocked Back", IsBeingKnockedBack)

            // Is King
            .Sequence("Is KING Sequence")
            .Condition("Check if is King", IsKing)
            .Selector("KING Selector")

            .Sequence("Is on Iminent Danger")
            .Condition("Check if is on iminent danger", IsOnIminentDanger)
            .Selector("Try to Use Power Up to Run")
            .Action("Try to use Back off", UseBackOffPowerUp)
            .Action("Try to use Super Speed", UseSuperSlamPowerUp)
            .Condition("Tried all power ups?", TriedAllPowerUps)
            .End()
            .Action("Run away from closest Player", RunAwayFromClosestPlayer)
            .End()

            .Sequence("Collect Power Up")
            .Condition("Can get power ups (power up tracker is not full", CanGetPowerUp)
            .Condition("Is there a Power Up within distance", IsThereAPowerUpWithinDistance)
            .Action("Collect a Power Up", CollectPowerUp)
            .End()

            .Sequence("King Wander Around")
            .Action("King Wander!", KingWander)
            .End()

            .End()

            .End()

            // IS NOT KING
            .Selector("Is NOT King Selector")

            .Sequence("Chase King")
            .Condition("Is King Withing Follow Distance", IsKingWithinFollowDistance)
            .Selector("AI Attack or Follow")
            .Sequence("Attack if possible")
            .Condition("Check if is within Attacking Distance", IsWithinAttackingDistance)
            .Condition("Check if AI can attack", CanAttack)
            .Action("Attack King", Attack)
            .End()

            .Sequence("Attack with Super Slam if possible")
            .Condition("Is Within Super Slam Distance?", IsWithinSuperSlamDistance)
            .Condition("SUPER SLAM", UseSuperSlamPowerUp)
            .End()

            .Sequence("Chase King")
            .Action("Chase King", ChaseKing)
            .End()
            .End()
            .End()

            .Sequence("Collect Power Up")
            .Condition("Can get power ups (power up tracker is not full", CanGetPowerUp)
            .Condition("Is there a Power Up within distance", IsThereAPowerUpWithinDistance)
            .Action("Collect a Power Up", CollectPowerUp)
            .End()

            .Sequence("I dunno man, I like my own space")
            .Condition("Check if someone is REALLY close", CheckIfClosestPlayerIsWithinAttackingDistance)
            .Condition("Checking if I can attack", CanAttack)
            .Action("Attack!!", Attack)
            .End()

            .Sequence("Walk Randomly")
            .Condition("Can we wander?", CanNotKingWander)
            .Action("Wander...", NotKingWanderRandomly)
            .End()
            .End()

            .End()
            .Build()
            );

        m_currentBehavior = EAIBehavior.BASELINE;
        InitializeAI();
    }