[I][COLOR=#ff0000]private void OnParticleCollisionManual(GameObject other, int aliveParticles = -1)[/COLOR][/I]
{
collisionEvents.Clear();
var aliveEvents = initiatorPS.GetCollisionEvents(other, collisionEvents);
for (int i = 0; i < aliveEvents; i++)
{
var angle = Vector3.Angle(collisionEvents[i].normal, Vector3.up);
if (angle > MaxGroundAngleDeviation) continue;
if (InstantiateWhenZeroSpeed)
{
if (collisionEvents[i].velocity.sqrMagnitude > 0.1f) continue;
var isNearDistance = false;
for (int j = 0; j < aliveParticles; j++)
{
var distance = Vector3.Distance(collisionEvents[i].intersection, particles[j].position);
if (distance < MinDistanceBetweenDecals) isNearDistance = true;
}
if (isNearDistance) continue;
}
var emiter = new ParticleSystem.EmitParams();
emiter.position = collisionEvents[i].intersection + collisionEvents[i].normal * MinDistanceBetweenSurface;
var rotation = Quaternion.LookRotation(-collisionEvents[i].normal).eulerAngles;
rotation.z = Random.Range(0, 360);
emiter.rotation3D = rotation;
DecalParticles.Emit(emiter, 1);
}
}
void OnParticleCollision(GameObject other)
{
if (InstantiateWhenZeroSpeed)
{
if (!collidedGameObjects.Contains(other))
[I][COLOR=#ff0000] collidedGameObjects.Add(other);[/COLOR][/I]
}
else
{
OnParticleCollisionManual(other);
}
}
}
I cant use default parameters and these 2 functions use it. I need to change them to not use default parameters. I heard of method overloading, but when i tried i couldnt get it to work. Can someone help me with it?
Edit: the code snippets that have “color” in front of them are the issue.