//Used to add to the effectedObjectList public void AddedEffectedObject2D(Rigidbody2D touchedObject, CircularGravity.PhysicsEffect physicsEffect, GameObject attachedGameObject) { if (EffectedObjectList.Count == 0) { EffectedObject2D effectedObject = new EffectedObject2D(Time.time, touchedObject, physicsEffect); EffectedObjectList.Add(effectedObject); CreateAttachedGameObject2D(touchedObject, attachedGameObject); } else if ((EffectedObjectList.Count > 0)) { bool checkIfExists = false; foreach (EffectedObject2D item in EffectedObjectList) { if (item.TouchedObject == touchedObject) { item.EffectedTime = Time.time; checkIfExists = true; break; } } if (!checkIfExists) { EffectedObject2D effectedObject = new EffectedObject2D(Time.time, touchedObject, physicsEffect); EffectedObjectList.Add(effectedObject); CreateAttachedGameObject2D(touchedObject, attachedGameObject); } } }
public EffectedObject2D(float effectedTime, Rigidbody2D touchedObject, CircularGravity.PhysicsEffect physicsEffect) { this.EffectedTime = effectedTime; this.TouchedObject = touchedObject; this.PhysicsEffect = physicsEffect; }