Esempio n. 1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetMouseButtonDown(0) && LeftBlock.Contains(fixedMousePos))
     {
         texFade.Add(new TextureFade()
         {
             pos = new Rect(fixedMousePos.x - 16, fixedMousePos.y - 16, 32, 32), tex = clickTex
         });
         quickCount++;
         clicks.Add(new ClickInfo()
         {
             cTime = Time.time
         });
         accClicks++;
         MinedHashes += HashesPerClick;
         clickedHashes++;
     }
     if (quickCount > 0)
     {
         for (int i = 0; i < quickCount; ++i)
         {
             texFade[i].time += Time.deltaTime;
             if (texFade[i].time > fadeTime)
             {
                 texFade.RemoveAt(i);
                 --quickCount;
             }
         }
     }
     if (accClicks > 0)
     {
         for (int i = 0; i < accClicks; ++i)
         {
             if (Time.time - clicks[i].cTime > accTime)
             {
                 clicks.RemoveAt(i);
                 --accClicks;
             }
         }
     }
     AccHashRate = accClicks * HashesPerClick;
     if (RightBlock.Contains(fixedMousePos) && Input.GetAxis("Mouse ScrollWheel") != 0 && Transistors.rightScroll >= 0 && Transistors.rightScroll <= unblockedTrans.Count * itemTransHeight - (RightBlock.height - RightBlock.yMin))
     {
         Transistors.rightScroll -= Input.GetAxis("Mouse ScrollWheel") / Time.deltaTime;
     }
     if (Input.GetKeyDown(KeyCode.F11) && !Screen.fullScreen)
     {
         Screen.SetResolution(Screen.resolutions[0].width, Screen.resolutions[0].height, false);
         Debug.Log("Going to fullscreen...");
     }
     else if (Input.GetKeyDown(KeyCode.Escape) && Screen.fullScreen)
     {
         Screen.fullScreen = false;
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Traverse the blocks in a direction
        /// </summary>
        /// <param name="nDepth">The max count to traverse</param>
        /// <param name="direction">The direction to traverse</param>
        /// <param name="delimiter">A delimination check</param>
        /// <returns>Number of blocks traversed</returns>
        public int BlockTraverse(int nDepth, BlockDirection direction, BlockTraversalDelimiter delimiter)
        {
            if (delimiter(this))
            {
                return(0);
            }

            if (nDepth > 0)
            {
                switch (direction)
                {
                case BlockDirection.Up:
                    if (UpBlock != null)
                    {
                        return(UpBlock.BlockTraverse(nDepth - 1, direction, delimiter) + 1);
                    }
                    break;

                case BlockDirection.Down:
                    if (DownBlock != null)
                    {
                        return(DownBlock.BlockTraverse(nDepth - 1, direction, delimiter) + 1);
                    }
                    break;

                case BlockDirection.Left:
                    if (LeftBlock != null)
                    {
                        return(LeftBlock.BlockTraverse(nDepth - 1, direction, delimiter) + 1);
                    }
                    break;

                case BlockDirection.Right:
                    if (RightBlock != null)
                    {
                        return(RightBlock.BlockTraverse(nDepth - 1, direction, delimiter) + 1);
                    }
                    break;
                }
            }
            return(0);
        }