Esempio n. 1
0
        Clockwise MakeClockwise(string clockName, int index, Vector3 rotation)
        {
            var newClockwise = new Clockwise
            {
                Name = clockName, Index = index, ClockwiseRotation = Quaternion.Euler(rotation)
            };

            newClockwise.DesiredQuaternion = Quaternion.Euler(new Vector3(0f, newClockwise.ClockwiseRotation.eulerAngles.y + 45f, 0f));
            return(newClockwise);
        }
Esempio n. 2
0
        void Awake()
        {
            if (_gameManager == null)
            {
                _gameManager = FindObjectOfType <GameManager>();
            }
            if (mainCanvas == null)
            {
                mainCanvas = FindObjectOfType <MainCanvas>().transform;
            }
            if (board == null)
            {
                board = FindObjectOfType <Board>();
            }

            // boundary
            xMin = GameUtility.interval * limit;
            xMax = GameUtility.interval * (board.boardSize.x - limit);
            zMin = GameUtility.interval * limit;
            zMax = GameUtility.interval * (board.boardSize.y - limit);

            // make clockwise List
            _clockwiseList = new List <Clockwise>();
            _zeroClock     = MakeClockwise("zeroClock", 0, GameUtility.ZeroClockRotation);
            _threeClock    = MakeClockwise("threeClock", 1, GameUtility.ThreeClockRotation);
            _sixClock      = MakeClockwise("sixClock", 2, GameUtility.SixClockRotation);
            _nineClock     = MakeClockwise("nineClock", 3, GameUtility.NineClockRotation);
            _clockwiseList.Add(_zeroClock);
            _clockwiseList.Add(_threeClock);
            _clockwiseList.Add(_sixClock);
            _clockwiseList.Add(_nineClock);
            currentClock = _clockwiseList[0];

            // make screen edge
            _desiredVector = new Vector3(horizontalWeight, 0f, verticalWeight);
            _leftRect      = new Rect(-1, -1, screenEdgeBorder, Screen.height);
            _rightRect     = new Rect(Screen.width - screenEdgeBorder, -1, screenEdgeBorder, Screen.height);
            _upRect        = new Rect(-1, Screen.height - screenEdgeBorder + 1, Screen.width, screenEdgeBorder);
            _downRect      = new Rect(-1, -1, Screen.width, screenEdgeBorder);

            _thisTransform = transform;
            if (thisCamera == null)
            {
                thisCamera = transform.Find("Camera").GetComponent <Camera>();
            }

            _rangeVectorList = new List <Vector3> {
                _rangeDown, _rangeMiddle, _rangeUp
            };
        }
Esempio n. 3
0
        public void RotateButton(int add)
        {
            if (!useRotate)
            {
                return;
            }
            if (add == 0)
            {
                return;
            }

            int newClockIndex = currentClock.Index + add;

            if (newClockIndex < 0)
            {
                newClockIndex = 3;
            }
            else if (newClockIndex > 3)
            {
                newClockIndex = 0;
            }
            currentClock       = _clockwiseList[newClockIndex];
            transform.rotation = currentClock.ClockwiseRotation;
        }