コード例 #1
0
    void Update()
    {
        dir = Target - transform.position;



        if (dir.magnitude < distTol & move == true)
        {
            npChild poet = GetComponentInChildren <npChild>();
            poet.proc = 0;
            poet.Pos();

            move = false;
            anime.SetBool("Idle", true);
        }


        if (move == true)
        {
            anime.SetBool("Idle", false);
            Quaternion rap = Quaternion.LookRotation(dir, Vector3.up);
            transform.rotation = Quaternion.Lerp(transform.rotation, rap, rotSpeed * Time.deltaTime);
            rb.MovePosition(transform.position + transform.forward * speed * Time.deltaTime);
        }

        Debug.DrawLine(transform.position, Target, Color.red);
    }
コード例 #2
0
    void Start()
    {
        rb = this.GetComponent <Rigidbody>();

        goblinCh = this.gameObject.transform.GetChild(0);
        //anime = goblinCh.GetComponent<Animator>();

        npChild poet = GetComponentInChildren <npChild>();

        poet.Pos();
    }