Example #1
0
    public void HandleEvent(GameEvent ge)
    {
        if (ge.type.Equals("mouse_release"))
        {
            RaycastHit targetFind;

            Ray targetSeek = Camera.main.ScreenPointToRay(InputWatcher.GetTouchPosition());
            if (Physics.Raycast(targetSeek, out targetFind))
            {
                //sees if ray collided with the start button
                if (targetFind.collider.gameObject == startButton)
                {
                    //Debug.Log ("try and load level select");

                    /*if(menuPosition != 0){
                     *      //worldHolder.GetComponent<WorldData>().lastScene = Application.loadedLevel;
                     * Application.LoadLevel(levelName);
                     *
                     * }*/
                    if (levelHolder[menuPosition] == "Return")
                    {
                        levelName = WorldData.lastScene;
                    }
                    else
                    {
                        levelName = levelHolder[menuPosition];
                    }
                    Pause.paused = false;
                    Application.LoadLevel(levelName);
                }
            }
        }
    }
Example #2
0
    public void HandleEvent(GameEvent ge)
    {
        if (ge.type.Equals("mouse_release"))
        {
            float rotation = Dial.gameObject.transform.eulerAngles.z;
            float lockRot  = Mathf.Round(rotation / 60) * 60;
            menuPosition = (int)lockRot / 60;
            if (menuPosition == 6)
            {
                menuPosition = 0;
            }
        }
        else if (ge.type.Equals("mouse_click"))
        {
            RaycastHit targetFind;

            Ray targetSeek = Camera.main.ScreenPointToRay(InputWatcher.GetTouchPosition());
            if (Physics.Raycast(targetSeek, out targetFind))
            {
                //sees if ray collided with the start button
                if (targetFind.collider.gameObject == this.gameObject)
                {
                    loader.towerName = "devtest" + (menuPosition + 1).ToString();
                    Application.LoadLevel("TowerEditor");
                }
            }
        }
    }
Example #3
0
    public void HandleEvent(GameEvent ge)
    {
        Vector3 mousepos = InputWatcher.GetInputPosition();

        if (ge.type.Equals("mouse_release"))
        {
            if (!buttonCheck)
            {
                //Stops the dial from spinning more

                //Only tries to lock if the spinner has a chance of moving
                if (clickTime > clickDelay)
                {
                    //Locks position to nearest interval of 60
                    float rotation = transform.eulerAngles.z;
                    float lockRot  = Mathf.Round(rotation / 60) * 60;
                    transform.rotation = Quaternion.Euler(0, 0, lockRot);
                }
            }
            //resets time
            clickTime   = 0;
            touchDown   = false;
            spinner     = false;
            buttonCheck = false;
        }
        else if (ge.type.Equals("mouse_click"))
        {
            //Allows the dial to start spinning
            RaycastHit targetFind;

            Ray targetSeek = Camera.main.ScreenPointToRay(InputWatcher.GetTouchPosition());
            if (Physics.Raycast(targetSeek, out targetFind))
            {
                //sees if ray collided with the start button
                if (targetFind.collider.gameObject.tag == "Button")
                {
                    buttonCheck = true;
                }
            }
            if (spinner == false)
            {
                originalRot = Mathf.Atan2(mousepos.y, mousepos.x);
                origz       = transform.eulerAngles.z;
                //Debug.Log ("new original degrees: " + originalRot);
            }
            spinner   = true;
            touchDown = true;
        }
    }
Example #4
0
    public void HandleEvent(GameEvent ge)
    {
        if (ge.type.Equals("mouse_release"))
        {
            Debug.Log("test");
            RaycastHit targetFind;

            Ray targetSeek = Camera.main.ScreenPointToRay(InputWatcher.GetTouchPosition());
            if (Physics.Raycast(targetSeek, out targetFind))
            {
                //sees if ray collided with the start button
                if (targetFind.collider.gameObject == this.gameObject)
                {
                    Application.LoadLevel(WorldData.lastScene);
                }
            }
        }
    }
Example #5
0
    public void HandleEvent(GameEvent ge)
    {
        if (ge.type.Equals("mouse_release"))
        {
            RaycastHit targetFind;

            Ray targetSeek = Camera.main.ScreenPointToRay(InputWatcher.GetTouchPosition());
            if (Physics.Raycast(targetSeek, out targetFind))
            {
                //sees if ray collided with the start button
                if (targetFind.collider.gameObject == startButton)
                {
                    GamePause.paused = false;
                    Pause.paused     = false;
                    Application.LoadLevel(levelName);
                }
            }
        }
    }
Example #6
0
    public void HandleEvent(GameEvent ge)
    {
        if (ge.type.Equals("mouse_release"))
        {
            RaycastHit targetFind;

            Ray targetSeek = Camera.main.ScreenPointToRay(InputWatcher.GetTouchPosition());
            if (Physics.Raycast(targetSeek, out targetFind))
            {
                //sees if ray collided with the start button
                if (targetFind.collider.gameObject == this.gameObject)
                {
                    /*GameObject temp = GameObject.FindGameObjectWithTag("DataHolder");
                     * temp.GetComponent<WorldData>().lastScene = "TestScene";
                     * Application.LoadLevel("Menu");*/
                    Camera.main.transform.position = CamLock.transform.position;
                }
            }
        }
    }
Example #7
0
    public void HandleEvent(GameEvent ge)
    {
        if (ge.type.Equals("mouse_click"))
        {
            RaycastHit targetFind;

            Ray targetSeek = Camera.main.ScreenPointToRay(InputWatcher.GetTouchPosition());
            if (Physics.Raycast(targetSeek, out targetFind))
            {
                //sees if ray collided with the start button
                if (targetFind.collider.gameObject == this.gameObject)
                {
                    //if(worldHolder){
                    //Application.LoadLevel(worldHolder.GetComponent<WorldData>().lastScene);
                    //}else{
                    Application.LoadLevel(9);
                    //}
                }
            }
        }
    }
Example #8
0
 public void HandleEvent(GameEvent ge)
 {
     if (ge.type.Equals("mouse_release"))
     {
         RaycastHit targetFind;
         Ray        targetSeek = Camera.main.ScreenPointToRay(InputWatcher.GetTouchPosition());
         if (Physics.Raycast(targetSeek, out targetFind))
         {
             //gets stats of clicked building, triggers the GUI popups
             if (targetFind.collider.gameObject.tag == "Button")
             {
                 //what triggers changes based on what menu the camera is focused on.
                 if (targetFind.transform.position.x == 0.0f)
                 {
                     Debug.Log("we're loading the thing now");
                     WorldData.lastScene = Application.loadedLevelName;
                     Application.LoadLevel(levelList[menuPosition]);
                 }
             }
         }
     }
 }
Example #9
0
    public void HandleEvent(GameEvent ge)
    {
        if (ge.type.Equals("mouse_release"))
        {
            RaycastHit targetFind;

            Ray targetSeek = Camera.main.ScreenPointToRay(InputWatcher.GetTouchPosition());
            if (Physics.Raycast(targetSeek, out targetFind))
            {
                //sees if ray collided with the start button
                if (targetFind.collider.gameObject == startButton)
                {
                    //Debug.Log ("try and load level select");
                    Application.LoadLevel(levelName);
                }
                if (targetFind.collider.gameObject == menuButton)
                {
                    WorldData.lastScene = Application.loadedLevelName;
                    Application.LoadLevel("Menu");
                }
            }
        }
    }
Example #10
0
    public void HandleEvent(GameEvent ge)
    {
        if (ge.type.Equals("mouse_release"))
        {
            if (returnButton == null || anchorPoints == null || tintBox == null)
            {
                return;
            }
            RaycastHit targetFind;

            Ray targetSeek = Camera.main.ScreenPointToRay(InputWatcher.GetTouchPosition());
            if (Physics.Raycast(targetSeek, out targetFind))
            {
                //sees if ray collided with the start button
                if (targetFind.collider.gameObject == this.gameObject)
                {
                    if (!paused)
                    {
                        //moves buttons to set locations, and darkens screen
                        this.gameObject.transform.position                = anchorPoints[0].gameObject.transform.position;
                        returnButton.transform.position                   = anchorPoints[2].gameObject.transform.position;
                        GetComponentInChildren <TextMesh>().text          = "Resume";
                        tintBox.GetComponent <Renderer> ().material.color = new Color(0.0f, 0.0f, 0.0f, 0.5f);
                    }
                    else
                    {
                        //moves buttons back, sets screen back to normal color
                        this.gameObject.transform.position                = anchorPoints[1].gameObject.transform.position;
                        returnButton.transform.position                   = anchorPoints[3].gameObject.transform.position;
                        GetComponentInChildren <TextMesh>().text          = "Pause";
                        tintBox.GetComponent <Renderer> ().material.color = new Color(0.0f, 0.0f, 0.0f, 0.0f);
                    }
                    paused = !paused;
                }
            }
        }
    }
Example #11
0
    public void HandleEvent(GameEvent ge)
    {
        if (ge.type.Equals("mouse_release"))
        {
            RaycastHit targetFind;

            Ray targetSeek = Camera.main.ScreenPointToRay(InputWatcher.GetTouchPosition());
            if (Physics.Raycast(targetSeek, out targetFind))
            {
                Debug.Log(targetFind.collider.name);
                //sees if ray collided with the start button
                if (targetFind.collider.gameObject == startButton)
                {
                    //Debug.Log ("try and load level select");
                    if (levelHolder[menuPosition] == "Return")
                    {
                        Camera.main.transform.position = cameraLock2.transform.position;
                    }
                    else
                    {
                        WorldData.lastScene = Application.loadedLevelName;
                        levelName           = levelHolder[menuPosition];
                        GamePause.paused    = false;
                        Application.LoadLevel(levelName);
                    }

                    /*if(menuPosition == 3 || menuPosition == 1){
                     *      worldHolder.GetComponent<WorldData>().lastScene = Application.loadedLevelName;
                     *      Application.LoadLevel(levelName);
                     * }else if(menuPosition == 2){
                     *      Camera.main.transform.position = cameraLock2.transform.position;
                     * }*/
                }
            }
        }
    }