Exemplo n.º 1
0
 private void Awake()
 {
     ani      = GetComponent <BokoblinAnimationCtrl>();
     state    = GetComponent <BokoblinState>();
     uiCtrl   = GetComponent <EnemyUICtrl>();
     ragdolls = GetComponentsInChildren <Rigidbody>();
     ai       = GetComponent <BokoblinAI>();
 }
Exemplo n.º 2
0
    void Awake()
    {
        playerTr = GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>();
        sense    = GetComponent <BokoblinSense>();
        state    = GetComponent <BokoblinState>();
        attack   = GetComponent <BokoblinAttack>();
        agent    = GetComponent <MoveAgent>();
        ani      = GetComponent <BokoblinAnimationCtrl>();
        uiCtrl   = GetComponent <EnemyUICtrl>();
        ragdolls = GetComponentsInChildren <Rigidbody>();
        foreach (Rigidbody bone in ragdolls) // 시작시 래그돌과 콜라이더를 꺼준다
        {
            if (bone.GetComponent <Rigidbody>() != GetComponent <Rigidbody>())
            {
                if (!bone.CompareTag("Weapon"))
                {
                    bone.isKinematic = true;
                    bone.GetComponent <Collider>().enabled = false;
                }
            }
        }

        (root = Selector.Make()).
        AddChild(ActionNode.Make(CheckState)).
        // 전투
        AddChild(Sequence.Make().
                 AddChild(ActionNode.Make(IsAlert)).
                 AddChild(ActionNode.Make(CheckMoveToFoe)).
                 AddChild(ActionNode.Make(AttackFoe)).
                 AddChild(ActionNode.Make(CheckFoeDead))
                 ).
        // 의심
        AddChild(Selector.Make().
                 AddChild(ActionNode.Make(IsAlert)).
                 AddChild(ActionNode.Make(SenseFoe))
                 ).
        // 유휴
        AddChild(Selector.Make().
                 AddChild(ActionNode.Make(IsAlert)).
                 AddChild(ActionNode.Make(Idle))
                 );
    }
 private void Awake()
 {
     ani    = GetComponent <GuardianAnimationCtrl>();
     state  = GetComponent <GuardianState>();
     uiCtrl = GetComponent <EnemyUICtrl>();
 }