Exemplo n.º 1
0
    // 작동 될 때
    private void OnEnable()
    {
        if (f_rigid == null)
        {
            transform.SetParent(null);                                          // 부모를 없애어, 플레이어의 시각으로부터 자유로워진다.
            f_rigid      = GetComponent <Rigidbody>();
            tf           = GameObject.Find("LookChecker");
            obm          = GameObject.Find("ObjectManager");
            aiState      = GameObject.Find("BelugaAxis").GetComponent <AIStateController>();
            veTF         = GameObject.Find("BelugaAxis").GetComponent <Transform>();
            uu           = GameObject.Find("Main Camera").GetComponent <UInput>();
            foodParticle = GameObject.Find("Particle").transform.Find("Eating");
        }

        uu.fakeFish.SetActive(false);
        if (AI.success + AI.fail < 5 && UInput.uIState == UInput.UIState.Feed && Vector3.Distance(tf.transform.position, veTF.position) < 0.4f)         // 벨루가위치와 던짐 목표 위치를 비교하여 일정 거리 이하일 경우만
        {
            aiState.StartCoroutine(aiState.FeedFeed());
        }
        f_rigid.velocity = Vector3.zero;
        Vector3 foodVelo = Throwing(obm.transform.position, tf.transform.position + Vector3.up, degree);

        Throw(foodVelo);

        StartCoroutine("DestroyFood");
    }