Exemple #1
0
    public void OnBeginDrag(PointerEventData eventData)
    {
        if (GameManager.Instance.isDead)
        {
            return;
        }
        Vector2 p = Camera.main.ScreenToWorldPoint(Input.mousePosition);

        redCircle = Instantiate(redCirclePrefab, p, Quaternion.identity, rootCanvas.transform);

        //transform.SetParent(rootCanvas.transform);
    }
    float Search_Boss_Position(Vector3 player, Vector3 Boss)
    {
        float  z_rotate = 0f;
        double radians  = 0;
        double angle    = 0;

        if ((Boss.y - player.y <= 5 && Boss.y - player.y >= -5) && (Boss.x - player.x <= 5 && Boss.x - player.x >= -5))
        {
            RedCircle.SetActive(true);
        }
        else
        {
            RedCircle.SetActive(false);
        }
        radians  = Mathf.Atan2(Boss.x - player.x, Boss.y - player.y);
        angle    = radians * (180 / Mathf.PI);
        z_rotate = (float)angle;


        return(z_rotate);
    }