Beispiel #1
0
            protected override void onEnter(TBTWorkingData wData)
            {
                TurnToStatus = TBTRunningStatus.EXECUTING;
                AIEntityWorkingData thisData = wData.As <AIEntityWorkingData>();

                thisData.entityAnimation.Play("Attack");
            }
            protected override int onExecute(TBTWorkingData wData)
            {
                AIEntityWorkingData thisData     = wData.As <AIEntityWorkingData>();
                Vector3             moveDistance = Vector3.Normalize(WarriorAI.Instance.transform.position - thisData.entityTF.position) * 0.1f;

                thisData.entityTF.DOMove(thisData.entityTF.position + moveDistance, Time.deltaTime)
                .OnComplete(() => UpdateStatus());
                return(MoveToStatus);
            }
        private void Awake()
        {
            _behaviorWorkingData = new AIEntityWorkingData();
            _behaviorWorkingData.entityAnimator = GetComponent <Animator>();
            _behaviorWorkingData.entityTF       = transform;

            _behaviorTree = new TBTActionPrioritizedSelector();
            _behaviorTree
            .AddChild(new TBTActionSequence()
                      .SetPrecondition(new TBTPreconditionNOT(new HasReachedTarget()))
                      .AddChild(new TurnToAction())
                      .AddChild(new MoveToAction()))
            .AddChild(new TBTActionParallel()
                      .AddChild(new TurnToAction())
                      .AddChild(new AttackAction()));
        }
Beispiel #4
0
        private void Awake()
        {
            _behaviorWorkingData = new AIEntityWorkingData();
            _behaviorWorkingData.entityAnimation = GetComponent <Animation>();
            _behaviorWorkingData.entityTF        = transform;

            _behaviorTree = new TBTActionPrioritizedSelector();
            _behaviorTree
            .AddChild(new TBTActionSequence()
                      .SetPrecondition(new TBTPreconditionNOT(new HasReachEnemy()))
                      .AddChild(new LookEnemyAction())
                      .AddChild(new IdleAction()))
            .AddChild(new TBTActionParallel()
                      .AddChild(new LookEnemyAction())
                      .AddChild(new AttackAction()));
        }
            protected override void onEnter(TBTWorkingData wData)
            {
                AIEntityWorkingData thisData = wData.As <AIEntityWorkingData>();

                thisData.entityAnimator.CrossFade("attack", 0.2f);
            }
Beispiel #6
0
            protected override void onEnter(TBTWorkingData wData)
            {
                AIEntityWorkingData thisData = wData.As <AIEntityWorkingData>();

                thisData.entityAnimation.Play("idle");
            }