Example #1
0
    /// <summary>
    /// Triggered when something exits the ladder
    /// </summary>
    /// <param name="collider">Something colliding with the ladder.</param>
    protected virtual void OnTriggerEnter2D(Collider2D collider)
    {
        if (collider.tag == "Player")
        {
            Fplayer characterLadder = collider.GetComponent <Fplayer>();

            characterLadder._gravityActive = 0;

            characterLadder.LadderColliding = true;
        }
    }
Example #2
0
    protected virtual void OnTriggerStay2D(Collider2D collider)
    {
        if (collider.tag == "Player")
        {
            Fplayer characterLadder = collider.GetComponent <Fplayer>();
            characterLadder._gravityActive  = 0;
            characterLadder.LadderColliding = true;
            //Vector2 targetposition = new Vector2(_boundsBottomCenterPosition.x, characterLadder.transform.position.y);

            Physics2D.IgnoreCollision(collider.GetComponent <Collider2D>(), top, true); //与屋顶不碰撞
        }
    }
Example #3
0
    protected virtual void OnTriggerExit2D(Collider2D collider)
    {
        if (collider.tag == "Player")
        {
            Fplayer characterLadder = collider.GetComponent <Fplayer>();
            characterLadder._gravityActive  = 1;
            characterLadder.LadderColliding = false;
            collider.transform.GetComponent <Fplayer>().Control();


            Physics2D.IgnoreCollision(collider.GetComponent <Collider2D>(), top, false); //与屋顶有碰撞
        }
    }