Ejemplo n.º 1
0
    //location is in pixel coordinate
    private void smartTouchStartHandler(bindedObject rfAttributes)
    {
        Debug.Log("Screen position found!: " + rfAttributes.Location.x + ", " + rfAttributes.Location.y);

        //convert 1920 x 1080 screen coordinates to float between 0 and 1:
        float xScreenCoord = rfAttributes.Location.x / 1920.0f;
        float yScreenCoord = rfAttributes.Location.y / 1080.0f;

        if (rfAttributes.Properties ["type"] == "trigger")
        {
            switch (rfAttributes.Properties["action"])
            {
            case "gravity":
                gameManager.ActivateGravityWell(xScreenCoord, yScreenCoord);
                break;

            case "antiGravity":
                gameManager.ActivateAntiGravityWell(xScreenCoord, yScreenCoord);
                break;

            case "colorChange":
                gameManager.ActivateChangeAllColors(xScreenCoord, yScreenCoord);
                break;

            case "superSpawn":
                gameManager.ActivateSuperSpawnRate(xScreenCoord, yScreenCoord);
                break;

            case "random":
                gameManager.ActivateRandom(xScreenCoord, yScreenCoord);
                break;

            default:
                gameManager.ActivateRandom(xScreenCoord, yScreenCoord);
                break;
            }
        }
        else if (rfAttributes.Properties ["type"] == "mainmenu")
        {
            Application.Quit();
        }
        else if (rfAttributes.Properties ["type"] == "HUMAN")                   //easter egg
        {
            gameManager.audioSource.PlayOneShot(gameManager.humanScreamSound);
            gameManager.ActivateRandom(xScreenCoord, yScreenCoord);
        }
    }