void drawKey()
 {
     if (playerScript.getKeyState() && keyDraw == null)
     {
         keyDraw = new DrawScreen("key1", textureKey, 30, false);
         cameraScript.addDrawingToScreen(keyDraw);
     }
     else if (!playerScript.getKeyState() && keyDraw != null)
     {
         cameraScript.deleteDrawingOfScreen(keyDraw);
         keyDraw = null;
     }
 }
    void OnTriggerEnter2D(Collider2D c)
    {
        if (c.gameObject.name == "Mouse")
        {
            audio = GetComponent <AudioSource>();
            if (!audio.isPlaying)
            {
                audio.Play();
            }
            target   = c.gameObject;
            sticking = true;
            o_speed  = target.GetComponent <playerController>().get_speed();
            target.GetComponent <playerController>().set_speed(1.2f);

            drawBubble = new DrawScreen("", bubbleTexture, 30, true);
            mainCamera.addDrawingToScreen(drawBubble);
        }
    }
Exemple #3
0
    IEnumerator OnTriggerEnter2D(Collider2D c)
    {
        if (c.gameObject.name == "Mouse")
        {
            if (!audio.isPlaying)
            {
                audio.Play();
            }
            float o_speed = c.gameObject.GetComponent <playerController>().get_speed();
            c.gameObject.GetComponent <playerController>().set_speed(0);

            mainCamera.addDrawingToScreen(new DrawScreen("", stunTexture, 30, true, true, stunTime));
            yield return(new WaitForSeconds(stunTime));

            c.gameObject.GetComponent <playerController>().set_speed(o_speed);
            isDestroy = true;
        }
    }