Exemplo n.º 1
0
    private void OnBehaviorConditionMetListener(BehaviorSetup behaviorSetup)
    {
        if (behaviorSetup.Priority >= _behaviorPriority)
        {
            if (_activeBehaviorSetup)
            {
                _activeBehaviorSetup.OnBehaviourEndedEvent.RemoveListener(OnBehaviorEndedListener);
            }

            _activeBehaviorSetup = behaviorSetup;
            _behaviorPriority    = _activeBehaviorSetup.Priority;

            CurrentBehaviorTree.ExternalBehavior = _activeBehaviorSetup.Behavior;

            if (_activeBehaviorSetup.WillUseScanners)
            {
                CurrentBehaviorTree.SetVariableValue("ScannersParent", ScannersParent);
            }

            if (_activeBehaviorSetup.WillUseSetupTarget)
            {
                CurrentBehaviorTree.SetVariableValue("SetupTarget", _activeBehaviorSetup.FoundTarget);
            }

            if (_activeBehaviorSetup.WillUseWaypoints)
            {
                CurrentBehaviorTree.SetVariableValue("WaypointsParent", WaypointsParent);
            }

            _activeBehaviorSetup.OnBehaviourEndedEvent.AddListener(OnBehaviorEndedListener);

            CurrentBehaviorTree.EnableBehavior();
        }
    }
Exemplo n.º 2
0
        public override TaskStatus OnUpdate()
        {
            BehaviorSetup behaviorSetup = Owner.GetComponent <BehaviorSetup> ();

            behaviorSetup.AlertAllies(behaviorSetup.CheckForTarget());

            return(TaskStatus.Success);
        }