예제 #1
0
    void showWrongMark()
    {
        PlayerActionFeedback tick1 = PlayerActionFeedback.GetNewPlayerActionFeedback(myDesk.transform);

        tick1.transform.localScale = new Vector3(0.2f, 0.2f, 1);
        tick1.ShowWrong();
    }
예제 #2
0
    private void TouchesEnded(Vector3 position)
    {
        touchPosWorld = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        Vector2 touchPosWorld2D = new Vector2(touchPosWorld.x, touchPosWorld.y);

        RaycastHit2D[] hitInformation = Physics2D.RaycastAll(touchPosWorld2D, Camera.main.transform.forward);

        bool    isWrong   = true;
        Vector3 posBuffer = draggingObject.gameObject.transform.position;

        // Verificação se eu soltei o objeto em cima do lugar que eu deveria soltar.
        foreach (RaycastHit2D hit in hitInformation)
        {
            if (draggingObject.target != null && hit.transform.gameObject == draggingObject.target)
            {
                StudentObject interactable = draggingObject.target.GetComponent <StudentObject>();
                interactable.owner.status = StudentStatus.Neutral;

                draggingObject.owner.status = StudentStatus.Chaotic;
                draggingObject.owner.timer  = GameManager.GetSharedInstance().stealInTime;

                PlayerActionFeedback tick1 = PlayerActionFeedback.GetNewPlayerActionFeedback(interactable.owner.myDesk.transform);
                PlayerActionFeedback tick2 = PlayerActionFeedback.GetNewPlayerActionFeedback(draggingObject.owner.myDesk.transform);

                tick1.transform.localScale = new Vector3(0.2f, 0.2f, 1);

                tick2.transform.localScale = new Vector3(0.2f, 0.2f, 1);

                tick1.ShowCorrect();
                tick2.ShowCorrect();

                draggingObject.target.SetActive(false);
                draggingObject.gameObject.SetActive(false);

                isWrong = false;
            }
        }

        if (isWrong)
        {
            GameObject           go    = new GameObject("TheEmptyOne");
            PlayerActionFeedback tick1 = PlayerActionFeedback.GetNewPlayerActionFeedback(go.transform);

            //						tick1.transform.position = transform.position;
            go.transform.position      = new Vector3(posBuffer.x, posBuffer.y - 0.4f, 0);
            tick1.transform.localScale = new Vector3(0.09f, 0.09f, 1);

            tick1.ShowWrong();
        }

        isDragging = false;
    }