static PhysicsMovement SetupPhysicsMovement(GameObject go) { var physicsMovement = go.AddComponent <PhysicsMovement>(); physicsMovement.boxCollider = go.GetComponent <BoxCollider2D>(); physicsMovement.rigidbody = go.GetComponent <Rigidbody2D>(); physicsMovement.layerMask = Physics2D.GetLayerCollisionMask(go.layer); PrivateHelpers.CallPrivateMethod(physicsMovement, "Awake"); return(physicsMovement); }
public static GameObject CreatePhysicsMovement(string name, Vector2 position, Vector2 size) { GameObject go = CreateCollider(name, position, size); var physicsMovement = go.AddComponent <PhysicsMovement>(); physicsMovement.boxCollider = go.GetComponent <BoxCollider2D>(); physicsMovement.rigidbody = go.GetComponent <Rigidbody2D>(); physicsMovement.layerMask = Physics2D.GetLayerCollisionMask(go.layer); PrivateHelpers.CallPrivateMethod(physicsMovement, "Awake"); return(go); }