// Use this for initialization void Start() { blackBoard = new Blackboard(this.gameObject); Node root = new Priority( new Node[] { new Sequence( new Node[] { new ButtonPressed("X"), new MemSequence( new Node[] { new ChangeColor(Color.blue), new Wait(1.0f), new ChangePosition(Vector3.zero, Vector3.one*10.0f) // new ChangeColor(Color.red) } ) } ), new ChangeColor(Color.red) } ); behaviourTree = new BehaviourTree.Tree(root); }
//the stucture of the Behaviour Tree private void BehaviourTree() { //create behvaiour tree stdTank = new BehaviourTree.Tree(); //creates and add the root node to the Tree Root root = stdTank.AddRoot(); //make root section stdTank.MakeSectionFor(root); seqEngageInCombat = stdTank.MakeSequence(); seqGetAmmo = stdTank.MakeSequence(); stdTank.AddToSection(seqEngageInCombat, seqGetAmmo); stdTank.EndSection(); //engege in combat Sequence stdTank.MakeSectionFor(seqEngageInCombat); seqToRange = stdTank.MakeSequence(); seqFire = stdTank.MakeSequence(); stdTank.AddToSection(seqToRange, seqFire); stdTank.EndSection(); //move into range for comabat Sequence stdTank.MakeSectionFor(seqToRange); actFindEnemy = stdTank.MakeAction(); actToRange = stdTank.MakeAction(); stdTank.AddToSection(actFindEnemy, actToRange); stdTank.EndSection(); //fire the turret Sequence stdTank.MakeSectionFor(seqFire); actAim = stdTank.MakeAction(); actIsVisible = stdTank.MakeAction(); actFire = stdTank.MakeAction(); stdTank.AddToSection(actAim, actIsVisible, actFire); stdTank.EndSection(); //get ammo Sequence stdTank.MakeSectionFor(seqGetAmmo); sucGetAmmo = stdTank.MakeSucceeder(); actMoveToAmmo = stdTank.MakeAction(); stdTank.AddToSection(actMoveToAmmo, sucGetAmmo); stdTank.EndSection(); //get Ammo Succeeder stdTank.MakeSectionFor(sucGetAmmo); repGetAmmo = stdTank.MakeRepeater(); stdTank.AddToSection(repGetAmmo); stdTank.EndSection(); //get ammmo Repeater stdTank.MakeSectionFor(repGetAmmo); actGetAmmo = stdTank.MakeAction(); stdTank.AddToSection(actGetAmmo); stdTank.EndSection(); SetConditions(); SetActions(); BT_Debug(); }
protected override void EnemyStart() { weapon = new NormalBlade(this); Node root = new MemPriority ( new Node[] { new MemSequence ( new Node[] { new TargetOnSight(fieldOfView), new WillShoot(3.0f, 8.0f, 30), new TimeLimit ( 3.0f, new XAction<Aproach>(0.5f, 1.5f, -10.0f, 10.0f) ), new MemSequence ( new Node[] { new XAction<CastAttack>(), new XAction<Aim>(0.8f), new XAction<Shoot>() } ) } ), new MemProbabilistic ( new Node[] { new MemSequence ( new Node[] { new WaitRandom(0.3f, 1.5f), new XAction<RandomMovement>(4.0f) } ), new MemSequence ( new Node[] { new WaitRandom(0.3f, 1.5f) } ), } ), } ); behaviourTree = new BehaviourTree.Tree(root); }
protected override void EnemyStart() { weapon = new NormalCannon(this); Node root = new MemPriority ( new Node[] { new MemSequence ( new Node[] { new TargetOnSight(fieldOfView), new WillShoot(5.0f, 10.0f, 30), new MemSequence ( new Node[] { new XAction<CastAttack>(), new XAction<Aim>(0.8f), new XAction<Shoot>() } ) } ), new MemProbabilistic ( new Node[] { new MemSequence ( new Node[] { new WaitRandom(0.2f, 1.0f), new XAction<RandomMovement>(5.0f) } ), new MemSequence ( new Node[] { new WaitRandom(0.7f, 2.0f) } ), } ), } ); behaviourTree = new BehaviourTree.Tree(root); }
protected override void EnemyStart() { weapon = new ContactHazard(this, 2.0f, 0.2f); Node root = new MemProbabilistic ( new Node[] { new MemSequence ( new Node[] { new TimeLimit ( 10.0f, new XAction<Follow>() ) } ), new MemProbabilistic ( new Node[] { new MemSequence ( new Node[] { new XAction<RandomMovement>(6.0f) } ), new MemSequence ( new Node[] { new WaitRandom(0.3f, 0.6f) } ), } ), } ); behaviourTree = new BehaviourTree.Tree(root); }
// Use this for initialization protected override void EnemyStart() { weapon = new NormalCannon(this); Node root = new Priority ( new Node[] { new MemProbabilistic ( new Node[] { new MemSequence ( new Node[] { //new ChangeColor(Color.blue), new WaitRandom(0.2f, 1.0f), new XAction<RandomMovement>(5.0f) } ), new MemSequence ( new Node[] { //new ChangeColor(Color.red), new WaitRandom(0.7f, 3.0f) } ), new MemSequence ( new Node[] { new XAction<CastAttack>(), new XAction<Aim>(0.8f), new XAction<Shoot>() } ), } ), } ); behaviourTree = new BehaviourTree.Tree(root); }