示例#1
0
    private void TranslateSpaceship()
    {
        if (accelerateInput == 0)
        {
            engineEffects.SetActive(false);
            shipAnimator.SetBool("Accelerate", false);
        }
        else
        {
            engineEffects.SetActive(true);
            shipAnimator.SetBool("Accelerate", true);
        }

        CurrentSpeed = Mathf.Clamp(CurrentSpeed += accelerateInput, -MaxMovementSpeed, MaxMovementSpeed);

        var scaledMoveSpeed = CurrentSpeed * Time.deltaTime;

        m_TargetState.Translate(Vector3.forward * scaledMoveSpeed);
    }
    private void TranslateSpaceship()
    {
        if (!accelerateInput)
        {
            particle.SetActive(false);
            return;
        }

        particle.SetActive(true);
        var scaledMoveSpeed = MovementSpeed * Time.deltaTime;

        m_TargetState.Translate(-Vector3.forward * scaledMoveSpeed);
    }