protected virtual void Awake()
 {
     GameOverseer.Instance.PhysicsManager.AddCollider2DToPhysicsManager(this);
     AssociatedPhysicsComponent = GetComponent <CustomPhysics2D>();
     if (AssociatedPhysicsComponent && AssignedCollisionType != ECollisionType.PHYSICS)
     {
         Debug.LogWarning("Your collider contains a physics component, but is not set to CollisionType - 'Physics'. Are you sure this is correct?");
     }
     else if (!AssociatedPhysicsComponent && AssignedCollisionType == ECollisionType.PHYSICS)
     {
         Debug.LogWarning("You collider does not contain a Physics component, but is assigned to CollisionType - 'Physics'. This can not work");
     }
     PreviousBounds = CollisionFactory.GetNewBoundsInstance(AssociatedBounds.CollisionShape);
     UpdateColliderBounds();                          //We want to update the collider bounds on awake
     PreviousBounds.CopyBoundsFrom(AssociatedBounds); //Make an exact copy for the first iteration
 }
Example #2
0
 /// <summary>
 /// This mehtod must be called to properly check for collisions
 /// </summary>
 /// <param name="BoundsToAssign"></param>
 public void AssignHitboxBounds(CollisionFactory.Bounds BoundsToAssign)
 {
     this.AssociatedBounds = BoundsToAssign;
 }
 /// <summary>
 /// This method needs to be called to appropriately run collision methods for our collider
 /// </summary>
 /// <param name="BoundsToAssign"></param>
 protected void AssignBoundsToCollider(CollisionFactory.Bounds BoundsToAssign)
 {
     this.AssociatedBounds = BoundsToAssign;
 }