private void PlayerClickedLeft()
    {
        Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hitInfo;

        if (Physics.Raycast(ray, out hitInfo, 100, canClickLayer))
        {
            vCont.MoveTo(hitInfo.point);
        }
    }
示例#2
0
 private void ChasePlayer()
 {
     if (Vector3.Distance(vCont.Position, playerVCont.Position) >= attackRange)
     {
         vCont.MoveTo(playerVCont.Position);
     }
     else
     {
         if (canAttack)
         {
             Attack();
         }
     }
 }
示例#3
0
    private void PlayerClickedLeft()
    {
        Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hitInfo;

        if (Physics.Raycast(ray, out hitInfo, 100))
        {
            if (hitInfo.collider.tag == "Enemy")
            {
                targetVCont = hitInfo.collider.GetComponent <VirtualController>();
                state       = PlayerState.Chasing;
            }
            else
            {
                state       = PlayerState.Walking;
                targetVCont = null;
            }
            vCont.MoveTo(hitInfo.point);
        }
    }