예제 #1
0
    public List <Col> CheckCol(TwoCol other)
    {
        List <Col> output = new List <Col>();

        foreach (TwoCol e in twoCol)
        {
            if (e == other || !e.CanCollide(other))
            {
                continue;
            }

            Col     col = new Col();
            Vector2 vec = other.CheckCol(e);
            if (vec != Vector2.zero)
            {
                col.col  = e;
                col.move = vec;

                output.Add(col);
            }
        }

        // No collisions.
        return(output);
    }
예제 #2
0
    public Vector2 CheckColMove(TwoCol other, TwoCol.ColType type)
    {
        Vector2 output = Vector2.zero;

        foreach (TwoCol e in twoCol)
        {
            if (e == other || !e.HasType(type) || !e.CanCollide(other))
            {
                continue;
            }

            output += other.CheckCol(e);
        }

        // No collisions.
        return(output);
    }
예제 #3
0
    public TwoCol IsCol(TwoCol other, TwoCol.ColType type)
    {
        foreach (TwoCol e in twoCol)
        {
            if (e == other || !e.HasType(type) || !e.CanCollide(other))
            {
                continue;
            }

            if (other.CheckCol(e) != Vector2.zero)
            {
                return(e);
            }
        }

        // No collisions.
        return(null);
    }