Esempio n. 1
0
    public void Update(float dt)
    {
        if (!SongTimer.isSongRunning)
        {
            return;
        }

        float leadin = SongTimer.LeadInRatio();

        float moveDown = Mathf.Cos(SongTimer.TimedValue()) * leadin;

        float moveSideway = Mathf.Sin(SongTimer.TimedValue(4f)) * leadin;


        hip.bone.position = hip.initialWorldPosition + new Vector3(moveSideway * .1f, moveDown * .1f, 0);

        leg_upper.bone.position = leg_upper.initialWorldPosition + new Vector3(moveSideway * .08f, moveDown * .08f, 0);

        leg_lower.bone.position = leg_lower.initialWorldPosition + new Vector3(moveSideway * .05f, moveDown * .05f, 0);

        leg_heel.bone.position = leg_heel.initialWorldPosition + new Vector3(moveSideway * .02f, moveDown * .02f, 0);

        if (isLeft)
        {
            float tap = Mathf.Sin(SongTimer.TimedValue(8f)) * leadin;

            tap -= 1f - 1f / 36f;


            leg_feet.bone.position = leg_feet.initialWorldPosition + new Vector3(0, Mathf.Max(tap, 0) * 5f, 0);
            //leg_feet.bone.position = leg_feet.initialWorldPosition;
        }
    }
Esempio n. 2
0
    public void Update(float dt)
    {
        Vector2 stick = input.GetRightStick();

        stick.x = stick.x * -1f;
        stick.y = stick.y * -1f;


        stick.x = Mathf.MoveTowards(currentAppliedVector2.x, stick.x, 18f * dt);
        stick.y = Mathf.MoveTowards(currentAppliedVector2.y, stick.y, 18f * dt);

        currentAppliedVector2 = stick;

        if (birdControl.DEBUG_ENABLE_KEYBOARD)
        {
            const float MOV_AMOUNT = 0.15f;
            if (Input.GetKey(KeyCode.T))
            {
                _keyboardInput.y -= MOV_AMOUNT;
            }

            if (Input.GetKey(KeyCode.G))
            {
                _keyboardInput.y += MOV_AMOUNT;
            }

            _keyboardInput.y = Mathf.Clamp(_keyboardInput.y, -1f, 1f);


            if (Input.GetKey(KeyCode.F))
            {
                _keyboardInput.x += MOV_AMOUNT;
            }

            if (Input.GetKey(KeyCode.H))
            {
                _keyboardInput.x -= MOV_AMOUNT;
            }

            _keyboardInput.x = Mathf.Clamp(_keyboardInput.x, -1f, 1f);

            stick = _keyboardInput;

            _keyboardInput.y *= 0.9f;
            _keyboardInput.x *= 0.9f;
        }

        //body.bone.localPosition = body.initialLocalPosition + new Vector3(stick.x * BODY_POS_MOD, stick.y * BODY_POS_MOD);
        body.bone.localRotation = body.initialLocalRotation * Quaternion.AngleAxis(Mathf.Lerp(-10f, 20f, (stick.y + 1f) / 2f), Vector3.right)
                                  * Quaternion.AngleAxis(Mathf.Lerp(-ROTATE_SIDEWAYS, ROTATE_SIDEWAYS, (stick.x + 1f) / 2f), Vector3.forward);

        if (SongTimer.isSongRunning)
        {
            float moveDown    = Mathf.Cos(SongTimer.TimedValue()) * SongTimer.LeadInRatio();
            float moveSideway = Mathf.Sin(SongTimer.TimedValue(4f)) * SongTimer.LeadInRatio();

            body.bone.position = body.initialWorldPosition + new Vector3(moveSideway * .1f, moveDown * .1f, 0);
        }
    }