Example #1
0
    public static bool beginCollisionWithPlayer(ChipmunkArbiter arbiter)
    {
        ChipmunkShape shape1, shape2;

        // The order of the arguments matches the order in the function name.
        arbiter.GetShapes(out shape1, out shape2);

        Chase  chase  = shape1.GetComponent <Chase>();
        Player player = shape2.GetComponent <Player>();

        if (player.isDying() || !chase.isOperable())
        {
            return(false);            // stop collision since this frame
        }
        // start chasing player
        chase.target = player.transform;
        chase.enableChasing();

        // Returning false from a begin callback means to ignore the collision response for these two colliding shapes
        // until they separate. Also for current frame. Ignore() does the same but next frame.
        return(false);
    }