public void MoveMent()
    {
        if (JoyStick.DragCheck() && !isStick && isTreeCol)
        {
            if (JoyStick.GetMoveVecY() == 1 || JoyStick.GetMoveVecY() == -1)
            {
                isStick = true;
            }
        }

        if (JoyStick.DragCheck() && isStick && isTreeCol)
        {
            if (JoyStick.GetJoyVec().y >= 0.5f || JoyStick.GetJoyVec().y <= 0.5f)
            {
                SetPlayerState(PLAYER_STATE.UPDOWN);
            }
            else
            {
                SetPlayerState(PLAYER_STATE.SIDE);
            }

            transform.position += new Vector3(0, JoyStick.GetJoyVec().y *upSpeed, 0) * Time.deltaTime;
        }
        else
        {
            SetPlayerState(PLAYER_STATE.STOP);
        }

        transform.position += new Vector3(JoyStick.GetJoyVec().x *sideSpeed, 0, 0) * Time.deltaTime;
    }
Exemplo n.º 2
0
        public override void Update(TimeSpan elapsedTime)
        {
            base.Update(elapsedTime);
            Helpers.GameState = Helpers.State.InMainMenu;

            if (Keyboard.GetKeyState(CONST_TV_KEY.TV_KEY_UP) == TVButtonState.Pressed ||
                JoyStick.JoyUpKeyDown() || Gamepad[0].DPad.Up.State == TVButtonState.Pressed)
            {
                View.ExecuteJavascript("keyUp()");
                PlayButtonFocusSound();
            }
            else if (Keyboard.GetKeyState(CONST_TV_KEY.TV_KEY_DOWN) == TVButtonState.Pressed ||
                     JoyStick.JoyDownKeyDown() || Gamepad[0].DPad.Down.State == TVButtonState.Pressed)
            {
                View.ExecuteJavascript("keyDown()");
                PlayButtonFocusSound();
            }
            else if (Keyboard.GetKeyState(CONST_TV_KEY.TV_KEY_RETURN) == TVButtonState.Pressed ||
                     JoyStick.JoyButtonDown(0))
            {
                View.ExecuteJavascript("keyEnter()");
            }
            else if (Keyboard.GetKeyState(CONST_TV_KEY.TV_KEY_ESCAPE) == TVButtonState.Pressed)
            {
                UIManager.Exit();
            }
        }
Exemplo n.º 3
0
 void Start()
 {
     js = GameObject.FindObjectOfType <JoyStick>();
     js.OnJoyStickTouchBegin += OnJoyStickBegin;
     js.OnJoyStickTouchMove  += OnJoyStickMove;
     js.OnJoyStickTouchEnd   += OnJoyStickEnd;
 }
Exemplo n.º 4
0
 // 초기화
 private void Start()
 {
     player        = GetComponent <PlayerCharacter>();
     stick         = GameObject.Find("JoyStickCanvas").GetComponentInChildren <JoyStick>();
     keyboardInput = keyboard.nothing;
     touch         = keyboard.nothing;
 }
Exemplo n.º 5
0
        public override void Update(TimeSpan elapsedTime)
        {
            base.Update(elapsedTime);
            Helpers.GameState = Helpers.State.InOptionsMenu;

            if (Keyboard.GetKeyState(CONST_TV_KEY.TV_KEY_LEFT) == TVButtonState.Pressed ||
                JoyStick.JoyLeftKeyDown() || Gamepad[0].DPad.Left.State == TVButtonState.Pressed)
            {
                View.ExecuteJavascript("keyLeft()");
                PlayButtonFocusSound();
            }
            else if (Keyboard.GetKeyState(CONST_TV_KEY.TV_KEY_RIGHT) == TVButtonState.Pressed ||
                     JoyStick.JoyRightKeyDown() || Gamepad[0].DPad.Right.State == TVButtonState.Pressed)
            {
                View.ExecuteJavascript("keyRight()");
                PlayButtonFocusSound();
            }
            else if (Keyboard.GetKeyState(CONST_TV_KEY.TV_KEY_RETURN) == TVButtonState.Pressed ||
                     JoyStick.JoyButtonDown(0))
            {
                View.ExecuteJavascript("keyEnter()");
            }
            else if (Keyboard.GetKeyState(CONST_TV_KEY.TV_KEY_ESCAPE) == TVButtonState.Pressed)
            {
                View.ExecuteJavascript("keyEscape()");
            }
        }
Exemplo n.º 6
0
    // Use this for initialization
    void Start()
    {
        network         = GameObject.Find("NetworkManager").GetComponent <Network>();
        myCharacterName = PlayerPrefs.GetString("myCharacter");
        joy             = GameObject.Find("JoystickBackGround").GetComponent <JoyStick>();


        playerParams = GameObject.FindWithTag("Player").GetComponent <PlayerParams>();
        playerFSM2   = GameObject.FindWithTag("Player").GetComponent <PlayerFSM2>();

        remoteParams = GameObject.FindWithTag("RemotePlayer").GetComponent <RemoteParams>();
        remoteFSM    = GameObject.FindWithTag("RemotePlayer").GetComponent <RemoteFSM>();
        remoteAni    = GameObject.FindWithTag("RemotePlayer").GetComponent <RemoteAni>();

        characterCreate = GetComponent <CharacterCreate>();
        //greenRespawnTaiLung = GameObject.Find("GreenRespawnTaiLung").GetComponent<GameObject>();
        //redRespawnTiaLung = GameObject.Find("RedRespawnTaiLung").GetComponent<GameObject>();

        //greenRespawnCoundDown = GameObject.Find("GreenRespawnCoundDown").GetComponent<Text>();
        //redRespawnCoundDown = GameObject.Find("RedRespawnCoundDown").GetComponent<Text>();

        myBase       = characterCreate.myTeam;
        countDown    = 10f;
        respawnTimer = 0f;
    }
Exemplo n.º 7
0
    public void SetMove(JoyStick joyStick)
    {
        if (heroState != HeroState.Dead)
        {
            if (attackMonster.Count > 0)
            {
                heroState = HeroState.Attack;
                if (!animator.GetCurrentAnimatorStateInfo(0).IsName("Attack"))
                {
                    animator.Play("Attack");
                }
            }
            else
            {
                heroState = HeroState.Idle;
                Invoke("ResetState", 0.5f);
            }

            Rect    rectRange        = joyStick.m_JoyStickBackGround.GetComponent <RectTransform>().rect;
            Vector3 joyStickLocalpos = joyStick.m_JoyStick.transform.localPosition;
            Vector3 resultMoving     = Vector3.zero;

            resultMoving            += new Vector3(joyStickLocalpos.x / (rectRange.width * 0.5f), joyStickLocalpos.y / (rectRange.height * 0.5f));
            resultMoving            *= movingSpeed;
            this.transform.position += resultMoving;

            SetLeftRight(joyStickLocalpos.x);
        }
    }
Exemplo n.º 8
0
    // 초기화
    void Start()
    {
        playerCharacter = GameObject.FindWithTag("Player");

        player   = GameObject.FindWithTag("Player").transform;
        myParams = GetComponent <PlayerParams>();
        myAni    = GetComponent <PlayerAni>();
        myParams.InitParams();
        myParams.deadEvent.AddListener(ChangeToPlayerDead);

        remotePlayer = GameObject.FindWithTag("RemotePlayer").transform;
        remoteParams = GameObject.FindWithTag("RemotePlayer").GetComponent <RemoteParams>();
        remoteAni    = GameObject.FindWithTag("RemotePlayer").GetComponent <RemoteAni>();
        remoteFSM    = GameObject.FindWithTag("RemotePlayer").GetComponent <RemoteFSM>();

        monster     = GameObject.Find("Spider").transform;
        skillButton = GameObject.Find("TaiLungSpell1").GetComponent <SkillButton>();

        curEnemyParams = GameObject.Find("Monster").GetComponent <MonsterParams>();


        basicAttack = GameObject.Find("AttackButton").GetComponent <AttakButton>();

        redTowerPos = GameObject.FindWithTag("RedTower").transform;

        towerParams = GameObject.FindWithTag("RedTower").GetComponent <TowerParams>();

        network = GameObject.Find("NetworkManager").GetComponent <Network>();


        joy = GameObject.Find("JoystickBackGround").GetComponent <JoyStick>();
    }
Exemplo n.º 9
0
 public void UpdateCurrentJoystick()
 {
     if (FrameWorkStaticHelper.GetNumberOfAvailableJoysticks() > 0)
     {
         currentJoystick = joysticks[FrameWorkStaticHelper.GetCurrentJoystickIndex()];
     }
 }
Exemplo n.º 10
0
 public void HideAll()
 {
     canvasGroup.alpha          = 0;
     canvasGroup.blocksRaycasts = false;
     JoyStick.enabled           = false;
     JoyStick.Stop();
 }
Exemplo n.º 11
0
    public void AddJoyStick()
    {
        GameObject draggedImage = GetWidget("JoyStick_N");

        joyStick = new JoyStick(player, draggedImage.transform);
        AddOnDrag("JoyStick_N", joyStick.OnDrag);
        AddEndDrag("JoyStick_N", joyStick.EndDrag);
    }
Exemplo n.º 12
0
        public static void JoystickBind(Component joyStick, Action <float, float, float> mov, Action begin, Action end)
        {
            JoyStick js = (JoyStick)joyStick;

            js.move  = mov;
            js.begin = begin;
            js.end   = end;
        }
Exemplo n.º 13
0
 public void EnableJoyStick(bool value)
 {
     JoyStick.enabled = value && !(DialogueManager.Instance.IsUIOpen || ShopManager.Instance.IsUIOpen ||
                                   WarehouseManager.Instance.IsUIOpen || QuestManager.Instance.IsUIOpen || BuildingManager.Instance.IsPreviewing);
     if (!JoyStick.enabled)
     {
         JoyStick.Stop();
     }
 }
Exemplo n.º 14
0
    private GTextField gTextField;                                  //角度文本

    // Start is called before the first frame update
    void Start()
    {
        mainUI     = GetComponent <UIPanel>().ui;
        joyStick   = new JoyStick(mainUI);
        gTextField = mainUI.GetChild("n4").asTextField;
        //为摇杆移动和结束添加事件
        joyStick.onMove.Add(JoyStickMove);
        joyStick.onEnd.Add(JoyStickEnd);
    }
Exemplo n.º 15
0
 // Use this for initialization
 void Start()
 {
     GC           = FindObjectOfType <GameController> ();
     npc          = FindObjectOfType <NPCController> ();
     player       = FindObjectOfType <PlayerData> ();
     inventory    = FindObjectOfType <Inventory> ();
     dia          = FindObjectOfType <DialogueList> ();
     moveJoystick = FindObjectOfType <JoyStick> ();
 }
Exemplo n.º 16
0
        public void ClearJoyStickMoveListener()
        {
            JoyStick stk = transform.GetComponent <JoyStick>();

            if (stk != null)
            {
                stk.ClearJoyStickMoveListener();
            }
        }
Exemplo n.º 17
0
    void Start()
    {
        m_JoyStick = GameObject.FindObjectOfType<JoyStick>();
        m_JoyStick.OnJoyStickTouchBegin += OnJoyStickBegin;
        m_JoyStick.OnJoyStickTouchMove += OnJoyStickMove;
        m_JoyStick.OnJoyStickTouchEnd += OnJoyStickEnd;

        m_Animator = transform.GetComponent<Animator>();
    }
Exemplo n.º 18
0
        static void handleNonBufferedJoy(JoyStick js)
        {
            //Just dump the current joy state
            JoyStickState_NativePtr joy = js.JoyStickState;

            for (int i = 0; i < joy.AxisCount; ++i)
            {
                Console.Write("\nAxis " + i + " X: " + joy.GetAxis(i).abs);
            }
        }
Exemplo n.º 19
0
    void Awake()
    {
        playerRigidbody = GetComponent<Rigidbody>();
        anim = GetComponent<Animation>();

        joyStick = GameObject.FindObjectOfType<JoyStick>();
        joyStick.OnJoyStickTouchBegin += OnJoyStickBegin;
        joyStick.OnJoyStickTouchMove += OnJoyStickMove;
        joyStick.OnJoyStickTouchEnd += OnJoyStickEnd;
    }
Exemplo n.º 20
0
 private void Start()
 {
     rect     = GetComponent <RectTransform>();
     joyStick = GetComponentInParent <JoyStick>();
     canvas   = GetComponentInParent <Canvas>();
     if (canvas == null)
     {
         throw new System.Exception("未查询到Canvas!");
     }
 }
Exemplo n.º 21
0
 public SdlInput(bool fullscreen)
 {
     keyBoardInput = new KeyBoardInput();
     joyStick      = new JoyStick(0);
     mouseInput    = new MouseInput();
     if (fullscreen)
     {
         mouseInput.Hide();
     }
 }
Exemplo n.º 22
0
 public void SetJoyStickBeginListener(JoyStickTouchBegin action)
 {
     if (action != null)
     {
         JoyStick stk = transform.GetComponent <JoyStick>();
         if (stk != null)
         {
             stk.SetJoyStickBeginListener(action);
         }
     }
 }
Exemplo n.º 23
0
 public void SetJoyStickEndListener(JoyStickTouchEnd action)
 {
     if (action != null)
     {
         JoyStick stk = transform.GetComponent <JoyStick>();
         if (stk != null)
         {
             stk.RemoveJoyStickEndListener(action);
         }
     }
 }
Exemplo n.º 24
0
 public void AddJoyStickMoveListener(JoyStickTouchMove action)
 {
     if (action != null)
     {
         JoyStick stk = transform.GetComponent <JoyStick>();
         if (stk != null)
         {
             stk.AddJoyStickMoveListener(action);
         }
     }
 }
 public void LookDirectionCheck()
 {
     if (JoyStick.GetJoyVec().x < 0)
     {
         playerLookDirection = -1;
     }
     else if (JoyStick.GetJoyVec().x > 0)
     {
         playerLookDirection = 1;
     }
 }
Exemplo n.º 26
0
 void Awake()
 {
     if (instance != null)
     {
         Destroy(this.gameObject);
     }
     else
     {
         instance = this;
     }
 }
Exemplo n.º 27
0
        // Use this for initialization
        void Start()
        {
            //Splats = GameObject.Find("SplatManager").GetComponent<SplatManager>();
            myAni          = GameObject.FindWithTag("Player").GetComponent <PlayerAni>();
            playerFsm      = GameObject.FindWithTag("Player").GetComponent <PlayerFSM2>();
            playerAnimator = GameObject.FindWithTag("Player").GetComponent <Animator>();

            joy     = GameObject.Find("JoystickBackGround").GetComponent <JoyStick>();
            network = GameObject.Find("NetworkManager").GetComponent <Network>();

            Timer = 0f;
        }
Exemplo n.º 28
0
    public MainWindow() : base(Gtk.WindowType.Toplevel)
    {
        joyStick = new JoyStick();

        loopTimer          = new Timer(20);
        loopTimer.Elapsed += (sender, e) => MainLoop(sender, e, this);
        loopTimer.Start();

        Build();

        //buttonDebug.Text = DS4Display.MainClass.joyStick.getNumDevs().ToString();
        //buttonDebug.Text = DS4Display.MainClass.joyStick.getPos(1).dwXpos.ToString();
    }
Exemplo n.º 29
0
    void FixedUpdate()
    {
        cam.transform.position = offset;
        cam.transform.rotation = Quaternion.Euler(rotation);
        HandleCamMovement();

        if (!manager.getPlayerEnum().Equals(PlayerStatEnum.PAUSED))
        {
            transform.position = move.moveDirection_z(transform.position);
            if (move.getMotion())
            {
                transform.position = move.moveToFinalPosition(transform.position);
            }

            if (Input.GetKey("a") || Input.GetKey("d"))
            {
                float dirct = Input.GetAxisRaw("Horizontal");
                move.firstMotion(transform.position, (dirct * floorTransform.localScale.x));
            }
            else if (Input.GetKey(KeyCode.Space) && transform.position.y <= 1)
            {
                rb.velocity = (new Vector3(0, 6, 0));
            }
            else if (Input.touchCount > 0)
            {
                Touch touch = Input.touches[0];
                if (touch.phase.Equals(TouchPhase.Began) && !blocked)
                {
                    blocked    = true;
                    startPoint = touch.position;
                }
                else if (touch.phase.Equals(TouchPhase.Ended) && blocked)
                {
                    blocked  = true;
                    endPoint = touch.position;
                    //directionRaw = touch.position - startPoint;
                    Vector2 test = JoyStick.CalculateInput(startPoint, endPoint);
                    //float temp = directionRaw.x / Mathf.Abs(directionRaw.x);
                    move.firstMotion(transform.position, (test.x * floorTransform.localScale.x));
                    Debug.Log(test);
                    rb.velocity = (new Vector3(0, test.y * 6, 0));
                }
            }
        }
        else
        {
            manager.playerEnum = PlayerStatEnum.DEAD;
        }
    }
Exemplo n.º 30
0
    /// <summary>
    /// 初始化代委托理事件
    /// </summary>
    private void InitDelegateEvent()
    {
        m_JoyStick = GameObject.FindObjectOfType<JoyStick>();
        m_JoyStick.OnJoyStickTouchBegin += OnTouchBegin;
        m_JoyStick.OnJoyStickTouchMove += OnTouchMove;
        m_JoyStick.OnJoyStickTouchEnd += OnTouchEnd;

        m_ButtonEvent = GameObject.FindObjectOfType<FightButtonEvent>();
        m_ButtonEvent.OnAttack += OnAttack;
        m_ButtonEvent.OnJump += OnJump;
        m_ButtonEvent.OnSkill += OnSkill;

        m_PlayerState = GameObject.FindObjectOfType<StateDelegate>();
        m_PlayerState.OnStateChange += SwitchPlayerState;
    }
Exemplo n.º 31
0
 // Use this for initialization
 void Start()
 {
     GC            = FindObjectOfType <GameController> ();
     npc           = FindObjectOfType <NPCController> ();
     player        = FindObjectOfType <PlayerData> ();
     inventory     = FindObjectOfType <Inventory> ();
     dia           = FindObjectOfType <DialogueList> ();
     moveJoystick  = FindObjectOfType <JoyStick> ();
     OIP           = FindObjectOfType <OnItemPickup> ();
     doThingText   = GameObject.Find("DoThingText").GetComponent <Text> ();
     doThingButton = GameObject.Find("DoThingButton").GetComponent <Button> ();
     doThingCanvas = GameObject.Find("DoThingsCanvas").GetComponent <Canvas> ();
     finishCanvas  = GameObject.Find("FinishCanvas").GetComponent <Canvas> ();
     anim          = GetComponentInChildren <Animator>();
 }
Exemplo n.º 32
0
        public override void Update(TimeSpan elapsedTime)
        {
            base.Update(elapsedTime);
            Helpers.GameState = Helpers.State.GameFinished;

            if (Keyboard.GetKeyState(CONST_TV_KEY.TV_KEY_RETURN) == TVButtonState.Pressed ||
                JoyStick.JoyButtonDown(0))
            {
                View.ExecuteJavascript("keyEnter()");
            }
            else if (Keyboard.GetKeyState(CONST_TV_KEY.TV_KEY_ESCAPE) == TVButtonState.Pressed)
            {
                View.ExecuteJavascript("keyEscape()");
            }
        }
Exemplo n.º 33
0
    //private PlayerStatusfixed playerstatus;

    private void Start()
    {
        leftJoyStick  = GameObject.Find("UIControl/joyStick/leftJoyStick/leftFront").GetComponent <JoyStick>();
        rightJoyStick = GameObject.Find("UIControl/joyStick/rightJoyStick/rightFront").GetComponent <JoyStick>();
        leftJoyStick.OnJoyStickTouchBegin += OnLeftJoyStickBegin;
        leftJoyStick.OnJoyStickTouchMove  += OnLeftJoyStickMove;
        leftJoyStick.OnJoyStickTouchEnd   += OnLeftJoyStickEnd;

        rightJoyStick.OnJoyStickTouchBegin += OnRightJoyStickBegin;
        rightJoyStick.OnJoyStickTouchMove  += OnRightJoyStickMove;
        rightJoyStick.OnJoyStickTouchEnd   += OnRightJoyStickEnd;

        controller = GetComponent <CharacterController>();
        anim       = GetComponentInChildren <Animator>();
        //playerstatus = GetComponent<PlayerStatusfixed>();
    }
Exemplo n.º 34
0
 static void handleNonBufferedJoy(JoyStick js)
 {
     //Just dump the current joy state
     JoyStickState_NativePtr joy = js.JoyStickState;
     for (int i = 0; i < joy.AxisCount; ++i)
         Console.Write("\nAxis " + i + " X: " + joy.GetAxis(i).abs);
 }
Exemplo n.º 35
0
 public void Awake()
 {
     _instance = this;
 }