public void MoveTable(ModbusTable table = null, int index = -1, MOVE_DIRECTION direct = MOVE_DIRECTION.UP)
        {
            if (Current != null)
            {
                int _currentindex = Current.Current;
                Current.Move(table, index, direct);
                switch (direct)
                {
                case MOVE_DIRECTION.UP:
                    if (--_currentindex >= 0)
                    {
                        DG_Table.SelectedIndex = _currentindex;
                    }
                    break;

                case MOVE_DIRECTION.DOWN:
                    if (++_currentindex < Tables.Count())
                    {
                        DG_Table.SelectedIndex = _currentindex;
                    }
                    break;
                }
                Current  = Current;
                IsModify = true;
            }
        }
Пример #2
0
    bool CanMove(MOVE_DIRECTION moveDirection)
    {
        Dictionary <MOVE_DIRECTION, bool> availableMoves = GetAvailableMoves();
        bool canMove;

        availableMoves.TryGetValue(moveDirection, out canMove);
        Debug.Log("canMove = " + canMove);
        return(canMove);
    }
Пример #3
0
 private void ChangeDirection()
 {
     if (moveDirection == MOVE_DIRECTION.RIGHT)
     {
         moveDirection = MOVE_DIRECTION.LEFT;
     }
     else if (moveDirection == MOVE_DIRECTION.LEFT)
     {
         moveDirection = MOVE_DIRECTION.RIGHT;
     }
 }
Пример #4
0
 void ChangeDirection()
 {
     if (movedirection == MOVE_DIRECTION.RIGHT)
     {
         //左に移動
         movedirection = MOVE_DIRECTION.LEFT;
     }
     else
     {
         //右に移動
         movedirection = MOVE_DIRECTION.RIGHT;
     }
 }
Пример #5
0
 protected void ReverseMovement()
 {
     if (moveDirection == MOVE_DIRECTION.right)
     {
         moveDirection = MOVE_DIRECTION.left;
     }
     else
     {
         moveDirection = MOVE_DIRECTION.right;
     }
     move = DetermineMoveX(moveDirection);
     FlipSprite(move.x);
 }
Пример #6
0
 void ChangeDirection()                         //向きを変える関数
 {
     if (moveDirection == MOVE_DIRECTION.RIGHT) //もし、右向きだったら
     {
         //左に移動
         moveDirection = MOVE_DIRECTION.LEFT;
     }
     else
     {
         //右に移動
         moveDirection = MOVE_DIRECTION.RIGHT;
     }
 }
Пример #7
0
    private void Move()
    {
        if (isDead || isClear)
        {
            return;
        }

        float x = Input.GetAxis("Horizontal");

        animator.SetFloat("speed", Mathf.Abs(x));

        if (x == 0)
        {
            moveDirection = MOVE_DIRECTION.STOP;
        }
        else if (x > 0)
        {
            moveDirection = MOVE_DIRECTION.RIGHT;
        }
        else if (x < 0)
        {
            moveDirection = MOVE_DIRECTION.LEFT;
        }

        switch (moveDirection)
        {
        case MOVE_DIRECTION.STOP:
            speed = 0;
            break;

        case MOVE_DIRECTION.RIGHT:
            speed = 5;
            transform.localScale = new Vector3(1, 1, 1);
            break;

        case MOVE_DIRECTION.LEFT:
            speed = -5;
            transform.localScale = new Vector3(-1, 1, 1);
            break;
        }
        rb2D.velocity = new Vector2(speed, rb2D.velocity.y);
        Vector2 pos = transform.position;

        if (pos.x < -17.5f)
        {
            pos.x = -17.5f;
            transform.position = pos;
        }
    }
Пример #8
0
 public void SetBallMoveLeft(bool _isMoveLeft)
 {
     if (_isMoveLeft)
     {
         moveDirection                    = MOVE_DIRECTION.LEFT;
         transform.localScale             = new Vector2(-1, 1);
         isMoveLeft                       = true;
         isMoveRight                      = false;
         playerRigidbody2D.freezeRotation = true;
         playerRigidbody2D.velocity       = new Vector2(0, playerRigidbody2D.velocity.y);
     }
     else
     {
         isMoveLeft = false;
     }
 }
Пример #9
0
    // Update is called once per frame
    void Update()
    {
        //死んだら、何も処理しない
        if (isDead)
        {
            return;
        }
        //UIボタンから操作していない場合は、キー入力からxの値を取得。(if文を追加)
        if (!usingButtons)
        {
            x = Input.GetAxis("Horizontal");
        }
        animator.SetFloat("speed", Mathf.Abs(x));          //歩く動作のアニメーション

        if (x == 0)
        {
            //止まる
            moveDirection = MOVE_DIRECTION.STOP;
        }
        else if (x < 0)
        {
            //右に移動
            moveDirection = MOVE_DIRECTION.RIGHT;
        }
        else if (x > 0)
        {
            //左に移動
            moveDirection = MOVE_DIRECTION.LEFT;
        }
        //地面に着地した時
        if (IsGround() && !usingButtons)
        {
            //スペースキーを押してジャンプする
            if (Input.GetKeyDown("space"))
            {
                Jump();
                animator.SetBool("isJumping", true);            //ジャンプ動作をするアニメーション
                audioSource.PlayOneShot(jumpSE);                //ジャンプした時の効果音
            }

            else
            {
                animator.SetBool("isJumping", false);          //ジャンプ動作をしないアニメーション
            }
        }
    }
        public void MoveModel(ModbusTableModel model = null, int index = -1, MOVE_DIRECTION direct = MOVE_DIRECTION.UP)
        {
            _ArguemntsTranslate(ref model, ref index);
            switch (direct)
            {
            case MOVE_DIRECTION.UP:
                if (index > 0)
                {
                    RemoveModel(model);
                    AddModel(model, index - 1);
                }
                break;

            case MOVE_DIRECTION.DOWN:
                if (index < Models.Count() - 1)
                {
                    RemoveModel(model);
                    AddModel(model, index + 1);
                }
                break;
            }
        }
Пример #11
0
 private MOVE_DIRECTION GetAlternativeDirection(MOVE_DIRECTION dir)
 {
     if (dir == MOVE_DIRECTION.DIR_NORTH)
     {
         return((MOVE_DIRECTION)ConfigManager.RandomGen.Next((int)MOVE_DIRECTION.DIR_EAST, (int)MOVE_DIRECTION.DIR_WEST));
     }
     else if (dir == MOVE_DIRECTION.DIR_SOUTH)
     {
         return((MOVE_DIRECTION)ConfigManager.RandomGen.Next((int)MOVE_DIRECTION.DIR_EAST, (int)MOVE_DIRECTION.DIR_WEST));
     }
     else if (dir == MOVE_DIRECTION.DIR_EAST)
     {
         return((MOVE_DIRECTION)ConfigManager.RandomGen.Next((int)MOVE_DIRECTION.DIR_NORTH, (int)MOVE_DIRECTION.DIR_SOUTH));
     }
     else if (dir == MOVE_DIRECTION.DIR_WEST)
     {
         return((MOVE_DIRECTION)ConfigManager.RandomGen.Next((int)MOVE_DIRECTION.DIR_NORTH, (int)MOVE_DIRECTION.DIR_SOUTH));
     }
     else
     {
         return(GetRandomDirection());
     }
 }
Пример #12
0
 private MOVE_DIRECTION GetOppositeDirection(MOVE_DIRECTION dir)
 {
     if (dir == MOVE_DIRECTION.DIR_NORTH)
     {
         return(MOVE_DIRECTION.DIR_SOUTH);
     }
     else if (dir == MOVE_DIRECTION.DIR_SOUTH)
     {
         return(MOVE_DIRECTION.DIR_NORTH);
     }
     else if (dir == MOVE_DIRECTION.DIR_EAST)
     {
         return(MOVE_DIRECTION.DIR_WEST);
     }
     else if (dir == MOVE_DIRECTION.DIR_WEST)
     {
         return(MOVE_DIRECTION.DIR_EAST);
     }
     else
     {
         return(GetRandomDirection());
     }
 }
Пример #13
0
    // Update is called once per frame
    void Update()
    {
        float x = Input.GetAxis("Horizontal");

        if (x == 0)
        {
            //止まる
            movedirection = MOVE_DIRECTION.STOP;
        }
        else if (x > 0)
        {
            //右に移動
            movedirection = MOVE_DIRECTION.RIGHT;
        }
        else if (x < 0)
        {
            //左に移動
            movedirection = MOVE_DIRECTION.LEFT;
        }
        if (IsGround() && Input.GetKeyDown("space"))
        {
            Jump();
        }
    }
        public void Move(ModbusTable table = null, int index = -1, MOVE_DIRECTION direct = MOVE_DIRECTION.UP)
        {
            _ArguemntsTranslate(ref table, ref index);
            switch (direct)
            {
            case MOVE_DIRECTION.UP:
                if (index > 0)
                {
                    tables.Remove(table);
                    tables.Insert(index - 1, table);
                    Current = index - 1;
                }
                break;

            case MOVE_DIRECTION.DOWN:
                if (index < tables.Count - 1)
                {
                    tables.Remove(table);
                    tables.Insert(index + 1, table);
                    Current = index + 1;
                }
                break;
            }
        }
 // Signal search 1 drive : 신호 검출-1 구동
 [DllImport("AxtLib.dll")] public static extern void CFSKeSignalSearch1Drive(short axis,
                                                                             ushort ulRange, ushort ulSTSPSpeedData, ushort ulObjectSpeedData,
                                                                             ushort ulRate1Data, ushort ulRate2Data, ushort ulRate3Data,
                                                                             ushort ulRCPoint12, ushort ulRCPoint23, MOVE_DIRECTION nDirection);
Пример #16
0
    // Update is called once per frame
    void Update()
    {
        Vector3 scale     = gameObject.transform.localScale;
        float   jumpForce = 680.0f;

        float x = Input.GetAxis("Horizontal");

        if (x == 0)
        {
            //止まる
            moveDirection = MOVE_DIRECTION.STOP;
        }
        else if (x > 0)
        {
            //右に移動
            moveDirection = MOVE_DIRECTION.RIGHT;
            scale.x       = 100; // そのまま(右向き)
            gameObject.transform.localScale = scale;
        }

        else if (x < 0)
        {
            //左に移動
            moveDirection = MOVE_DIRECTION.LEFT;
            scale.x       = -100; // そのまま(左向き)
            gameObject.transform.localScale = scale;
        }

        if (IsGround() && Input.GetKeyDown("space"))
        {
            Jump();
        }

        // 左・右ボタン長押し用
        if (!this.push)
        {
            this.boolRight = false;
            this.boolLeft  = false;
        }

        // 左・右キー押下処理
        float speedx = Mathf.Abs(this.rigidbody2D.velocity.x);

        if (Input.GetKey(KeyCode.RightArrow) || boolRight)
        {
            // 右キー押下時
            this.rigidbody2D.AddForce(transform.right * this.walkForce * 700);
            scale.x = 100; // そのまま(右向き)
            if (speedx < this.maxWalkSpeed)
            {
                this.rigidbody2D.AddForce(transform.right * this.walkForce * 700);
                scale.x = 100;
                gameObject.transform.localScale = scale;
            }
        }
        else if (Input.GetKey(KeyCode.LeftArrow) || boolLeft)
        {
            // 左キー押下時
            this.rigidbody2D.AddForce(transform.right * this.walkForce * -700);
            scale.x = -100; // 左向き
            if (speedx < this.maxWalkSpeed)
            {
                this.rigidbody2D.AddForce(transform.right * this.walkForce * -700);
                scale.x = -100;
                gameObject.transform.localScale = scale;
            }
        }
        //クリア後
        if (clear == 3)
        {
            Debug.Log("Clear!!!!!");
            SceneManager.LoadScene("AfterRoom5");
        }
    }
Пример #17
0
 protected void SetMovement()
 {
     moveDirection = MoveDirection();
     move          = DetermineMoveX(moveDirection);
     FlipSprite(move.x);
 }
Пример #18
0
    // Update is called once per frame
    void Update()
    {
        if (Config.currGameState == Config.GAMESTATE.PLAYING)
        {
            speedX = 0;
            speedY = playerRigidbody2D.velocity.y;
            //Debug.Log(speedY);
            if (isMoveRight)
            {
                //playerRigidbody2D.velocity = new Vector2(MOVE_MAX_SPEED, playerRigidbody2D.velocity.y);
                playerRigidbody2D.freezeRotation = false;
                speedX = playerRigidbody2D.velocity.x + MOVE_SPEED_INCREASE * Time.deltaTime;
                //Debug.Log("isMoveRight:" + speedX);
                if (speedX >= MOVE_MAX_SPEED)
                {
                    speedX = MOVE_MAX_SPEED;
                }
            }
            else if (isMoveLeft)
            {
                //playerRigidbody2D.velocity = new Vector2(-MOVE_MAX_SPEED, playerRigidbody2D.velocity.y);
                playerRigidbody2D.freezeRotation = false;

                speedX = playerRigidbody2D.velocity.x - MOVE_SPEED_INCREASE * Time.deltaTime;
                if (speedX <= -MOVE_MAX_SPEED)
                {
                    speedX = -MOVE_MAX_SPEED;
                }
            }
            else
            {
                //speedX = 0;
                //playerRigidbody2D.freezeRotation = true;
                if (moveDirection == MOVE_DIRECTION.RIGHT)
                {
                    speedX = playerRigidbody2D.velocity.x - MOVE_SPEED_DECREASE * Time.deltaTime;
                    if (speedX <= 0)
                    {
                        speedX        = 0;
                        moveDirection = MOVE_DIRECTION.NONE;
                    }
                }
                else if (moveDirection == MOVE_DIRECTION.LEFT)
                {
                    speedX = playerRigidbody2D.velocity.x + MOVE_SPEED_DECREASE * Time.deltaTime;
                    if (speedX >= 0)
                    {
                        speedX        = 0;
                        moveDirection = MOVE_DIRECTION.NONE;
                    }
                }
            }
            if (!isGrounded)
            {
                if (speedY > 0)
                {
                    speedY += -JUMPE_SPEED_UP * Time.deltaTime;
                }
                else
                {
                    speedY += -JUMPE_SPEED_DOWN * Time.deltaTime;
                }
            }

            if (isSpecialMoveX)
            {
                if (playerRigidbody2D.velocity.x < 0)
                {
                    speedX = playerRigidbody2D.velocity.x + SPECIAL_MOVE_SPEED_DECREASE * Time.deltaTime;

                    if (speedX > 0)
                    {
                        isSpecialMoveX = false;
                    }
                }
                else
                {
                    speedX = playerRigidbody2D.velocity.x - SPECIAL_MOVE_SPEED_DECREASE * Time.deltaTime;
                    if (speedX < 0)
                    {
                        isSpecialMoveX = false;
                    }
                }
            }
            //Debug.Log("SPEED Y:" + speedY);
            playerRigidbody2D.velocity = new Vector2(speedX, speedY);

            bool newIsGrounded = CheckIsGrounded();
            if (isGrounded != newIsGrounded)
            {
                isGrounded = newIsGrounded;
                if (isGrounded)
                {
                    //Vua cham dat
                    SetFallDown_Finished();
                }
            }
        }
        else
        {
            playerRigidbody2D.velocity = Vector2.zero;
        }


        typeBall = BALL_ROLL_TYPE.NONE;
        if (isMoveRight)
        {
            // if (playerRigidbody2D.velocity.x < MOVE_MAX_SPEED && Mathf.Abs(playerRigidbody2D.velocity.y) < 0.5f)
            {
                typeBall = BALL_ROLL_TYPE.RIGHT;
            }
        }
        else if (isMoveLeft)
        {
            // if (playerRigidbody2D.velocity.x > -MOVE_MAX_SPEED && Mathf.Abs(playerRigidbody2D.velocity.y) < 0.5f)
            {
                typeBall = BALL_ROLL_TYPE.LEFT;
            }
        }

        UpdateBallType();
    }
Пример #19
0
 protected Vector2 DetermineMoveX(MOVE_DIRECTION moveDirection)
 {
     return((moveDirection == MOVE_DIRECTION.left) ? Vector2.left : Vector2.right);
 }
Пример #20
0
        private void Engine()
        {
            RoomMap.MAPTYPE maptype;
            Object          item = null;

            gwinfo = GameDataFactory.curr_gwinfo;

            int  step_forward = 0;
            bool collision    = false;

            curr_dir = GetRandomDirection();

            while (true)
            {
                CheckPause();



                //Pick a Random Direction First
                //While no collison move with explore distance
                //Hit somethin go the opposite way and Pick a Random Direction
                //Move Forward

                step_forward = 0;
                collision    = false;

                while (!collision)
                {
                    CheckPause();

                    if (step_forward <= explore_distance)
                    {
                        switch (curr_dir)
                        {
                        case MOVE_DIRECTION.DIR_NORTH:

                            maptype = roommap.ItemAtPostion(col - PlayUIWorldMap.mapBoxColPos, row - 1 - PlayUIWorldMap.mapBoxRowPos);
                            item    = gwinfo.CheckRoomPointOccupied(col - PlayUIWorldMap.mapBoxColPos, row - 1 - PlayUIWorldMap.mapBoxRowPos, GameState.currentRoom);

                            if (maptype == RoomMap.MAPTYPE.SPACE && item == null)
                            {
                                MoveNorth();
                            }
                            else
                            {
                                collision = true;
                            }

                            break;

                        case MOVE_DIRECTION.DIR_SOUTH:

                            maptype = roommap.ItemAtPostion(col - PlayUIWorldMap.mapBoxColPos, row + 1 - PlayUIWorldMap.mapBoxRowPos);
                            item    = gwinfo.CheckRoomPointOccupied(col - PlayUIWorldMap.mapBoxColPos, row + 1 - PlayUIWorldMap.mapBoxRowPos, GameState.currentRoom);

                            if (maptype == RoomMap.MAPTYPE.SPACE && item == null)
                            {
                                MoveSouth();
                            }
                            else
                            {
                                collision = true;
                            }

                            break;

                        case MOVE_DIRECTION.DIR_EAST:

                            maptype = roommap.ItemAtPostion(col + 1 - PlayUIWorldMap.mapBoxColPos, row - PlayUIWorldMap.mapBoxRowPos);
                            item    = gwinfo.CheckRoomPointOccupied(col + 1 - PlayUIWorldMap.mapBoxColPos, row - PlayUIWorldMap.mapBoxRowPos, GameState.currentRoom);
                            if (maptype == RoomMap.MAPTYPE.SPACE && item == null)
                            {
                                MoveEast();
                            }
                            else
                            {
                                collision = true;
                            }

                            break;

                        case MOVE_DIRECTION.DIR_WEST:

                            maptype = roommap.ItemAtPostion(col - 1 - PlayUIWorldMap.mapBoxColPos, row - PlayUIWorldMap.mapBoxRowPos);
                            item    = gwinfo.CheckRoomPointOccupied(col - 1 - PlayUIWorldMap.mapBoxColPos, row - PlayUIWorldMap.mapBoxRowPos, GameState.currentRoom);
                            if (maptype == RoomMap.MAPTYPE.SPACE && item == null)
                            {
                                MoveWest();
                            }
                            else
                            {
                                collision = true;
                            }

                            break;
                        }// Switch

                        if (collision)
                        {
                            //Break Switch
                            break;
                        }

                        CheckPause();
                        step_forward++;
                    }
                    else
                    {
                        CheckPause();
                        curr_dir     = GetRandomDirection();
                        step_forward = 0;
                        break;
                    }

                    CheckPause();
                    Thread.Sleep(500);
                }

                CheckPause();
                Thread.Sleep(500);
                //************************************************************

                //Move Oppsite
                curr_dir     = this.GetOppositeDirection(curr_dir);
                step_forward = 0;
                collision    = false;
                while (!collision)
                {
                    CheckPause();

                    if (step_forward <= retreat_distance)
                    {
                        switch (curr_dir)
                        {
                        case MOVE_DIRECTION.DIR_NORTH:

                            maptype = roommap.ItemAtPostion(col - PlayUIWorldMap.mapBoxColPos, row - 1 - PlayUIWorldMap.mapBoxRowPos);
                            item    = gwinfo.CheckRoomPointOccupied(col - PlayUIWorldMap.mapBoxColPos, row - 1 - PlayUIWorldMap.mapBoxRowPos, GameState.currentRoom);

                            if (maptype == RoomMap.MAPTYPE.SPACE && item == null)
                            {
                                MoveNorth();
                            }
                            else
                            {
                                collision = true;
                            }

                            break;

                        case MOVE_DIRECTION.DIR_SOUTH:

                            maptype = roommap.ItemAtPostion(col - PlayUIWorldMap.mapBoxColPos, row + 1 - PlayUIWorldMap.mapBoxRowPos);
                            item    = gwinfo.CheckRoomPointOccupied(col - PlayUIWorldMap.mapBoxColPos, row + 1 - PlayUIWorldMap.mapBoxRowPos, GameState.currentRoom);

                            if (maptype == RoomMap.MAPTYPE.SPACE && item == null)
                            {
                                MoveSouth();
                            }
                            else
                            {
                                collision = true;
                            }

                            break;

                        case MOVE_DIRECTION.DIR_EAST:

                            maptype = roommap.ItemAtPostion(col + 1 - PlayUIWorldMap.mapBoxColPos, row - PlayUIWorldMap.mapBoxRowPos);
                            item    = gwinfo.CheckRoomPointOccupied(col + 1 - PlayUIWorldMap.mapBoxColPos, row - PlayUIWorldMap.mapBoxRowPos, GameState.currentRoom);
                            if (maptype == RoomMap.MAPTYPE.SPACE && item == null)
                            {
                                MoveEast();
                            }
                            else
                            {
                                collision = true;
                            }

                            break;

                        case MOVE_DIRECTION.DIR_WEST:

                            maptype = roommap.ItemAtPostion(col - 1 - PlayUIWorldMap.mapBoxColPos, row - PlayUIWorldMap.mapBoxRowPos);
                            item    = gwinfo.CheckRoomPointOccupied(col - 1 - PlayUIWorldMap.mapBoxColPos, row - PlayUIWorldMap.mapBoxRowPos, GameState.currentRoom);
                            if (maptype == RoomMap.MAPTYPE.SPACE && item == null)
                            {
                                MoveWest();
                            }
                            else
                            {
                                collision = true;
                            }

                            break;
                        }// Switch

                        if (collision)
                        {
                            //Break Switch
                            curr_dir = GetAlternativeDirection(curr_dir);
                            break;
                        }
                        CheckPause();
                        step_forward++;
                    }
                    else
                    {
                        CheckPause();
                        //curr_dir = GetRandomDirection();
                        curr_dir = GetAlternativeDirection(curr_dir);

                        collision = true;
                        break;
                    }

                    CheckPause();
                    Thread.Sleep(500);
                }

                CheckPause();
                Thread.Sleep(500);
            } //Main Engine Loop
        }     //Engine Function
Пример #21
0
 private void MovePicterBoxByStep(PictureBox pb, MOVE_DIRECTION direction)
 {
     switch (direction)
     {
         case MOVE_DIRECTION.LEFT:
             pb.Left -= 1;
             break;
         case MOVE_DIRECTION.UP:
             pb.Top -= 1;
             break;
         case MOVE_DIRECTION.RIGHT:
             pb.Left += 1;
             break;
         case MOVE_DIRECTION.DOWN:
             pb.Top += 1;
             break;
         default:
             break;
     }
 }
        /// <summary>
        /// Navigates the editor's caret to the next editable region.
        /// </summary>
        /// <param name="direction"></param>
        private bool MoveCaretToNextRegion(MOVE_DIRECTION direction)
        {
            IHTMLElement nextRegion;
            _ELEMENT_ADJACENCY nextRegionAdjacency;
            bool preserveXLocation;
            if (direction == MOVE_DIRECTION.UP || direction == MOVE_DIRECTION.LEFT)
            {
                nextRegion = PreviousEditableRegion;
                nextRegionAdjacency = _ELEMENT_ADJACENCY.ELEM_ADJ_BeforeEnd;
                preserveXLocation = direction == MOVE_DIRECTION.UP;
            }
            else if (direction == MOVE_DIRECTION.DOWN || direction == MOVE_DIRECTION.RIGHT)
            {
                nextRegion = NextEditableRegion;
                nextRegionAdjacency = _ELEMENT_ADJACENCY.ELEM_ADJ_AfterBegin;
                preserveXLocation = direction == MOVE_DIRECTION.DOWN;

                if (nextRegion == null)
                    return false;

                MarkupPointer selectRegion = EditorContext.MarkupServices.CreateMarkupPointer(nextRegion, nextRegionAdjacency);
                MarkupContext mc = selectRegion.Right(false);
                if (mc.Context == _MARKUP_CONTEXT_TYPE.CONTEXT_TYPE_EnterScope && mc.Element is IHTMLElement3 && SmartContentSelection.SelectIfSmartContentElement(EditorContext, mc.Element) != null)
                {
                    return true;
                }
            }
            else
                throw new ArgumentException("Unsupported move direction detected: " + direction);

            IDisplayServicesRaw displayServices = (IDisplayServicesRaw)HTMLElement.document;
            IDisplayPointerRaw displayPointer;
            displayServices.CreateDisplayPointer(out displayPointer);
            IHTMLCaretRaw caret = GetCaret();
            caret.MoveDisplayPointerToCaret(displayPointer);

            ILineInfo lineInfo;
            displayPointer.GetLineInfo(out lineInfo);

            if (nextRegion != null)
            {
                MarkupPointer mp = EditorContext.MarkupServices.CreateMarkupPointer(nextRegion, nextRegionAdjacency);

                DisplayServices.TraceMoveToMarkupPointer(displayPointer, mp);
                try
                {
                    caret.MoveCaretToPointer(displayPointer, true, _CARET_DIRECTION.CARET_DIRECTION_SAME);
                    if (preserveXLocation)
                    {
                        POINT caretLocation;
                        caret.GetLocation(out caretLocation, true);
                        caretLocation.x = lineInfo.x;
                        uint hitTestResults;
                        displayPointer.MoveToPoint(caretLocation, _COORD_SYSTEM.COORD_SYSTEM_GLOBAL, nextRegion, 0, out hitTestResults);
                        caret.MoveCaretToPointer(displayPointer, true, _CARET_DIRECTION.CARET_DIRECTION_SAME);
                    }
                    //BEP: using this line causes scrolling	(nextRegion as IHTMLElement2).focus();
                    (nextRegion as IHTMLElement3).setActive();
                    return true;
                }
                catch (Exception e)
                {
                    Debug.Fail("Unexpected exception in MoveCaretToNextRegion: " + e.ToString());
                }

                caret.MoveCaretToPointer(displayPointer, true, _CARET_DIRECTION.CARET_DIRECTION_SAME);
            }
            return false;
        }
Пример #23
0
        /// <summary>
        /// Navigates the editor's caret to the next editable region.
        /// </summary>
        /// <param name="direction"></param>
        private bool MoveCaretToNextRegion(MOVE_DIRECTION direction)
        {
            IHTMLElement       nextRegion;
            _ELEMENT_ADJACENCY nextRegionAdjacency;
            bool preserveXLocation;

            if (direction == MOVE_DIRECTION.UP || direction == MOVE_DIRECTION.LEFT)
            {
                nextRegion          = PreviousEditableRegion;
                nextRegionAdjacency = _ELEMENT_ADJACENCY.ELEM_ADJ_BeforeEnd;
                preserveXLocation   = direction == MOVE_DIRECTION.UP;
            }
            else if (direction == MOVE_DIRECTION.DOWN || direction == MOVE_DIRECTION.RIGHT)
            {
                nextRegion          = NextEditableRegion;
                nextRegionAdjacency = _ELEMENT_ADJACENCY.ELEM_ADJ_AfterBegin;
                preserveXLocation   = direction == MOVE_DIRECTION.DOWN;

                if (nextRegion == null)
                {
                    return(false);
                }

                MarkupPointer selectRegion = EditorContext.MarkupServices.CreateMarkupPointer(nextRegion, nextRegionAdjacency);
                MarkupContext mc           = selectRegion.Right(false);
                if (mc.Context == _MARKUP_CONTEXT_TYPE.CONTEXT_TYPE_EnterScope && mc.Element is IHTMLElement3 && SmartContentSelection.SelectIfSmartContentElement(EditorContext, mc.Element) != null)
                {
                    return(true);
                }
            }
            else
            {
                throw new ArgumentException("Unsupported move direction detected: " + direction);
            }

            IDisplayServicesRaw displayServices = (IDisplayServicesRaw)HTMLElement.document;
            IDisplayPointerRaw  displayPointer;

            displayServices.CreateDisplayPointer(out displayPointer);
            IHTMLCaretRaw caret = GetCaret();

            caret.MoveDisplayPointerToCaret(displayPointer);

            ILineInfo lineInfo;

            displayPointer.GetLineInfo(out lineInfo);

            if (nextRegion != null)
            {
                MarkupPointer mp = EditorContext.MarkupServices.CreateMarkupPointer(nextRegion, nextRegionAdjacency);

                DisplayServices.TraceMoveToMarkupPointer(displayPointer, mp);
                try
                {
                    caret.MoveCaretToPointer(displayPointer, true, _CARET_DIRECTION.CARET_DIRECTION_SAME);
                    if (preserveXLocation)
                    {
                        POINT caretLocation;
                        caret.GetLocation(out caretLocation, true);
                        caretLocation.x = lineInfo.x;
                        uint hitTestResults;
                        displayPointer.MoveToPoint(caretLocation, _COORD_SYSTEM.COORD_SYSTEM_GLOBAL, nextRegion, 0, out hitTestResults);
                        caret.MoveCaretToPointer(displayPointer, true, _CARET_DIRECTION.CARET_DIRECTION_SAME);
                    }
                    //BEP: using this line causes scrolling	(nextRegion as IHTMLElement2).focus();
                    (nextRegion as IHTMLElement3).setActive();
                    return(true);
                }
                catch (Exception e)
                {
                    Debug.Fail("Unexpected exception in MoveCaretToNextRegion: " + e.ToString());
                }

                caret.MoveCaretToPointer(displayPointer, true, _CARET_DIRECTION.CARET_DIRECTION_SAME);
            }
            return(false);
        }
 // Signal search 2 drive : 신호 검출-2 구동
 [DllImport("AxtLib.dll")] public static extern void CFSKeSignalSearch2Drive(short axis,
                                                                             ushort ulRange, ushort ulSTSPSpeedData, MOVE_DIRECTION nDirection);
Пример #25
0
    void Update()
    {
        bool visionRight = false;
        bool visionLeft  = false;

        if (enemyVision.active)
        {
            if (enemyVision.character.transform.position.x > gameObject.transform.position.x)
            {
                // player is to the right
                visionRight = true;
            }
            else if (enemyVision.character.transform.position.x < gameObject.transform.position.x)
            {
                // player is to the left
                visionLeft = true;
            }
            else
            {
                // player is in same x as enemy
                visionRight = false;
                visionLeft  = false;
            }
        }
        else
        {
            // player is in same x as enemy
            visionRight = false;
            visionLeft  = false;
        }

        switch (behaviour)
        {
        case BEHAVIOUR.AGGRO:
            if (visionRight)
            {
                moveDirection = MOVE_DIRECTION.RIGHT;
            }
            else if (visionLeft)
            {
                moveDirection = MOVE_DIRECTION.LEFT;
            }
            else
            {
                moveDirection = MOVE_DIRECTION.NONE;
            }
            break;

        case BEHAVIOUR.FLEE:
            if (visionRight)
            {
                moveDirection = MOVE_DIRECTION.LEFT;
            }
            else if (visionLeft)
            {
                moveDirection = MOVE_DIRECTION.RIGHT;
            }
            else
            {
                moveDirection = MOVE_DIRECTION.NONE;
            }
            break;

        default:
        case BEHAVIOUR.NEUTRAL:
            moveDirection = MOVE_DIRECTION.NONE;
            break;
        }
    }