Exemple #1
0
        void Update()
        {
            // Store the input positions
            movePosition  = UltimateJoystick.GetPosition("Movement");
            shootPosition = UltimateJoystick.GetPosition("Shooting");

            // If the user cannot control the player, then return.
            if (canControl == false)
            {
                return;
            }

            // If the shooting joystick is being used and the shooting timer is ready...
            if (UltimateJoystick.GetJoystickState("Shooting") && shootingTimer <= 0)
            {
                // Then reset the timer and shoot a bullet.
                shootingTimer = shootingCooldown;
                CreateBullets();
            }

            // If the shoot timer is above zero, reduce it.
            if (shootingTimer > 0)
            {
                shootingTimer -= Time.deltaTime;
            }
        }
Exemple #2
0
 // Update is called once per frame
 void Update()
 {
     h  = UltimateJoystick.GetHorizontalAxis("WSJ");
     v  = UltimateJoystick.GetVerticalAxis("WSJ");
     t1 = UltimateJoystick.GetJoystickState("WSJ");
     t2 = UltimateJoystick.GetTapCount("WSJ");
 }
 void Update()
 {
     if (m_IsActive)
     {
         bool curTouchState = m_Joystick.GetJoystickState();
         HandleInput(curTouchState);
         m_PrevTouchState = curTouchState;
     }
 }
 void Update()
 {
     if (UltimateJoystick.GetJoystickState("Fire1"))
     {
         if (IsFiring == false)
         {
             StartCoroutine(FiringPistol());
         }
     }
 }
Exemple #5
0
    private void JoystickShooting(UltimateJoystick joystick)
    {
        if (PlayerController.instance == null)
        {
            return;
        }

        shootPosition = new Vector3(joystick.GetHorizontalAxis(), joystick.GetVerticalAxis(), 0);

        if (joystick.GetJoystickState())
        {
            isShoot = true;
            TryShot();
            PlayerController.instance.isBouderJoystickShoot = joystick.GetDistance() >= 0.9f;
            if (autoTarget.Count == 0)
            {
                if (PlayerController.instance.isBouderJoystickShoot)
                {
                    PlayerController.instance.FlipX = shootPosition.x < 0;
                    PlayerController.instance.SelectNonTarget(shootPosition);
                }
            }
            else
            {
                PlayerController.instance.SelectTarget(shootPosition);
            }
        }
        else
        {
#if UNITY_EDITOR
#else
            if (PlayerController.instance.currentGun == 6)
            {
                PlayerController.instance.DisableLaser();
            }
            PlayerController.instance.EndShot();
#endif
            if (isShoot)
            {
                SoundController.instance.PlaySound(soundGame.soundbulletdrop);
                isShoot = false;
            }

            if (autoTarget.Count == 0)
            {
                PlayerController.instance.SelectNonTarget(!PlayerController.instance.FlipX ? Vector2.right : Vector2.left);
            }
            else
            {
                PlayerController.instance.SelectTarget(!PlayerController.instance.FlipX ? Vector2.right : Vector2.left);
            }
        }
    }
Exemple #6
0
 private void JoystickMovement(UltimateJoystick joystick)
 {
     movePosition = new Vector3(joystick.GetHorizontalAxis(), joystick.GetVerticalAxis(), 0);
     if (joystick.GetJoystickState())
     {
         PlayerController.instance.isBouderJoystickMove = joystick.GetDistance() >= 0.2f;
         if (PlayerController.instance.isBouderJoystickMove)
         {
             OnMove(movePosition);
         }
     }
     else
     {
         if (PlayerController.instance == null)
         {
             return;
         }
         StopMove();
     }
 }
 void OnMouseOver()
 {
     if (TheDistance <= 2)
     {
         ExtraCross.SetActive(true);
         ActionDisplay.SetActive(true);
         ActionText.SetActive(true);
     }
     if (UltimateJoystick.GetJoystickState("Open"))
     {
         print("You Tapped");
         if (TheDistance <= 2)
         {
             this.GetComponent <BoxCollider>().enabled = false;
             ActionDisplay.SetActive(false);
             ActionText.SetActive(false);
             print("OPEN DOOR");
             TheDoor.GetComponent <Animation> ().Play("DoorOpenAnim2");
             CreakSound.Play();
         }
     }
 }
Exemple #8
0
 // Update is called once per frame
 void Update()
 {
     if (UltimateJoystick.GetJoystickState("PlayerMove"))
     {
         Move();
     }
     if (UltimateJoystick.GetJoystickState("PlayerTurn"))
     {
         Turn();
     }
     if (isLaser || isReinLaser)
     {
         Ray();
     }
     if (shotCount >= shotMaxCount)
     {
         Charge();
     }
     if (mineCount >= mineMaxCount)
     {
         MineCharge();
     }
 }
Exemple #9
0
 void OnMouseOver()
 {
     if (TheDistance <= 2)
     {
         ExtraCross.SetActive(true);
         ActionText.GetComponent <Text> ().text = "Pick Up Pistol";
         ActionDisplay.SetActive(true);
         ActionText.SetActive(true);
     }
     if (UltimateJoystick.GetJoystickState("Open"))
     {
         if (TheDistance <= 2)
         {
             this.GetComponent <BoxCollider>().enabled = false;
             ActionDisplay.SetActive(false);
             ActionText.SetActive(false);
             FakePistol.SetActive(false);
             RealPistol.SetActive(true);
             ExtraCross.SetActive(false);
             GuideArrow.SetActive(false);
             TheJumpTrigger.SetActive(true);
         }
     }
 }