Exemple #1
0
 public EHPhysicsManager2D()
 {
     ColliderComponentDictionary.Add(EHBaseCollider2D.EColliderType.STATIC, new HashSet <EHBaseCollider2D>());
     ColliderComponentDictionary.Add(EHBaseCollider2D.EColliderType.MOVEABLE, new HashSet <EHBaseCollider2D>());
     ColliderComponentDictionary.Add(EHBaseCollider2D.EColliderType.PHYSICS, new HashSet <EHBaseCollider2D>());
     CachedInstance = this;
 }
    protected bool CastRayFromVelocity(Vector2 OriginPosition, out EHRayTraceHit RayHit, int LayerMask = 0, bool bDebugDrawLines = false)
    {
        Vector2          ProjectileVelocity = Physics2D.Velocity;
        EHRayTraceParams Params             = new EHRayTraceParams();

        Params.RayOrigin    = OriginPosition;
        Params.RayDirection = ProjectileVelocity.normalized;
        Params.RayLength    = ProjectileVelocity.magnitude * EHTime.DeltaTime;
        return(EHPhysicsManager2D.RayTrace2D(ref Params, out RayHit, LayerMask, bDebugDrawLines));
    }
Exemple #3
0
    /// <summary>
    /// Checks to see if you have enough room to stand and then will change the state to stand if valid
    /// </summary>
    /// <returns></returns>
    private bool AttemptStand()
    {
        EHRect2D CastBox = new EHRect2D();

        CastBox.RectPosition = AssociatedCollider.GetBounds().MinBounds;
        CastBox.RectSize     = AssociatedCollider.DefaultColliderSize;
        EHBaseCollider2D HitCollider;

        if (!EHPhysicsManager2D.BoxCast2D(ref CastBox, out HitCollider, LayerMask.GetMask(ENVIRONMENT_LAYER)))
        {
            SetMovementType(EMovementType.STANDING);
            return(true);
        }
        return(false);
    }