Beispiel #1
0
    // Update is called once per frame
    void FixedUpdate()
    {
        State.Update( );

        if (Input.GetMouseButton(0))
        {
            var mouseWorldPos = MouseInWorld( );
            var objlocalMouse = LocalPos(mouseWorldPos);
            if (name == "ZAxis")
            {
                Debug.Log(objlocalMouse);
            }
            var contain = IsInRange(objlocalMouse);
            if (contain)
            {
                State.SendEvent(DragInt);
            }
            else
            {
                State.SendEvent(NoDragInt);
            }
        }
        else
        {
            State.SendEvent(IdleInt);
        }

        StateName = State.CurrentStateName;
    }
Beispiel #2
0
    private void FixedUpdate()
    {
        State.Update( );
#if TEST_ONE_DRAGBAR
        if (Input.GetMouseButton(0))
        {
            // 一番近い,距離がある程度以下のバーをドラッグ判定に
            // Idleでクリックしたから
            // Horibar上ならドラッグへ
            Vector3 world      = MouseInWorld( );
            var     barLocal   = BarLocalPos(world);
            var     isInXRange = 0.0f < barLocal.x && barLocal.x < HoriLength;
            var     isInYRange = 0.0f < barLocal.y && barLocal.y < 1.0f;

            if (isInYRange && isInXRange)
            {
                State.SendEvent(DragInt);
            }
            else
            {
                State.SendEvent(NoDragInt);
            }
        }
        else
        {
            State.SendEvent(IdleInt);
        }
        StateName = State.CurrentStateName;
#endif

#if TEST_ALWAYS_DRAG
        var mouse  = Input.mousePosition;
        var zMouse = new Vector3(mouse.x, mouse.y, Distance(Camera.main.gameObject));
        var world  = Camera.main.ScreenToWorldPoint(zMouse);

        SetPosInWorld(world);
        //Debug.Log( world );
#endif
    }
 //他クラスからステートをいじりたい
 public void EnableMove()
 {
     stateMachine.SendEvent((int)StateEventID.Active);
 }