コード例 #1
0
 private void OnValidate()
 {
     if (!Application.isPlaying)
     {
         if (Box2DBounds == null)
         {
             Box2DBounds    = (CollisionFactory.Box2DBounds)CollisionFactory.GetNewBoundsInstance(CollisionFactory.ECollisionShape.BOX);
             PreviousBounds = CollisionFactory.GetNewBoundsInstance(Box2DBounds.CollisionShape);
         }
     }
 }
コード例 #2
0
 protected override void Awake()
 {
     Box2DBounds = (CollisionFactory.Box2DBounds)CollisionFactory.GetNewBoundsInstance(CollisionFactory.ECollisionShape.BOX);
     if (AssignedCollisionType == ECollisionType.PHYSICS)
     {
         Box2DBounds.BufferBounds = BufferSizePhysicsCollision;
         PhysicsBoxBounds         = (CollisionFactory.Box2DBounds)CollisionFactory.GetNewBoundsInstance(CollisionFactory.ECollisionShape.BOX);
     }
     AssignBoundsToCollider(Box2DBounds);
     base.Awake();
 }
コード例 #3
0
 private void OnDrawGizmos()
 {
     #if UNITY_EDITOR
     if (Box2DBounds == null)
     {
         Box2DBounds = (CollisionFactory.Box2DBounds)CollisionFactory.GetNewBoundsInstance(CollisionFactory.ECollisionShape.BOX);
     }
     if (!Application.isPlaying)
     {
         UpdateHitboxBounds();
     }
     Color ColorWithTransparency = DebugDrawColor;
     ColorWithTransparency.a = .2f;
     UnityEditor.Handles.DrawSolidRectangleWithOutline(Box2DBounds.GetVerticies(), ColorWithTransparency, DebugDrawColor);
     #endif
 }
コード例 #4
0
 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
 }
コード例 #5
0
    private void OnDrawGizmos()
    {
        if (!Application.isPlaying)
        {
            if (Box2DBounds == null)
            {
                Box2DBounds = (CollisionFactory.Box2DBounds)CollisionFactory.GetNewBoundsInstance(CollisionFactory.ECollisionShape.BOX);
            }
            UpdateColliderBounds();
        }

        DrawBoxColliderBounds(Box2DBounds, DebugColliderColor);
        if (PhysicsBoxBounds != null)
        {
            DrawBoxColliderBounds(PhysicsBoxBounds, Color.red);
        }
    }
コード例 #6
0
 protected override void Awake()
 {
     base.Awake();
     Box2DBounds = (CollisionFactory.Box2DBounds)CollisionFactory.GetNewBoundsInstance(CollisionFactory.ECollisionShape.BOX);
     AssignHitboxBounds(Box2DBounds);
 }