Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (hasAttach && mBombCtrl.curDelay < mBombCtrl.deathDelay)
        {
            mBombCtrl.curDelay += Time.deltaTime;
            mPlayer.HUD.UpdateTicker(mBombCtrl.curDelay, mBombCtrl.deathDelay);
        }

        if (mPlayer.isGoal)
        {
            if (mPlayer.HUD.targetOffScreen.gameObject.activeSelf)
            {
                mPlayer.HUD.targetOffScreen.gameObject.SetActive(false);
            }
        }

        if (mInputEnabled)
        {
            //vertical movement
            InputManager input = Main.instance.input;

            float axisY = input.GetAxis(0, InputAction.MoveY);

            float moveVertical;

            //check if dropping
            if (axisY < -0.1f)
            {
                moveVertical = Mathf.Sign(axisY);
                mThrowMode   = ThrowMode.Down;
            }
            else if (axisY > 0.1f)
            {
                moveVertical = Mathf.Sign(axisY);
                mThrowMode   = ThrowMode.Up;
            }
            else
            {
                moveVertical = 0.0f;
                mThrowMode   = ThrowMode.None;
            }

            if (moveVertical != mLastMoveVertical)
            {
                mLastMoveVertical     = moveVertical;
                mLastMoveVerticalTime = Time.time;
                mVerticalMoveActive   = true;
            }
        }
        else
        {
            mThrowMode = ThrowMode.None;
        }

        Vector3 a;

        switch (mThrowMode)
        {
        case ThrowMode.None:
            attachPoint.localRotation = Quaternion.identity;
            break;

        case ThrowMode.Down:
            a   = attachPoint.localEulerAngles;
            a.z = mBodySpriteCtrl.isLeft ? 60 : -60;
            attachPoint.localEulerAngles = a;
            break;

        case ThrowMode.Up:
            a   = attachPoint.localEulerAngles;
            a.z = mBodySpriteCtrl.isLeft ? -60 : 60;
            attachPoint.localEulerAngles = a;
            break;
        }

        if (mVerticalMoveActive)
        {
            if (Time.time - mLastMoveVerticalTime > lookDelay)
            {
                if (mLastMoveVertical == 0.0f)
                {
                    mBody.eyeOfs.y = 0.0f;
                }
                else if (mLastMoveVertical > 0.0f)
                {
                    mBody.eyeOfs.y = lookOfs;
                }
                else if (mLastMoveVertical < 0.0f)
                {
                    mBody.eyeOfs.y = -lookOfs;
                }

                mVerticalMoveActive = false;
            }
        }
    }
Ejemplo n.º 2
0
    public void ResetData()
    {
        mVerticalMoveActive = false;
        mLastMoveVertical   = 0.0f;

        mHurtForceDelay = 0.0f;

        if (bombGrabber)
        {
            bombGrabber.gameObject.SetActive(false);
        }

        foreach (SpriteColorBlink blink in spriteBlinks)
        {
            if (blink)
            {
                blink.enabled = false;
            }
        }

        if (attachAnimator)
        {
            attachAnimator.transform.localScale = Vector3.one;
            attachAnimator.Stop();
        }

        if (mBody)
        {
            mBody.ResetCollision();
            mBody.eyeOfs = Vector3.zero;
        }

        if (mBodySpriteCtrl)
        {
            mBodySpriteCtrl.ResetAnimation();
        }

        if (attachSpriteAnim)
        {
            attachSpriteAnim.Sprite.FlipX = false;
        }

        if (mBombCtrl)
        {
            mBombCtrl.Init();
        }

        if (mPlayer)
        {
            HUD hud = mPlayer.HUD;
            if (hud)
            {
                if (hud.tickerLabel)
                {
                    hud.tickerLabel.gameObject.SetActive(false);
                }

                if (hud.targetOffScreen)
                {
                    hud.targetOffScreen.gameObject.SetActive(false);
                }
            }
        }

        mThrowMode = ThrowMode.None;

        if (attachPoint)
        {
            attachPoint.localRotation = Quaternion.identity;
        }

        doubleJumpAnim.Stop();
    }