Example #1
0
    private void SetBoundY()
    {
        float bound;
        float y                  = m_Player.transform.position.y;
        float minHeight          = m_PlayerController.GetMinHeight();
        float height             = m_PlayerController.GetHeight();
        float minVelocity        = m_PlayerController.GetMinVelocity();
        float velocityDifference = m_PlayerController.GetVelocityDifference();

        bound = y + minHeight + ((m_PushForce - minVelocity) / velocityDifference) * height;
        m_PlayerController.SetBoundY(bound);
    }
Example #2
0
    void Start()
    {
        m_Platform  = transform.parent;
        m_Rigidbody = m_Platform.GetComponent <Rigidbody2D>();
        m_Collider  = GetComponent <CapsuleCollider2D>();

        m_Player           = GameObject.FindGameObjectWithTag("Player");
        m_PlayerController = m_Player.GetComponent <NewPlayerController>();

        m_PushForce = m_PlayerController.GetMinVelocity();

        m_AudioSource = GetComponent <AudioSource>();
    }