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); }
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); }