示例#1
0
        /// <summary>
        /// Converts from the combined surface flags to sa2 surface flags
        /// </summary>
        /// <param name="flags"></param>
        /// <returns></returns>
        public static SA2SurfaceAttributes ToSA2(this SurfaceAttributes flags)
        {
            SA2SurfaceAttributes result = 0;

            if (flags.HasFlag(SurfaceAttributes.Solid))
            {
                result |= SA2SurfaceAttributes.Solid;
            }
            if (flags.HasFlag(SurfaceAttributes.Water))
            {
                result |= SA2SurfaceAttributes.Water;
            }
            if (flags.HasFlag(SurfaceAttributes.NoFriction))
            {
                result |= SA2SurfaceAttributes.NoFriction;
            }
            if (flags.HasFlag(SurfaceAttributes.NoAcceleration))
            {
                result |= SA2SurfaceAttributes.NoAcceleration;
            }
            if (flags.HasFlag(SurfaceAttributes.LessAcceleration))
            {
                result |= SA2SurfaceAttributes.LessAcceleration;
            }
            if (flags.HasFlag(SurfaceAttributes.Diggable))
            {
                result |= SA2SurfaceAttributes.Diggable;
            }
            if (flags.HasFlag(SurfaceAttributes.NotClimbable))
            {
                result |= SA2SurfaceAttributes.NotClimbable;
            }
            if (flags.HasFlag(SurfaceAttributes.IgnoreSlope))
            {
                result |= SA2SurfaceAttributes.IgnoreSlope;
            }
            if (flags.HasFlag(SurfaceAttributes.Hurt))
            {
                result |= SA2SurfaceAttributes.Hurt;
            }
            if (flags.HasFlag(SurfaceAttributes.Footprints))
            {
                result |= SA2SurfaceAttributes.Footprints;
            }
            if (flags.HasFlag(SurfaceAttributes.CannotLand))
            {
                result |= SA2SurfaceAttributes.CannotLand;
            }
            if (flags.HasFlag(SurfaceAttributes.WaterNoAlpha))
            {
                result |= SA2SurfaceAttributes.WaterNoAlpha;
            }
            if (flags.HasFlag(SurfaceAttributes.NoShadows))
            {
                result |= SA2SurfaceAttributes.NoShadows;
            }
            if (flags.HasFlag(SurfaceAttributes.IncreasedAcceleration))
            {
                result |= SA2SurfaceAttributes.IncreasedAcceleration;
            }
            if (flags.HasFlag(SurfaceAttributes.NoFog))
            {
                result |= SA2SurfaceAttributes.NoFog;
            }
            if (flags.HasFlag(SurfaceAttributes.Unknown24))
            {
                result |= SA2SurfaceAttributes.Unknown24;
            }
            if (flags.HasFlag(SurfaceAttributes.DynamicCollision))
            {
                result |= SA2SurfaceAttributes.DynamicCollision;
            }
            if (flags.HasFlag(SurfaceAttributes.OffsetBoundsCenter))
            {
                result |= SA2SurfaceAttributes.OffsetBoundsCenter;
            }
            if (flags.HasFlag(SurfaceAttributes.BoundsRadiusSmall))
            {
                result |= SA2SurfaceAttributes.BoundsRadiusSmall;
            }
            if (flags.HasFlag(SurfaceAttributes.BoundsRadiusTiny))
            {
                result |= SA2SurfaceAttributes.BoundsRadiusTiny;
            }
            if (flags.HasFlag(SurfaceAttributes.Visible))
            {
                result |= SA2SurfaceAttributes.Visible;
            }

            return(result);
        }
示例#2
0
 /// <summary>
 /// Checks whether the Landentry is used for collision detection
 /// </summary>
 /// <param name="flags"></param>
 /// <returns></returns>
 public static bool IsCollision(this SurfaceAttributes flags)
 {
     return(flags.HasFlag(SurfaceAttributes.Solid) ||
            flags.HasFlag(SurfaceAttributes.Water) ||
            flags.HasFlag(SurfaceAttributes.WaterNoAlpha));
 }
示例#3
0
        /// <summary>
        /// Converts from the combined surface flags to sa1 surface flags
        /// </summary>
        /// <param name="flags"></param>
        /// <returns></returns>
        public static SA1SurfaceAttributes ToSA1(this SurfaceAttributes flags)
        {
            SA1SurfaceAttributes result = 0;

            if (flags.HasFlag(SurfaceAttributes.Solid))
            {
                result |= SA1SurfaceAttributes.Solid;
            }
            if (flags.HasFlag(SurfaceAttributes.Water))
            {
                result |= SA1SurfaceAttributes.Water;
            }
            if (flags.HasFlag(SurfaceAttributes.NoFriction))
            {
                result |= SA1SurfaceAttributes.NoFriction;
            }
            if (flags.HasFlag(SurfaceAttributes.NoAcceleration))
            {
                result |= SA1SurfaceAttributes.NoAcceleration;
            }
            if (flags.HasFlag(SurfaceAttributes.CannotLand))
            {
                result |= SA1SurfaceAttributes.CannotLand;
            }
            if (flags.HasFlag(SurfaceAttributes.IncreasedAcceleration))
            {
                result |= SA1SurfaceAttributes.IncreasedAcceleration;
            }
            if (flags.HasFlag(SurfaceAttributes.Diggable))
            {
                result |= SA1SurfaceAttributes.Diggable;
            }
            if (flags.HasFlag(SurfaceAttributes.NotClimbable))
            {
                result |= SA1SurfaceAttributes.NotClimbable;
            }
            if (flags.HasFlag(SurfaceAttributes.Hurt))
            {
                result |= SA1SurfaceAttributes.Hurt;
            }
            if (flags.HasFlag(SurfaceAttributes.Footprints))
            {
                result |= SA1SurfaceAttributes.Footprints;
            }
            if (flags.HasFlag(SurfaceAttributes.Visible))
            {
                result |= SA1SurfaceAttributes.Visible;
            }

            return(result);
        }