public static bool CheckParticleBounds(PowderPoint P) { if ((uint)P.PX >= Program.Resolution.X - 1) { if (VoidMode == true) { return(false); } else { P.PX = 1; } } if ((uint)P.PY >= Program.Resolution.Y - 1) { if (VoidMode == true) { return(false); } else { P.PY = 1; } } if ((uint)P.PX < 1) { if (VoidMode == true) { return(false); } else { P.PX = Program.Resolution.X - 1; } } if ((uint)P.PY < 1) { if (VoidMode == true) { return(false); } else { P.PY = Program.Resolution.Y - 1; } } return(true); }
public static void Insert(Vector2i Position, int Type) { if (GetParticleAtPos((Vector2u)Position) == -1) { PowderPoint New = new PowderPoint() { PX = (uint)Position.X, PY = (uint)Position.Y, Type = (uint)Type, ColVar = (byte)RDM.Next(0, Resources.PowderTypes[Type].MaxColVar + 1) }; if (CheckParticleBounds(New)) { Particles.Add(New); AssertParticle(Particles.Count - 1); } } }