Ejemplo n.º 1
0
        public override void ExecuteTactic(ImpAi imp)
        {
            if (_imp == null)
            {
                _imp = imp;
                //_contextGroupFormation = imp.GetComponent<ContextGroupFormation>();
                _impRecruitBehaviour = imp.GetComponent <ImpRecruitBehaviour>();

                BtAction startRecruit = new BtAction(StartRecruit);
                BtAction stopRecruit  = new BtAction(StopRecruit);
                //BtCondition inPositionCondition = new BtCondition(InPosition);
                BtCondition isRecruiting    = new BtCondition(() => _isRecruiting);
                BtCondition isNotRecruiting = new BtCondition(() => !_isRecruiting);

                BtSelector startRecruitSelector = new BtSelector(new IBtTask[] { isRecruiting, startRecruit });
                BtSelector stopRecruitSelector  = new BtSelector(new IBtTask[] { isNotRecruiting, stopRecruit });

                BtSequence startRecruitSequence =
                    new BtSequence(new IBtTask[] { startRecruitSelector });

                BtSelector recruitTree = new BtSelector(new IBtTask[] { startRecruitSequence, stopRecruitSelector });

                _recruitBehaviourTree = new BehaviourTree(recruitTree);
            }

            _recruitBehaviourTree.Run();
        }
Ejemplo n.º 2
0
 private void Awake()
 {
     _animator            = GetComponent <Animator>();
     _combatSystem        = GetComponentInChildren <CombatSystem>();
     _impRecruitBehaviour = GetComponent <ImpRecruitBehaviour>();
     _impCounterBehaviour = GetComponent <ImpCounterBehaviour>();
     _leaderCallToArms    = GetComponent <LeaderCallToArms>();
     _contextSteering     = GetComponent <ContextSteering>();
     _playerMovement      = GetComponent <PlayerMovement>();
 }
Ejemplo n.º 3
0
 private void Awake()
 {
     _renderers           = GetComponentsInChildren <MeshRenderer>();
     _impRecruitBehaviour = transform.root.GetComponent <ImpRecruitBehaviour>();
 }