Ejemplo n.º 1
0
        public int UpdateBehavior(float gameTime, float deltaTime)
        {
            if (_currentRequest == null)
            {
                return(0);
            }

            if (_targetDummyObject == null)
            {
                return(0);
            }

            //update working data
            if (null != _behaviorWorkingData.entityAnimator)
            {
                _behaviorWorkingData.entityAnimator.speed = AITimer.instance.timeScale;
            }

            _behaviorWorkingData.gameTime  = gameTime;
            _behaviorWorkingData.deltaTime = deltaTime;

            //test bb usage
            //_blackboard.SetValue(BBKEY_NEXTMOVINGPOSITION, _currentRequest.nextMovingTarget);
            _blackboard.SetValue(BBKEY_NEXTMOVINGPOSITION, _targetDummyObject.transform.position);

            if (_behaviorTree.Evaluate(_behaviorWorkingData))
            {
                _behaviorTree.Update(_behaviorWorkingData);
            }
            else
            {
                _behaviorTree.Transition(_behaviorWorkingData);
            }
            return(0);
        }
Ejemplo n.º 2
0
 public virtual void SetTargetEnemy(Transform value)
 {
     if (value != null)
     {
         if (value.GetComponent <Body>() != null)
         {
             //Debugger.LogError(string.Format("SetTargetEnemy value={0}, character={1}",
             //value.name, value.GetComponent<Body>()._Character));
         }
         //Debugger.Log(string.Format("SetTargetEnemy value={0}, pos={1}", value.name, value.transform.position));
     }
     else
     {
         //Debugger.Log(LogUtil.GetCurMethodName() + ", null");
     }
     _Blackboard.SetValue(_TARGET_ENEMY, value);
 }