Example #1
0
    void OnTriggerEnter2D(Collider2D collision)
    {
        // Flip no matter what state the player is in
        PlatformerController2D objectWithStates = collision.GetComponent <PlatformerController2D>();

        if (objectWithStates != null)
        {
            objectWithStates.LockSwitch();
            objectWithStates.SwitchStates();
        }
    }
Example #2
0
    void OnTriggerEnter2D(Collider2D collision)
    {
        // Only switches if the player is in the Up state
        PlatformerController2D objectWithStates = collision.GetComponent <PlatformerController2D>();

        if (objectWithStates != null)
        {
            objectWithStates.LockSwitch();
            if (objectWithStates.physicalState == PlatformerController2D.State.Up)
            {
                objectWithStates.SwitchStates();
            }
        }
    }