示例#1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Ray        ray = cam.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit, 100, movementMask))
            {
                motor.MoveToPoint(hit.point);
                // Move player to what we hit
                Debug.Log(hit.transform.name);
                if (hit.transform.tag == "JiYeon")
                {
                    FindObjectOfType <AudioManager>().Play("Win", 0.2f);
                    Button arrow = FindObjectOfType <StarbucksGameManager>().arrow;
                    if (arrow.gameObject.activeSelf)
                    {
                        arrow.StopArrowIndicator();
                    }
                    StarbucksJiYeon jiYeon = hit.collider.GetComponent <StarbucksJiYeon>();
                    if (jiYeon != null)
                    {
                        SetFocus(jiYeon);
                    }
                }
                else
                {
                    RemoveFocus();
                }

                // Stop focusing any objects
            }
        }
    }
示例#2
0
 void RemoveFocus()
 {
     if (focus != null)
     {
         focus.OnDefocused();
     }
     focus = null;
     motor.StopFollowingTarget();
 }
示例#3
0
 void SetFocus(StarbucksJiYeon newFocus)
 {
     if (newFocus != focus)
     {
         if (focus != null)
         {
             focus.OnDefocused();
         }
         focus = newFocus;
         motor.FollowTarget(newFocus);
     }
     newFocus.OnFocused(transform);
 }
示例#4
0
 public void FollowTarget(StarbucksJiYeon newTarget)
 {
     target = newTarget.InteractionTransform;
 }