Exemplo n.º 1
0
    void SetTarget(Interactable newTarget)
    {
        if (newTarget == target)
        {
            return;
        }

        if (target != null)
        {
            target.OnRemoveTarget();
        }

        target = newTarget;

        if (target == null)
        {
            InteractPanel.Hide();
        }
        else
        {
            InteractPanel.Show(target.text);

            target.OnSetAsTarget();
        }
    }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        if (EventSystem.current.IsPointerOverGameObject())
        {
            return;
        }

        if (Input.GetMouseButtonDown(0))
        {
            // If no battle is happening -> Move normally
            if (BattleSystem.instance.state == BattleState.END)
            {
                Ray        ray = cam.ScreenPointToRay(Input.mousePosition);
                RaycastHit hit;

                if (Physics.Raycast(ray, out hit, 100, movementMask))
                {
                    // Move to what we hit
                    motor.MoveToPoint(hit.point);
                    RemoveFocus();
                }
            }
        }

        //TODO: make UI show up for interaction menu
        if (Input.GetMouseButtonDown(1))
        {
            Ray        ray = cam.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit, 100))
            {
                Interactable interactable = hit.collider.GetComponent <Interactable>();
                if (interactable != null)
                {
                    //If no battle is happening -> Activate interaction panel
                    if (BattleSystem.instance.state == BattleState.END)
                    {
                        interactOriginPoint.transform.position = Input.mousePosition;
                        InteractPanel panel = interactPanel.GetComponent <InteractPanel>();
                        panel.setInteractions(interactable.interactions, interactable);
                        interactPanel.SetActive(true);
                    }
                }
            }
        }
    }
Exemplo n.º 3
0
 void Awake()
 {
     instance = this;
     Hide();
 }