Exemplo n.º 1
0
    void LaunchClaw()
    {
        // cuando se va a disparar, se activa la variable de que va a disparar y se para la animación
        Debug.Log("Aprete mouse ");
        isShooting          = true;
        minerAnimator.speed = 0;

        Vector3 mousePos = Input.mousePosition;

        mousePos.z = 10;

        Vector3 screenPos = Camera.main.ScreenToWorldPoint(mousePos);

        hit = Physics2D.Raycast(screenPos, Vector2.zero);
        if (hit == false)
        {
            CollectedObject();
            return;
        }

        if (hit)
        {
            Debug.Log("Entre a hit " + hit.point + hit.collider.name);
            claw.SetActive(true);
            clawScript.ClawTarget(hit.point);

            // inicializa el diablo
            if (hit.transform.gameObject.CompareTag("Jewel"))
            {
                Debug.Log("Voy a crear diablo ");
                diabloScript.CreaDiablo();
            }
        }
    }
Exemplo n.º 2
0
    void LaunchClaw()
    {
        isShooting          = true;
        minerAnimator.speed = 0;
        RaycastHit hit;
        Vector3    down = transform.TransformDirection(Vector3.down);

        if (Physics.Raycast(transform.position, down, out hit, 100))
        {
            claw.SetActive(true);
            clawScript.ClawTarget(hit.point);
        }
    }
Exemplo n.º 3
0
    void launchClaw()
    {
        isShooting            = true;
        fisherAnimation.speed = 0;
        Vector2      down = transform.TransformDirection(Vector2.down);
        RaycastHit2D hit  = Physics2D.Raycast(transform.position, down, 100, layer);

        if (hit)
        {
            claw.SetActive(true);
            clawScript.ClawTarget(hit.point);
        }
    }
Exemplo n.º 4
0
    void LaunchClaw()
    {
        isShooting = true;
        playerheadAnimator.speed = 0;
        RaycastHit hit;
        Vector3    up = transform.TransformDirection(Vector3.up);

        if (Physics.Raycast(transform.position, up, out hit, 1000))
        {
            Claw.SetActive(true);
            clawScript.ClawTarget(hit.point);
        }
    }
Exemplo n.º 5
0
    void LaunchClaw()
    {
        isShooting           = true;
        turretAnimator.speed = 0;
        Vector2      down = transform.TransformDirection(Vector2.down);
        RaycastHit2D hit  = Physics2D.Raycast(transform.position, down);

        if (hit.collider != null)
        {
            claw.SetActive(true);
            splash.Play();
            clawScript.ClawTarget(hit.point);
        }
    }
Exemplo n.º 6
0
    void LaunchClaw()
    {
        //Debug.Log ("test");
        isShooting            = true;
        shooterAnimator.speed = 0;
        RaycastHit hit;
        Vector3    down = transform.TransformDirection(Vector3.down);

        //Raycast must hit oject in order to be true
        if (Physics.Raycast(transform.position, down, out hit, 100))
        {
            Debug.Log("asjkdhask");
            claw.SetActive(true);              //Activate claw
            clawScript.ClawTarget(hit.point);  //launch towards target(balls)
        }
    }