Esempio n. 1
0
    private void Update()
    {
        movement.Move(player.GetAxis2D("Move Horizontal", "Move Vertical"));
        //Debug.Log(player.GetAxis2D("Move Horizontal", "Move Vertical"));

        if (player.GetButton("Fire"))
        {
            FireButtonPressed();
        }
        if (player.GetButton("Fire2"))
        {
            Fire2ButtonPressed();
        }

        if (player.GetButton("Dash"))
        {
            DashButtonPressed();
        }

        if (mouseInput)
        {
            Vector3 v_diff = (MouseTargetLocation.position - transform.position);
            float   Rad    = Mathf.Atan2(v_diff.y, v_diff.x);
            float   angle  = Rad * Mathf.Rad2Deg;
            rotationEvent.Invoke(angle);
        }

        else
        {
            rotationEvent.Invoke(Quaternion.LookRotation(player.GetAxis2D("Rotate Horizontal", "Rotate Vertical")).eulerAngles.z);
            //    Debug.Log(Quaternion.LookRotation(player.GetAxis2D("Rotate Horizontal", "Rotate Vertical")).eulerAngles.z);
        }
    }
Esempio n. 2
0
 void GetInput()
 {
     upPressed    = player.GetButton("MoveUp");
     downPressed  = player.GetButton("MoveDown");
     leftPressed  = player.GetButton("MoveLeft");
     rightPressed = player.GetButton("MoveRight");
 }
    void Update()
    {
        Rewired.Player playerControls = ReInput.players.GetPlayer("SYSTEM");

        if (playerControls.controllers.joystickCount == 0)
        {
            Joystick joystick = ReInput.controllers.GetJoystick(0);
            playerControls.controllers.AddController(joystick, true);
        }

        if (playerControls.GetButton(SLOW_NAME))
        {
            SceneManager.LoadScene(GameplayScene);
        }

        // Check to see if we should quit
        if (playerControls.GetButton(QUIT_NAME))
        {
            quitButtonHeldDownLength += Time.deltaTime;
            if (quitButtonHeldDownLength >= REQUIRED_TIME_TO_QUIT)
            {
                Application.Quit();
            }
        }
        else
        {
            quitButtonHeldDownLength = 0;
        }
    }
Esempio n. 4
0
    void CheckPickup()
    {
        if (pmPlayer.GetButton(GetComponent <PlayerInfoScript>().playerPickup) && ableToPickUp)
        {
            ableToPickUp = false;
            ableToThrow  = false;

            Collider2D[] hits = Physics2D.OverlapCircleAll(pickupRad.bounds.center, pickupRad.radius, LayerMask.GetMask("Ball"));
            for (int i = 0; i < hits.GetLength(0) && numBalls < maxBalls; i++)
            {
                ballSavedName = hits [i].gameObject.name;
                GetComponent <PlayerInfoScript>().SetBallName(hits[i].gameObject.name);

                numBalls++;
                GetComponent <PlayerInfoScript>().IncreaseBalls();

                Destroy(hits [i].gameObject);
                anim.SetBool("Catching", true);
                anim.SetBool("HoldingBall", true);

                GetComponent <PlayerInfoScript>().ballUI.SetActive(true);
            }
        }
        else if (!pmPlayer.GetButton(playerPickup) && !ableToPickUp)
        {
            StartCoroutine(AbleToPickUpAgain());
        }
    }
    private void DoInput()
    {
        if (inputBlocked)
        {
            return;
        }

        if (rePlayer.GetAxis("LStick Horizontal") != 0)
        {
            float newY = Mathf.Sin(Time.time * 10) / 10;
            playerObject.transform.localPosition = new Vector3(playerObject.transform.localPosition.x, newY, playerObject.transform.localPosition.z);
            float newX = Mathf.Sin(Time.time * 10) / 400;
            handObject.transform.localPosition = new Vector3(newX, handObject.transform.localPosition.y, handObject.transform.localPosition.z);
        }

        // Activate all actions if they exist
        foreach (KeyValuePair <string, PlayerUsable> action in actionMap)
        {
            if (rePlayer.GetButton(action.Key))
            {
                action.Value.Use();
            }
            else if (rePlayer.GetButtonUp(action.Key))
            {
                action.Value.UnUse();
            }
            else if (rePlayer.GetButtonDown(action.Key))
            {
                action.Value.UseOnce();
            }
        }
    }
Esempio n. 6
0
    void Attack()
    {

        if (player.GetButton("Fire1"))
        {
            isAttacking = true;
            weapon.SetColliderActive(true);
            weapon.SwingSound();
            if (player.GetAxis("MoveHorizontal") >= 0)
            {
                weapon.transform.Rotate(0, 0, -20f);
            }
            else
            {
                weapon.transform.Rotate(0, 0, 20f);
            }
                
        }

        if (player.GetButtonUp("Fire1"))
        {
            isAttacking = false;
            weapon.SetColliderActive(false);
            weapon.transform.localRotation = Quaternion.Lerp(weapon.transform.rotation, Quaternion.identity, 1f);
        }

        if (player.GetButton("Fire2"))
        {
            Special();
        }
        
    }
Esempio n. 7
0
        void Update()
        {
            if (_player == null)
            {
                return;
            }
            RefreshInput();
            if (_player.GetButton("haunt") || _fireInput.magnitude > .25f)
            {
                playMaker.SendEvent("beginHauntTargeting");
            }

            if (haunted && Time.timeScale > Mathf.Epsilon)
            {
                float actualBurnDuration = candleBurnDuration.Value / haunted.hauntCost;
                float burnRate           = 1 / actualBurnDuration;
                float burnThisFrame      = burnRate * Time.deltaTime;
                candleBag.Value -= burnThisFrame;

                if (candleBag.Value < haunted.hauntCost)
                {
                    candleBag.Value = haunted.hauntCost;
                    EndHaunt();
                }
            }
        }
Esempio n. 8
0
 private void GetInput()
 {
     moveVector.x = player.GetAxis("Move Horizontal");
     moveVector.y = player.GetAxis("Move Vertical");
     chargeRe     = player.GetButton("Charge");
     start        = player.GetButton("Start");
     escape       = player.GetButton("Escape");
 }
Esempio n. 9
0
    // Update is called once per frame
    void Update()
    {
        if (bets > 0 && GameManager.instance.IsBetting)
        {
            if (playerController.GetButton("AButton"))
            {
                SelectFill.fillAmount += SelectFillSpeed * Time.deltaTime;
                if (SelectFill.fillAmount >= 1)
                {
                    bets--;
                    BetManager.instance.SelectHorse(playerId, 1, bets);
                }
            }
            else if (playerController.GetButton("BButton"))
            {
                SelectFill.fillAmount += SelectFillSpeed * Time.deltaTime;
                if (SelectFill.fillAmount >= 1)
                {
                    bets--;
                    BetManager.instance.SelectHorse(playerId, 2, bets);
                }
            }
            else if (playerController.GetButton("XButton"))
            {
                SelectFill.fillAmount += SelectFillSpeed * Time.deltaTime;
                if (SelectFill.fillAmount >= 1)
                {
                    bets--;
                    BetManager.instance.SelectHorse(playerId, 3, bets);
                }
            }
            else if (playerController.GetButton("YButton"))
            {
                SelectFill.fillAmount += SelectFillSpeed * Time.deltaTime;
                if (SelectFill.fillAmount >= 1)
                {
                    bets--;
                    BetManager.instance.SelectHorse(playerId, 4, bets);
                }
            }

            else
            {
                SelectFill.fillAmount -= SelectFillSpeed * Time.deltaTime;
            }
        }
        else if (bets <= 0 && GameManager.instance.canStartRace)
        {
            if (playerController.GetButton("Start"))
            {
                BetManager.instance.StartButtonLoad.fillAmount += SelectFillSpeed * Time.deltaTime;
            }
        }
    }
Esempio n. 10
0
    private void ProcessInput()
    {
        _movement = Vector2.zero;

        //process aiming
        var isAiming = _player.GetButton("Aim");

        _animator.SetBool("IsAiming", isAiming);

        // Process move
        if (Math.Abs(_moveVector.x) > InputTolerance || Math.Abs(_moveVector.y) > InputTolerance)
        {
            var isRunning = !isAiming && _player.GetButton("Run");
            _animator.SetBool("IsRunning", isRunning);

            var movementFactor = 1.0f;
            if (isRunning)
            {
                movementFactor = RunningFactor;
            }
            if (isAiming)
            {
                movementFactor = AimingFactor;
            }
            _movement = _moveVector * Time.fixedDeltaTime * MovementSpeed * movementFactor;
        }

        // Process turn
        if (isAiming && (Math.Abs(_turnVector.x) > InputTolerance || Math.Abs(_turnVector.y) > InputTolerance))
        {
            var angle = Mathf.Atan2(_turnVector.x, _turnVector.y) * Mathf.Rad2Deg;
            transform.rotation = Quaternion.Euler(new Vector3(0, 0, angle));
            transform.Rotate(0, 0, -90);
        }
        else
        {
            var angle = Mathf.Atan2(_moveVector.y, _moveVector.x) * Mathf.Rad2Deg;
            transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward);
        }

        _animator.SetFloat("MovementScalar", _moveVector.magnitude);

        //process Enter Vehicle
        var isEnterVehicle = _player.GetButtonDown("Enter Vehicle");

        if (isEnterVehicle)
        {
            _interactor.TryEnterVehicle();
        }
    }
    void Update()
    {
        //======================================================================================================
        if (player.GetButton(buttonPress))
        {
            ObjectToSetInactive.SetActive(false);
            ObjectToSetActive.SetActive(true);
        }

        if (HasTimer)
        {
            StartCoroutine(Timer());
        }
    }
Esempio n. 12
0
        public ButtonState GetActionButtonStatus()
        {
            ButtonState result = ButtonState.None;

            if (player.GetButtonDown("Action"))
            {
                CallEffect();
                result = ButtonState.Pressed;
            }
            else if (player.GetButton("Action"))
            {
                result = ButtonState.Held;
            }

            return(result);
        }
Esempio n. 13
0
 // Update is called once per frame
 void Update()
 {
     if (rePlayer.GetButton("A Button"))
     {
         SceneManager.LoadScene("CharacterSelect");
     }
 }
Esempio n. 14
0
    private void HandleReset()
    {
        elapsedResetTime += Time.deltaTime;

        // Fade out the music
        SongController.Music.volume -= .001f;

        if (!(elapsedResetTime > TimingController.DelaySecondsBeforeAllowedToRestart))
        {
            return;
        }

        if (won)
        {
            if (SuccessText != null)
            {
                SuccessText.gameObject.SetActive(true);
            }
            if (!playedVictorySound)
            {
                SongController.PlayVictorySoundEffect();
                playedVictorySound = true;
            }
        }
        else if (RestartText != null)
        {
            RestartText.gameObject.SetActive(true);
        }

        Rewired.Player playerControls = ReInput.players.GetPlayer("SYSTEM");
        if (playerControls.GetButton(RESTART_NAME))
        {
            SceneManager.LoadScene(SceneManager.GetActiveScene().name);
        }
    }
Esempio n. 15
0
        private void Update()
        {
            switch (Kind)
            {
            case Kind.Ai:
                break;

            case Kind.Player:
                if (_player.GetButton("Join") && !Joined)
                {
                    _joinCurrentTime  -= Time.deltaTime;
                    _joinSlider.value += Time.deltaTime;
                    if (_joinCurrentTime <= 0)
                    {
                        Join();
                    }
                }
                else if (!Joined)
                {
                    if (!(_joinCurrentTime < _joinTime))
                    {
                        return;
                    }
                    _joinCurrentTime  += Time.deltaTime;
                    _joinSlider.value -= Time.deltaTime;
                }

                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        private void HandleInput()
        {
            _horizontal += _player.GetAxis(InputActions.Horizontal);
            _vertical   += _player.GetAxis(InputActions.Vertical);

            _isSwitchLeftPressed  = _isSwitchLeftPressed || _player.GetButtonDown(InputActions.SwitchLeft);
            _isSwitchLeftReleased = _isSwitchLeftReleased || _player.GetButtonUp(InputActions.SwitchLeft);
            _isSwitchLeftHeld     = _isSwitchLeftHeld || _player.GetButton(InputActions.SwitchLeft);

            _isSwitchRightPressed  = _isSwitchRightPressed || _player.GetButtonDown(InputActions.SwitchRight);
            _isSwitchRightReleased = _isSwitchRightReleased || _player.GetButtonUp(InputActions.SwitchRight);
            _isSwitchRightHeld     = _isSwitchRightHeld || _player.GetButton(InputActions.SwitchRight);

            _isShootPressed  = _isShootPressed || _player.GetButtonDown(InputActions.Shoot);
            _isShootReleased = _isShootReleased || _player.GetButtonUp(InputActions.Shoot);
            _isShootHeld     = _isShootHeld || _player.GetButton(InputActions.Shoot);
        }
Esempio n. 17
0
    void Summon()
    {
        if (player.GetButton("Fire1") && !onPortal && portalCount > 0)
        {
            if (!audioSource.isPlaying)
            {
                audioSource.PlayOneShot(spawnSound);
            }
            portalPool.GetObject(transform.position);
            portalCount--;
        }

        if (player.GetButton("Fire2") && onPortal)
        {
            portalPool.ReturnObject(GameObject.Find(contactPortal).GetComponent <PooledObject>());
            portalCount++;
        }
    }
Esempio n. 18
0
    /// <summary>
    /// Checks to see the desired direction, and updates the player position and velocity based on this,
    /// as long as it remains within the game bounds
    /// </summary>
    void FixedUpdate()
    {
        Rewired.Player playerControls = ReInput.players.GetPlayer("SYSTEM");

        // Check to see if we should quit
        if (playerControls.GetButton(QUIT_NAME))
        {
            quitButtonHeldDownLength += Time.deltaTime;
            if (quitButtonHeldDownLength >= REQUIRED_TIME_TO_QUIT)
            {
                Debug.Log("Quitting");
                Application.Quit();
            }
        }
        else
        {
            quitButtonHeldDownLength = 0;
        }

        if (GameController.Instance.IsResetting())
        {
            rb.velocity = Vector2.zero;
            return;
        }

        if (playerControls.controllers.joystickCount == 0)
        {
            Joystick joystick = ReInput.controllers.GetJoystick(0);
            playerControls.controllers.AddController(joystick, true);
        }

        float   moveHorizontal = playerControls.GetAxis(HORIZONTAL_MOVEMENT_NAME);
        float   moveVertical   = playerControls.GetAxis(VERTICAL_MOVEMENT_NAME);
        Vector2 movement       = GameController.Instance.EvaluateMove(new Vector2(moveHorizontal, moveVertical), transform.position);

        float currentSpeed = normalSpeed;

        if (playerControls.GetButton(SLOW_NAME))
        {
            currentSpeed = slowSpeed;
        }

        rb.velocity = movement * currentSpeed;
    }
    // Update is called once per frame
    void Update()
    {
        Rewired.Player player = ReInput.players.GetPlayer(PlayerId);
        Debug.Log("MoveH : " + player.GetAxis("MoveH"));
        Debug.Log("MoveV : " + player.GetAxis("MoveV"));
        Debug.Log("Flash : " + player.GetButton("Flashlight"));
        Debug.Log("Inter : " + player.GetButton("Interact"));

        if (Vibrate)
        {
            player.SetVibration(Motor, Speed);
        }
        else
        {
            player.SetVibration(0, 0, true);
        }

        Controller controller = ReInput.controllers.GetController(ControllerType.Joystick, 0);
    }
    private void GetInput()
    {
        direction = Vector2.zero;
        // direction.x = player.GetAxis("Move Horizontal");

        if (player.GetButton("Move Left"))
        {
            direction.x += -1.0f;
        }
        if (player.GetButton("Move Right"))
        {
            direction.x += 1.0f;
        }

        if (!jump && grounded)
        {
            jump = player.GetButton("Jump");
        }
    }
Esempio n. 21
0
    private void FixedUpdate()
    {
        if (!GameManager.instance.isRunning)
        {
            return;
        }
        // pass the input to the car!


#if !MOBILE_INPUT
        float h = pInput.GetAxis(Globals.Axis_X1);
        float fwd = pInput.GetAxis(Globals.Axis_Z2);
        float back, boost, drift, handbrake;

        switch (mappingStyle)
        {
        case Mapping.Classic:
            back  = pInput.GetAxis(Globals.Axis_Z1);
            drift = (pInput.GetButton(Globals.BtnAction5) /* || pInput.GetButton(Globals.BtnAction3)*/) ? 1f : 0f;
            //Debug.Log("back and deift: " + back + " - " + drift);
            break;

        case Mapping.AnalogDrift:
            back  = pInput.GetButton(Globals.BtnAction3) ? 1 : 0;
            drift = -pInput.GetAxis(Globals.Axis_Z1);
            break;

        default: goto case Mapping.Classic;
        }

        handbrake = pInput.GetButton(Globals.BtnAction2) ? 1 : 0;
        boost     = pInput.GetButton(Globals.BtnAction1) ? 1 : 0;

        ((ArcadeCarController)car).ActionTimers(pInput.GetButtonTimePressed(Globals.BtnAction1));

        car.Action(back, handbrake, boost, drift);
        car.Move(h, fwd);
#else
        car.Move(h, v, v, 0f);
#endif
    }
Esempio n. 22
0
 public bool GetButton(int _PlayerID, string _Button)
 {
     if (_PlayerID == 1)
     {
         return(Player1RW.GetButton(_Button));
     }
     else if (_PlayerID == 2)
     {
         return(Player2RW.GetButton(_Button));
     }
     return(false);
 }
Esempio n. 23
0
    public override void DoUpdate()
    {
        for (int i = 0; i < actions.Length; i++)
        {
            ActionPair pair = actions[i];

            switch (pair.def.kind)
            {
            case InputAction.Kind.Button:
            {
                // Fix something here! Is called for 5/6 Frames
                bool held    = player.GetButton(pair.def.rewiredAction1);
                bool oldHeld = pair.action.buttonHeld;
                var  change  =
                    held == oldHeld ? InputAction.ValueChange.None :
                    held ? InputAction.ValueChange.NotZero :
                    InputAction.ValueChange.Zero
                ;
                pair.action = new InputAction(held, change);
                break;
            }

            case InputAction.Kind.Axis:
            {
                float value    = player.GetAxis(pair.def.rewiredAction1);
                float oldValue = pair.action.axis;
                var   change   =
                    value == oldValue ? InputAction.ValueChange.None :
                    Math.Abs(value) > 0.0f ? InputAction.ValueChange.NotZero :
                    InputAction.ValueChange.Zero
                ;
                pair.action = new InputAction(value, change);
                break;
            }

            case InputAction.Kind.Axis2D:
            {
                Vector2 value    = player.GetAxis2D(pair.def.rewiredAction1, pair.def.rewiredAction2);
                Vector2 oldValue = pair.action.axis2D;
                var     change   =
                    value.sqrMagnitude == oldValue.sqrMagnitude ? InputAction.ValueChange.None :
                    value.sqrMagnitude > 0.0f ? InputAction.ValueChange.NotZero :
                    InputAction.ValueChange.Zero
                ;
                pair.action = new InputAction(value, change);
                break;
            }
            }
        }
    }
Esempio n. 24
0
        public virtual bool GetBlockInput(int ID)
        {
            GetPlayer(ID);
            m_KeyDown = m_Player.GetButton("Block");//.GetButtonDown("Block");

            if (m_KeyDown)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 25
0
    // Update is called once per frame
    void Update()
    {
        if (!PauseMenu.isGamePaused)
        {
            gamePadController = GetComponentInParent <PlayerController>().getGamePadController();

            lookVertical   = gamePadController.GetAxis("Look Vertical");
            cameraFlip     = gamePadController.GetButton("Camera Flip");
            rotationFactor = rotationSpeed * lookVertical * Time.deltaTime;

            //Debug.Log("camera.rotaiton.x = " + transform.localRotation.x);

            if (!isFlipped)
            {
                if (overUpperBound() || underLowerBound() || transform.localRotation.x < upperBound && transform.localRotation.x > lowerBound)
                {
                    transform.Rotate(rotationFactor, 0, 0, Space.Self); // camera vertical rotation
                }
            }


            if (cameraFlip) // pressed on flip button
            {
                if (!isFlipped)
                {
                    isFlipped = true;
                    // move camera in front/back of player
                    transform.localPosition = new Vector3(transform.localPosition.x, transform.localPosition.y, transform.localPosition.z * -1f);

                    // flip camera
                    transform.Rotate(0f, 180, 0f, Space.World);
                }


                // inverse the horizontal movment and horizontal rotation in PlayerController.cs
            }
            else // rlease of flip button
            {
                if (isFlipped)
                {
                    isFlipped = false;
                    // move camera in front/back of player
                    transform.localPosition = new Vector3(transform.localPosition.x, transform.localPosition.y, transform.localPosition.z * -1f);

                    // flip camera
                    transform.Rotate(0f, -180, 0f, Space.World);
                }
            }
        }
    }
Esempio n. 26
0
 void OnTriggerStay2D(Collider2D other)
 {
     // Grab a peg
     if (other.gameObject.CompareTag("Peg"))
     {
         if (!isHoldingPeg && player.GetButton(grab))
         {
             StopPegSeek();
             isHoldingPeg = true;
             HingeJoint2D hinge = gameObject.AddComponent <HingeJoint2D>() as HingeJoint2D;
             heldPeg             = other.gameObject;
             hinge.connectedBody = other.gameObject.GetComponent <Rigidbody2D>();
         }
     }
 }
Esempio n. 27
0
    public static bool GetButton(uint index, Button button)
    {
#if USE_REWIRED
        RE.Player player = RE.ReInput.players.GetPlayer((int)index);
        return(player.GetButton(ButtonToRewiredAction(button)));
#else // USE_REWIRED
        if (Input.GetKey(ButtonToKeyCode(index, button)))
        {
            return(true);
        }

        Xbox360Button?btn360 = ButtonTo360(button);
        return(btn360 == null ? false : GetXboxButton((uint)index, btn360.Value));
#endif // USE_REWIRED
    }
Esempio n. 28
0
    // Update is called once per frame
    void Update()
    {
        velocity = body.GetRelativePointVelocity(relative_point);
        mag      = velocity.magnitude;

        float topSpeed = FORWARD_BOOST_FLAG ? TOP_SPEED * 2f : TOP_SPEED;

        if (mag > topSpeed)
        {
            body.velocity = velocity.normalized * topSpeed;
        }

        body.AddForce(Vector2.up * FORCE_APPLIED * player.GetAxis(RewiredConsts.Action.MOVEVERTICAL));
        body.AddForce(Vector2.right * FORCE_APPLIED * player.GetAxis(RewiredConsts.Action.MOVEHORIZONTAL));
        body.AddForce(Vector2.right * CONSTANT_SCROLL_FORCE);


        if (player.GetButtonDown(RewiredConsts.Action.SWIM) && Time.time - boostTime > BOOST_COOLDOWN)
        {
            boostTime = Time.time;
            AkSoundEngine.PostEvent("FishSpeedBurst", gameObject);
        }
        if (player.GetButton(RewiredConsts.Action.SWIM) && Time.time - boostTime < BOOST_DURATION)
        {
            body.AddForce(Vector2.right * BOOST_FORCE);
            FORWARD_BOOST_FLAG = true;
            var emission = bubbleTrail.emission;
            emission.enabled = true;
        }
        else
        {
            FORWARD_BOOST_FLAG = false;
            var emission = bubbleTrail.emission;
            emission.enabled = false;
        }
        if (player.GetButtonDown(RewiredConsts.Action.FIRE))
        {
            if (prawns.Count > 0)
            {
                prawns[prawns.Count - 1].Shoot(transform.position + Vector3.right * 0.1f, Vector3.right);
                prawns.RemoveAt(prawns.Count - 1);
                Game.Instance.player.ShrimpCount = prawns.Count;
                AkSoundEngine.PostEvent("ShrimpCanon", gameObject);
            }
        }
    }
Esempio n. 29
0
 void Update () {
     updateInfoCard();
     if (!isBot && BrawlCore.Instance.isRunning)
     {
         hAxis = player.GetAxis("hAxis");
         vAxis = player.GetAxis("vAxis");
         btJump = player.GetButtonDown("jump");
         btShield = player.GetButton("shield");
         btHit = player.GetButtonDown("hit");
     }
     if (lastHit < stunDelay)
         hAxis = 0;
     physics();
     jumpDelay += Time.deltaTime;
     if (btJump)
         jump();
     if (!isBot && !weapons[weaponId].isActive)
         useShield(btShield);
     handleShield();
     handleHit();
     contactDetector.collider.enabled = (rb.velocity.y > 0 ? false : true);
     if (hAxis < -0.1f)
     {
         isTurnedLeft = true;
         transform.rotation = Quaternion.Euler(0, 180, 0);
     }
     if (hAxis > 0.1f)
     {
         isTurnedLeft = false;
         transform.rotation = Quaternion.Euler(0, 0, 0);
     }
     if (transform.position.y < -10)
     {
         var ps = GameObject.Instantiate(dieParticle);
         ps.transform.position = transform.position;
         ps.SetActive(true);
         transform.position = Vector2.zero;
         lives--;
         if (lives == -1)
             BrawlCore.Instance.stopGame();
         damage = 0;
     }
     lastHit += Time.deltaTime;
 }
Esempio n. 30
0
 private void Update()
 {
     if (_player.GetButton("Return"))
     {
         _cancelCurrentTime -= Time.deltaTime;
         _slider.value      += Time.deltaTime;
         if (_cancelCurrentTime <= 0)
         {
             Close();
         }
     }
     else
     {
         if (!(_cancelCurrentTime < _cancelTime))
         {
             return;
         }
         _cancelCurrentTime += Time.deltaTime;
         _slider.value      -= Time.deltaTime;
     }
 }