Пример #1
0
    public void HandleEvent(GameEvent ge)
    {
        //if(Pause.paused)
        //	return;
        Vector3 mousepos = InputWatcher.GetCanvasInputPosition((RectTransform)canvas.transform);

        if (ge.type.Equals("mouse_click"))
        {
            if (spinning)
            {
                return;
            }
            spinning         = true;
            startingDialRot  = transform.eulerAngles.z * Mathf.Deg2Rad;
            startingMouseRot = Mathf.Atan2(mousepos.y - anchorY, mousepos.x - anchorX);
        }
        else if (ge.type.Equals("mouse_release"))
        {
            if (!spinning)
            {
                return;
            }
            spinning = false;
            float mouseAngle  = Mathf.Atan2((mousepos.y - anchorY) - transform.position.y, (mousepos.x - anchorX) - transform.position.x);
            float angleChange = mouseAngle - startingMouseRot;
            transform.eulerAngles = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y, (startingDialRot + angleChange) * Mathf.Rad2Deg);
            float rotation = transform.eulerAngles.z;
            float lockRot  = LockDegrees(rotation);            //lock to the right angle based on how many options there are
            transform.rotation = Quaternion.Euler(0, 0, lockRot);
            RefreshSelectedOption();
        }
    }
Пример #2
0
    public void HandleEvent(GameEvent ge)
    {
        if (Pause.paused)
        {
            return;
        }
        Vector3 mousepos = InputWatcher.GetCanvasInputPosition((RectTransform)canvas.transform);

        if (ge.type.Equals("mouse_click"))
        {
            if (spinning)
            {
                return;
            }

            spinning         = true;
            startingDialRot  = transform.eulerAngles.z * Mathf.Deg2Rad;
            startingMouseRot = Mathf.Atan2(mousepos.y - anchorY, mousepos.x - anchorX);
        }
        else if (ge.type.Equals("mouse_release"))
        {
            if (!spinning)
            {
                return;
            }
            spinning = false;
            float mouseAngle  = Mathf.Atan2((mousepos.y - anchorY) - transform.position.y, (mousepos.x - anchorX) - transform.position.x);
            float angleChange = mouseAngle - startingMouseRot;
            transform.eulerAngles = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y, (startingDialRot + angleChange) * Mathf.Rad2Deg);
            float rotation = transform.eulerAngles.z;
            float lockRot  = Mathf.Round(rotation / 60) * 60;
            UpdateSelection(lockRot);
            transform.rotation = Quaternion.Euler(0, 0, lockRot);
        }
    }
Пример #3
0
    // Update is called once per frame
    void Update()
    {
        Vector3 mousepos = InputWatcher.GetInputPosition();

        //Debug.Log (touchDown);
        if (touchDown)
        {
            if (!buttonCheck)
            {
                //Debug.Log ("mouse down");
                clickTime += Time.deltaTime;
                //Only allows the dial to spin if the player has been pressing for over a certain amount of time
                if (spinner && clickTime > clickDelay)
                {
                    //Probably not the best for dealing with movement on both axis,
                    //also will change code to touch controls once we start testing the game on mobile
                    float angle       = Mathf.Atan2(mousepos.y - transform.position.y, mousepos.x - transform.position.x);               // (mousepos.y,mousepos.x);
                    float degrees     = (Mathf.Rad2Deg * angle);
                    float origDegrees = Mathf.Rad2Deg * originalRot;

                    transform.rotation = Quaternion.Euler(0, 0, (origz + (degrees - origDegrees) * rotScale) % 360);
                    //transform.Rotate(0, 0, Input.GetAxis("Mouse Y") + Input.GetAxis("Mouse X")* multiplier, Space.World);
                }
            }
        }
    }
Пример #4
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");
                }
            }
        }
    }
Пример #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)
                {
                    //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);
                }
            }
        }
    }
Пример #6
0
 public void Update()
 {
     if (held)
     {
         if (!TouchIsOnMe(InputWatcher.GetInputPosition()))
         {
             //BuildDebugConsole.Flash("touch removed from me");
             held = false;
             return;
         }
         if (t.TimeElapsedSecs() >= 0.2f)
         {
             //BuildDebugConsole.Flash("trying to tap");
             held = false;
             GameEvent tapped = new GameEvent("template_tapped");
             tapped.addArgument(this);
             tapped.addArgument(InputWatcher.GetInputPosition());
             EventManager.Instance().RaiseEvent(tapped);
             Debug.Log("template tapped");
             //BuildDebugConsole.Flash("template tapped");
         }
         else
         {
             //BuildDebugConsole.Flash(GamePause.paused + "" +t.TimeElapsedSecs());
         }
     }
     else
     {
         //BuildDebugConsole.Flash("not being held down");
     }
 }
Пример #7
0
    // Update is called once per frame
    void Update()
    {
        Vector3 mousepos = InputWatcher.GetInputPosition();

        mousepos = new Vector3(mousepos.x - transform.position.x, mousepos.y - transform.position.y, mousepos.z);
        //Debug.Log (touchDown);
        if (touchDown)
        {
            //Debug.Log ("mouse down");
            clickTime += Time.deltaTime;
            //Only allows the dial to spin if the player has been pressing for over a certain amount of time
            if (spinner && clickTime > clickDelay)
            {
                //Probably not the best for dealing with movement on both axis,
                //also will change code to touch controls once we start testing the game on mobile
                float angle       = Mathf.Atan2(mousepos.y, mousepos.x);         // (mousepos.y,mousepos.x);
                float degrees     = (Mathf.Rad2Deg * angle);
                float origDegrees = Mathf.Rad2Deg * originalRot;
                transform.rotation = Quaternion.Euler(0, 0, (origz + (degrees - origDegrees) * rotScale) % 360);
                //Debug.Log (mousepos.x + ", " + mousepos.y);
                //Debug.Log ("origz: " + origz + " & degrees: " + degrees + " & origDegrees: " + origDegrees + "\n" +mousepos.x + ", " + mousepos.y);
                //Debug.Log ("euler: " + transform.rotation.eulerAngles.z);
                PieceController pc = EditorController.GetFloatingPiece();
                if (pc != null)
                {
                    pc.transform.rotation = transform.rotation;
                }
            }
        }
    }
Пример #8
0
 public void Update()
 {
     if (moving && !externalMovement)
     {
         Vector3 inputPos = InputWatcher.GetInputPosition();
         transform.position = inputPos - dragPoint;
         transform.position = new Vector3(transform.position.x, transform.position.y, -1.0f);
     }
 }
Пример #9
0
 public bool TouchIsOnGunButtons()
 {
     foreach (GunButton gb in gunButtons)
     {
         if (gb.TouchIsOnMe(InputWatcher.GetCanvasInputPosition((RectTransform)canvas.transform)))
         {
             return(true);
         }
     }
     return(false);
 }
Пример #10
0
    public void Update()
    {
        //if(Pause.paused)
        //	return;
        if (!spinning)
        {
            return;
        }
        Vector3 mousepos    = InputWatcher.GetCanvasInputPosition((RectTransform)canvas.transform);
        float   mouseAngle  = Mathf.Atan2((mousepos.y - anchorY) - transform.position.y, (mousepos.x - anchorX) - transform.position.x);
        float   angleChange = mouseAngle - startingMouseRot;

        transform.eulerAngles = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y, (startingDialRot + angleChange) * Mathf.Rad2Deg);
    }
Пример #11
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;
        }
    }
Пример #12
0
    public void AttachEntry(EnemyListEntryController elec)
    {
        moving = true;
        GameObject go = Instantiate(Resources.Load("Prefabs/EnemyListEntry")) as GameObject;

        go.transform.SetParent(canvas.transform, false);
        EnemyListEntryController nelec = go.GetComponent <EnemyListEntryController>();

        nelec.ConfigureFromTemplate(elec.GetEnemyTemplate());
        floatingEntry          = nelec;
        floatingEntry.floating = true;
        Vector3 inputPos = InputWatcher.GetInputPosition();

        floatingEntry.transform.position = new Vector3(inputPos.x, inputPos.y, -1.0f);
    }
Пример #13
0
    void Awake()
    {
        gameIsOver = false;

        if (instance != null)
        {
            Destroy(this);
        }
        else
        {
            instance = this;
        }
        inputWatcher    = FindObjectOfType <InputWatcher>();
        soulManager     = FindObjectOfType <SoulManager>();
        audioController = FindObjectOfType <AudioController>();
    }
Пример #14
0
    public void Update()
    {
        if (moving)
        {
            Vector3 inputPos = InputWatcher.GetInputPosition();
            transform.position = inputPos - dragPoint;
            transform.position = new Vector3(transform.position.x, transform.position.y, -1.0f);

            /*RectTransform rt = (RectTransform)transform;
             * Vector3 eulerSave = rt.eulerAngles;
             * rt.eulerAngles = new Vector3(0f,0f,0f);
             * boundsmin = rt.TransformPoint(rt.rect.min);
             * boundsmax = rt.TransformPoint(rt.rect.max);
             * rt.eulerAngles = eulerSave;*/
        }
    }
Пример #15
0
 public void Update()
 {
     if (beingHeld)
     {
         if (!TouchIsOnMe(InputWatcher.GetInputPosition()))
         {
             beingHeld = false;
             return;
         }
         if (holdTimer.TimeElapsedMillis() > 120)
         {
             beingHeld = false;
             WaveEditorController.singleton.AttachEnemy(this);
         }
     }
 }
Пример #16
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);
                }
            }
        }
    }
Пример #17
0
    public void HandleEvent(GameEvent ge)
    {
        Vector3 mousepos = InputWatcher.GetInputPosition();

        if (ge.type.Equals("mouse_release"))
        {
            //Stops the dial from spinning more
            spinner = false;
            //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 / 90.0f) * 90;
                transform.rotation = Quaternion.Euler(0, 0, lockRot);
                PieceController pc = EditorController.GetFloatingPiece();
                if (pc != null)
                {
                    pc.SetRotation(360 - transform.rotation.eulerAngles.z);
                }
            }
            //resets time
            clickTime = 0;
            touchDown = false;
        }
        else if (ge.type.Equals("mouse_click"))
        {
            //Allows the dial to start spinning
            if (spinner == false)
            {
                float dist = Mathf.Sqrt(((mousepos.x - transform.position.x) * (mousepos.x - transform.position.x))
                                        + ((mousepos.y - transform.position.y) * (mousepos.y - transform.position.y)));
                if (dist > radius)
                {
                    return;
                }
                originalRot = Mathf.Atan2(mousepos.y - transform.position.y, mousepos.x - transform.position.x);
                origz       = transform.eulerAngles.z;
                //Debug.Log ("new original degrees: " + originalRot);
            }
            spinner   = true;
            touchDown = true;
        }
    }
Пример #18
0
    public void Update()
    {
        if (Pause.paused)
        {
            return;
        }
        if (!spinning)
        {
            return;
        }
        Vector3 mousepos    = InputWatcher.GetCanvasInputPosition((RectTransform)canvas.transform);
        float   mouseAngle  = Mathf.Atan2((mousepos.y - anchorY) - transform.position.y, (mousepos.x - anchorX) - transform.position.x);
        float   angleChange = (mouseAngle - startingMouseRot) * directionMult;

        //Debug.Log("rotlockisLocked is " + rotLockIsLocked);
        //Debug.Log("anglechange is " + angleChange);
        if (rotLockIsOn)
        {
            if (rotLockIsLocked)
            {
                angleChange = 0f;
            }
            else
            {
                //cap anglechange to 2 lanes either direction
                if (angleChange > (2 * Mathf.PI / 3))
                {
                    angleChange = 2 * Mathf.PI / 3;
                }
                else if (angleChange < -(2 * Mathf.PI / 3))
                {
                    angleChange = -2 * Mathf.PI / 3;
                }
                if (Mathf.Abs(angleChange - oldAngleChange) > angleChangeThreshold)
                {
                    angleChange = oldAngleChange;
                    mouseAngle  = oldMouseAngle;
                }
            }
        }
        transform.eulerAngles = new Vector3(transform.eulerAngles.x, transform.eulerAngles.y, (startingDialRot + angleChange) * Mathf.Rad2Deg);
        oldAngleChange        = angleChange;
        oldMouseAngle         = mouseAngle;
    }
Пример #19
0
    public void Update()
    {
        if (!gridloaded)
        {
            gridloaded = true;
            GameObject loader = GameObject.Find("NameHolder");
            LoadTower(loader.GetComponent <TowerLoad> ().towerName);
            Destroy(loader);
        }

        if (frameDelay > 0)
        {
            frameDelay--;
            if (frameDelay <= 0)
            {
                clearCheckPanel.SetActive(false);
            }
        }

        if (floatingPiece != null && floatingPiece.IsMoving())
        {
            if (sr.vertical)
            {
                sr.vertical = false;
            }
        }
        else
        {
            if (!sr.vertical)
            {
                sr.vertical = true;
            }
        }

        if (finger2down && finger1down)
        {
            Vector3 altClickPos   = InputWatcher.GetInputPosition(1);
            Vector3 firstClickPos = InputWatcher.GetInputPosition();
            Vector3 direction     = altClickPos - firstClickPos;
            float   newAngle      = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
            float   diff          = newAngle - twoFingerAngle;
            floatingPiece.transform.eulerAngles = new Vector3(0, 0, pieceAngle + diff);
        }
    }
Пример #20
0
    public void HandleEvent(GameEvent ge)
    {
        Vector3 mousepos = InputWatcher.GetInputPosition();

        mousepos = new Vector3(mousepos.x - spinPivot.transform.position.x, mousepos.y - spinPivot.transform.position.y, mousepos.z);
        if (ge.type.Equals("mouse_release"))
        {
            //Stops the dial from spinning more
            spinner = false;
            //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 / lockThreshold) * lockThreshold;
                transform.rotation = Quaternion.Euler(0, 0, lockRot);
                menuPosition       = (int)lockRot / lockThreshold;
                if (Child.GetComponent <MenuClickScript>() != null)
                {
                    Child.GetComponent <MenuClickScript>().menuPosition = menuPosition % menuMax;
                }

                /*if(Child.GetComponent<MenuInGame>() != null){
                 *      Child.GetComponent<MenuInGame>().menuPosition = (menuPosition % menuMax) % 4;
                 * }*/
            }
            //resets time
            clickTime = 0;
            touchDown = false;
        }
        else if (ge.type.Equals("mouse_click"))
        {
            //Allows the dial to start spinning
            if (spinner == false)
            {
                originalRot = Mathf.Atan2(mousepos.y, mousepos.x);
                origz       = transform.eulerAngles.z;
                //Debug.Log ("new original degrees: " + originalRot);
            }
            spinner   = true;
            touchDown = true;
        }
    }
Пример #21
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);
                }
            }
        }
    }
 public void Update()
 {
     if (held)
     {
         if (!TouchIsOnMe(InputWatcher.GetInputPosition()))
         {
             held = false;
             return;
         }
         if (t.TimeElapsedSecs() >= 0.4f)
         {
             held = false;
             GameEvent tapped = new GameEvent("template_tapped");
             tapped.addArgument(this);
             tapped.addArgument(InputWatcher.GetInputPosition());
             EventManager.Instance().RaiseEvent(tapped);
         }
     }
 }
Пример #23
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;
                }
            }
        }
    }
Пример #24
0
        public ActivityTracker(Configuration configuration, DailyActivity dailyActivity)
        {
            this.dailyActivity = dailyActivity;

            this.winEventDelegate = new WinEventDelegate(WinEventProc);
            this.winEventHook     = NativeMethods.SetWinEventHook(NativeMethods.EVENT_SYSTEM_FOREGROUND, NativeMethods.EVENT_SYSTEM_FOREGROUND, IntPtr.Zero, this.winEventDelegate, 0, 0, NativeMethods.WINEVENT_OUTOFCONTEXT);

            this.Watchers = new Dictionary <BaseWatcher, WatcherVM>();

            var lockScreenWatcher = new LockScreenWatcher("Lock Screen", ActivityId.Away);

            lockScreenWatcher.PropertyChanged += (object obj, PropertyChangedEventArgs args) => { this.Watchers[(BaseWatcher)obj].Active = ((LockScreenWatcher)obj).CurrentState == LockScreenWatcher.State.Active; };
            this.Watchers.Add(lockScreenWatcher, new WatcherVM(lockScreenWatcher));

            var inputWatcher = new InputWatcher("Idle", ActivityManager.GetActivityFromName("Idle"), 60, 1000);

            inputWatcher.PropertyChanged += (object obj, PropertyChangedEventArgs args) => { this.Watchers[(BaseWatcher)obj].Active = ((InputWatcher)obj).CurrentState == InputWatcher.State.Inactive; };
            this.Watchers.Add(inputWatcher, new WatcherVM(inputWatcher));

            foreach (var watcherConfig in configuration.ProcessFocusWatchers)
            {
                var watcher = new ProcessFocusWatcher(watcherConfig.DisplayName, ActivityManager.GetActivityFromName(watcherConfig.ActivityName), watcherConfig.ProcessName);
                watcher.PropertyChanged += (object obj, PropertyChangedEventArgs args) => { this.Watchers[(BaseWatcher)obj].Active = ((ProcessFocusWatcher)obj).CurrentState == ProcessFocusWatcher.State.Active; };
                this.Watchers.Add(watcher, new WatcherVM(watcher));
            }

            foreach (var watcherConfig in configuration.ProcessActivityWatchers)
            {
                var watcher = new ProcessActivityWatcher(watcherConfig.DisplayName, ActivityManager.GetActivityFromName(watcherConfig.ActivityName), watcherConfig.ProcessName, watcherConfig.CPUUsageThresholdForRunning, watcherConfig.DelayBeforeReturnToInactiveInSeconds, watcherConfig.UpdatePeriodInSeconds);
                watcher.PropertyChanged += (object obj, PropertyChangedEventArgs args) => { this.Watchers[(BaseWatcher)obj].Active = ((ProcessActivityWatcher)obj).CurrentState == ProcessActivityWatcher.State.Running; };
                this.Watchers.Add(watcher, new WatcherVM(watcher));
            }

            foreach (var watcher in this.Watchers)
            {
                watcher.Value.PropertyChanged += watcher_PropertyChanged;
            }

            // Force update the current activity
            watcher_PropertyChanged(null, null);
        }
Пример #25
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);
                    //}
                }
            }
        }
    }
Пример #26
0
 public void Update()
 {
     if (WaveEditorController.singleton.IsMoving())
     {
         if (!glowIsOn && TouchIsOnMe(InputWatcher.GetInputPosition()))
         {
             glowIsOn = true;
             glow.SetActive(glowIsOn);
         }
         if (glowIsOn && !TouchIsOnMe(InputWatcher.GetInputPosition()))
         {
             glowIsOn = false;
             glow.SetActive(glowIsOn);
         }
     }
     else
     {
         glowIsOn = false;
         glow.SetActive(glowIsOn);
     }
 }
Пример #27
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]);
                 }
             }
         }
     }
 }
Пример #28
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");
                }
            }
        }
    }
Пример #29
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;
                }
            }
        }
    }
Пример #30
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;
                     * }*/
                }
            }
        }
    }