Beispiel #1
0
        private void AggressiveAIMelee()
        {
            ScanForObjectsNode  = new CandiceBehaviorAction(CandiceDefaultBehaviors.ScanForObjects, rootNode);
            AvoidObstaclesNode  = new CandiceBehaviorAction(CandiceDefaultBehaviors.AvoidObstacles, rootNode);
            CandicePathfindNode = new CandiceBehaviorAction(CandiceDefaultBehaviors.CandicePathfind, rootNode);
            canSeeEnemyNode     = new CandiceBehaviorAction(CandiceDefaultBehaviors.EnemyDetected, rootNode);
            lookAtNode          = new CandiceBehaviorAction(CandiceDefaultBehaviors.LookAt, rootNode);
            attackNode          = new CandiceBehaviorAction(CandiceDefaultBehaviors.AttackMelee, rootNode);
            rangeAttackNode     = new CandiceBehaviorAction(CandiceDefaultBehaviors.AttackRange, rootNode);
            moveNode            = new CandiceBehaviorAction(CandiceDefaultBehaviors.MoveForwardWithSlopeAlignment, rootNode);
            withinAttackRange   = new CandiceBehaviorAction(CandiceDefaultBehaviors.WithinAttackRange, rootNode);


            attackSequence = new CandiceBehaviorSequence();
            attackSequence.SetNodes(new List <CandiceBehaviorNode> {
                withinAttackRange, lookAtNode, attackNode
            });
            followSequence = new CandiceBehaviorSequence();
            followSequence.SetNodes(new List <CandiceBehaviorNode> { /*AvoidObstaclesNode*/
                lookAtNode, moveNode
            });
            attackOrChaseSelector = new CandiceBehaviorSelector();
            attackOrChaseSelector.SetNodes(new List <CandiceBehaviorNode> {
                attackSequence, followSequence
            });
            rootNode.SetNodes(new List <CandiceBehaviorNode> {
                ScanForObjectsNode, canSeeEnemyNode, attackOrChaseSelector
            });
        }
Beispiel #2
0
        private void WanderAI()
        {
            ScanForObjectsNode  = new CandiceBehaviorAction(CandiceDefaultBehaviors.ScanForObjects, rootNode);
            AvoidObstaclesNode  = new CandiceBehaviorAction(CandiceDefaultBehaviors.AvoidObstacles, rootNode);
            CandicePathfindNode = new CandiceBehaviorAction(CandiceDefaultBehaviors.CandicePathfind, rootNode);
            canSeeEnemyNode     = new CandiceBehaviorAction(CandiceDefaultBehaviors.EnemyDetected, rootNode);
            lookAtNode          = new CandiceBehaviorAction(CandiceDefaultBehaviors.LookAt, rootNode);
            attackNode          = new CandiceBehaviorAction(CandiceDefaultBehaviors.AttackMelee, rootNode);
            rangeAttackNode     = new CandiceBehaviorAction(CandiceDefaultBehaviors.AttackRange, rootNode);
            moveNode            = new CandiceBehaviorAction(CandiceDefaultBehaviors.MoveForward, rootNode);
            withinAttackRange   = new CandiceBehaviorAction(CandiceDefaultBehaviors.WithinAttackRange, rootNode);
            wanderNode          = new CandiceBehaviorAction(CandiceDefaultBehaviors.Wander, rootNode);

            wanderSequence = new CandiceBehaviorSequence();
            wanderSequence.SetNodes(new List <CandiceBehaviorNode> {
                wanderNode, AvoidObstaclesNode, moveNode
            });
            rootNode.SetNodes(new List <CandiceBehaviorNode> {
                wanderSequence
            });
        }