示例#1
0
 private void SetTreeVariable(IXBehaviorTree tree)
 {
     tree.SetVariable(AITreeArg.TARGET, _target == null ? null : _target.EntityObject);
     tree.SetVariable(AITreeArg.MASTER, XEntityMgr.singleton.Player == null ? null : XEntityMgr.singleton.Player.EntityObject);
     tree.SetVariable(AITreeArg.IsOppoCastingSkill, _is_oppo_casting_skill);
     tree.SetVariable(AITreeArg.IsHurtOppo, _is_hurt_oppo);
     tree.SetVariable(AITreeArg.TargetDistance, _target_distance);
     tree.SetVariable(AITreeArg.MasterDistance, _master_distance);
     tree.SetVariable(AITreeArg.IsFixedInCD, _is_fixed_in_cd);
     tree.SetVariable(AITreeArg.NormalAttackProb, _normal_attack_prob);
     tree.SetVariable(AITreeArg.EnterFightRange, _enter_fight_range);
     tree.SetVariable(AITreeArg.FightTogetherDis, _fight_together_dis);
     tree.SetVariable(AITreeArg.MaxHP, _max_hp);
     tree.SetVariable(AITreeArg.CurrHP, _current_hp);
     tree.SetVariable(AITreeArg.MaxSupperArmor, _max_super_armor);
     tree.SetVariable(AITreeArg.CurrSuperArmor, _current_super_armor);
     tree.SetVariable(AITreeArg.EntityType, (int)_entity.Type);
     tree.SetVariable(AITreeArg.TargetRot, _target_rotation);
     tree.SetVariable(AITreeArg.AttackRange, _attack_range);
     tree.SetVariable(AITreeArg.MinKeepRange, _min_keep_range);
     tree.SetVariable(AITreeArg.IsCastingSkill, _is_casting_skill);
     tree.SetVariable(AITreeArg.IsFighting, _is_fighting);
     tree.SetVariable(AITreeArg.IsQteState, _is_qte_state);
     tree.SetVariable(AITreeArg.BornPos, _entity.Position);
 }
示例#2
0
 public override void OnUninit()
 {
     _entity = null;
     _target = null;
     _tick   = 0;
     _tree   = null;
     base.OnUninit();
 }
示例#3
0
    public void InitTree()
    {
        if (_enable_runtime)
        {
            _tree = new AIRunTimeTree();
        }
        else
        {
#if UNITY_EDITOR
            _tree = new XBehaviorTree();
#endif
        }
        string tree = string.Empty;
        if (_entity.IsPlayer)
        {
            tree = "PlayerAutoFight";
        }
        else
        {
            tree = _entity.Attributes.AiBehavior;
        }
        SetBehaviorTree(tree);
    }