public Surface(SurfaceType type, Vector2 start, Vector2 end) { surfaceLineSegment = new LineSegment(start, end); m_type = type; construct(); }
/// <summary> /// Constructor for a triangle. Points must be added in a clockwise manner /// </summary> /// <param name="a">first point</param> /// <param name="b">second point</param> /// <param name="c">third point</param> /// <param name="st">the surface texture (color, texture, etc)</param> public Triangle(Vector3 a, Vector3 b, Vector3 c, SurfaceType st) { Vertices = new Vector3[] { a, b, c }; this.surface = st; Normal = new Vector3(float.MaxValue); }
/// <summary> /// Constructor for a triangle. Points must be added in a clockwise manner /// </summary> /// <param name="a">first point</param> /// <param name="b">second point</param> /// <param name="c">third point</param> /// <param name="st">the surface texture (color, texture, etc)</param> public Triangle(Vector3 a, Vector3 b, Vector3 c, Vector2[] textures, SurfaceType st) { Vertices = new Vector3[] { a, b, c }; this.surface = st; TextureCoords = textures; Normal = new Vector3(float.MaxValue); }
public Runway(string name, long length, SurfaceType surface, DateTime builtDate, Boolean standard) { this.Name = name; this.Length = length; this.Surface = surface; this.BuiltDate = builtDate; this.Standard = standard; }
//Sphere constructor public Sphere(float r, Vector3 p, Vector4 c, SurfaceType s, bool isLight = false) { radius = r; // position is the point at the centre of the sphere. position = p; surface = s; }
private List<AudioClip> GetSurfaceList(SurfaceType surface) { switch(surface) { default: case SurfaceType.Sand: return sand; } }
public Runway(string name, long length, RunwayType type, SurfaceType surface, DateTime builtDate, Boolean standard) { Name = name; Length = length; Surface = surface; BuiltDate = builtDate; Standard = standard; Type = type; }
public Surface(Tower a, Tower b, SurfaceType type, Level Parent) { tower_A = a; tower_A.AddSurface(this); tower_B = b; tower_B.AddSurface(this); m_type = type; surfaceLineSegment = new LineSegment(a.getPosition(), b.getPosition()); parent = Parent; construct(); }
public void HandleHitSurface(SurfaceType surfaceType, RectangleF block, Direction side) { if (side == Direction.Left) { this.thisObject.CurrentDirection = Direction.Left; this.thisObject.XSpeed.SetSpeed((float) (-1 * this.speed)); } else if (side == Direction.Right) { this.thisObject.CurrentDirection = Direction.Right; this.thisObject.XSpeed.SetSpeed((float) this.speed); } }
// Token: 0x06002BB4 RID: 11188 RVA: 0x00104DDC File Offset: 0x00102FDC private static void SetPlaceOnSurface(RaycastHit hit, ref Vector3 position, ref Quaternion rotation) { Transform aimTransform = MultiplayerBuilder.GetAimTransform(); Vector3 vector = Vector3.forward; Vector3 vector2 = Vector3.up; if (MultiplayerBuilder.forceUpright) { vector = -aimTransform.forward; vector.y = 0f; vector.Normalize(); vector2 = Vector3.up; } else { SurfaceType surfaceType = MultiplayerBuilder.GetSurfaceType(hit.normal); if (surfaceType != SurfaceType.Wall) { if (surfaceType != SurfaceType.Ceiling) { if (surfaceType == SurfaceType.Ground) { vector2 = hit.normal; vector = -aimTransform.forward; vector.y -= Vector3.Dot(vector, vector2); vector.Normalize(); } } else { vector = hit.normal; vector2 = -aimTransform.forward; vector2.y -= Vector3.Dot(vector2, vector); vector2.Normalize(); } } else { vector = hit.normal; vector2 = Vector3.up; } } position = hit.point; rotation = Quaternion.LookRotation(vector, vector2); if (MultiplayerBuilder.rotationEnabled) { rotation = Quaternion.AngleAxis(MultiplayerBuilder.additiveRotation, vector2) * rotation; } }
/// <summary> /// Site mit DGM /// </summary> public static IfcStore CreateSite( string projectName, string editorsFamilyName, string editorsGivenName, string editorsOrganisationName, IfcLabel siteName, Axis2Placement3D sitePlacement, Mesh mesh, SurfaceType surfaceType, double?breakDist = null, double?refLatitude = null, double?refLongitude = null, double?refElevation = null) { var model = createandInitModel(projectName, editorsFamilyName, editorsGivenName, editorsOrganisationName, out var project); var site = createSite(model, siteName, sitePlacement, refLatitude, refLongitude, refElevation); RepresentationType representationType; RepresentationIdentifier representationIdentifier; IfcGeometricRepresentationItem shape; switch (surfaceType) { case SurfaceType.TFS: shape = createTriangulatedFaceSet(model, sitePlacement.Location, mesh, out representationType, out representationIdentifier); break; case SurfaceType.SBSM: shape = createShellBasedSurfaceModel(model, sitePlacement.Location, mesh, out representationType, out representationIdentifier); break; default: shape = createGeometricCurveSet(model, sitePlacement.Location, mesh, breakDist, out representationType, out representationIdentifier); break; } var repres = createShapeRepresentation(model, shape, representationIdentifier, representationType); using (var txn = model.BeginTransaction("Add Site to Project")) { site.Representation = model.Instances.New <IfcProductDefinitionShape>(r => r.Representations.Add(repres)); project.AddSite(site); model.OwnerHistoryAddObject.CreationDate = DateTime.Now; model.OwnerHistoryAddObject.LastModifiedDate = model.OwnerHistoryAddObject.CreationDate; txn.Commit(); } return(model); }
public static SurfaceType Resolve(PhysicMaterial physics) { SurfaceType value = SurfaceType.Stone; if (physics == null) { return(value); } if (materialMap.TryGetValue(physics, out value)) { return(value); } string[] array = s_TypeNames; int num = array.Length; try { string text = physics.name; if (text.EndsWith(" (Instance)")) { text = text.Substring(0, text.Length - 11); } for (int i = 0; i < num; i++) { if (string.Compare(array[i], text, StringComparison.OrdinalIgnoreCase) == 0) { value = (SurfaceType)s_TypeValues.GetValue(i); materialMap.Add(physics, value); return(value); } } } catch { } Array array2 = s_TypeValues; for (int j = 0; j < num; j++) { if (physics.name.Contains(array[j])) { value = (SurfaceType)array2.GetValue(j); materialMap.Add(physics, value); return(value); } } Debug.LogError("No suface for physics material " + physics.name); return(SurfaceType.Unknown); }
public override void AssignNewShaderToMaterial(Material material, Shader oldShader, Shader newShader) { if (material == null) { throw new ArgumentNullException("material"); } // _Emission property is lost after assigning Standard shader to the material // thus transfer it before assigning the new shader if (material.HasProperty("_Emission")) { material.SetColor("_EmissionColor", material.GetColor("_Emission")); } base.AssignNewShaderToMaterial(material, oldShader, newShader); if (oldShader == null || !oldShader.name.Contains("Legacy Shaders/")) { SetupMaterialBlendMode(material); return; } SurfaceType surfaceType = SurfaceType.Opaque; BlendMode blendMode = BlendMode.Alpha; if (oldShader.name.Contains("/Transparent/Cutout/")) { surfaceType = SurfaceType.Opaque; material.SetFloat("_AlphaClip", 1); } else if (oldShader.name.Contains("/Transparent/")) { // NOTE: legacy shaders did not provide physically based transparency // therefore Fade mode surfaceType = SurfaceType.Transparent; blendMode = BlendMode.Alpha; } material.SetFloat("_Blend", (float)blendMode); material.SetFloat("_Surface", (float)surfaceType); if (surfaceType == SurfaceType.Opaque) { material.DisableKeyword("_SURFACE_TYPE_TRANSPARENT"); } else { material.EnableKeyword("_SURFACE_TYPE_TRANSPARENT"); } }
internal BrisPastPerformance(DataRow dr, int index, BrisHorse parent) { _dr = dr; _index = index; _parent = parent; { string s = Utilities.GetFieldAsString(_dr, FieldIndex.SURFACE + _index); if (s.Length <= 0) { _isATurfRace = false; } else if (s[0] == 'T' || s[0] == 't') { _isATurfRace = true; } else { _isATurfRace = false; } _surfaceType = SurfaceType.Dirt; if (s.Length > 0) { if (s[0] == 'T') { _surfaceType = SurfaceType.Turf; } else if (s[0] == 't') { _surfaceType = SurfaceType.InnerTurf; } else if (s[0] == 'd') { _surfaceType = SurfaceType.InnerDirt; } else { _surfaceType = SurfaceType.Dirt; } } } _fraction[FractionCall.Level.First] = FractionCall.Make(_dr, FirstFractionInYards, FieldIndex.FIRST_CALL_POSITION + _index, FieldIndex.FIRST_FRACTION + _index, FieldIndex.FIRST_CALL_LENGTHS + _index); _fraction[FractionCall.Level.Second] = FractionCall.Make(_dr, SecondFractionInYards, FieldIndex.START_CALL_POSITION + _index, FieldIndex.SECOND_FRACTION + _index, FieldIndex.SECOND_CALL_LENGTHS + _index); _fraction[FractionCall.Level.Stretch] = FractionCall.Make(_dr, ThirdFractionInYards, FieldIndex.STRETCH_POSITION + _index, FieldIndex.THIRD_FRACTION + _index, FieldIndex.STRETCH_LENGTHS + _index); _fraction[FractionCall.Level.Final] = FractionCall.Make(_dr, DistanceInYards, FieldIndex.FINISH_POSITION + _index, FieldIndex.FINAL_TIME + _index, FieldIndex.FINISH_LENGTHS + _index); }
/// <summary> /// Allows child class to specify the surface type, eg: a swap chain. /// </summary> protected RenderTarget2D(GraphicsDevice graphicsDevice, int width, int height, bool mipMap, SurfaceFormat format, DepthFormat depthFormat, int preferredMultiSampleCount, RenderTargetUsage usage, SurfaceType surfaceType) : base(graphicsDevice, width, height, mipMap, format, surfaceType) { DepthStencilFormat = depthFormat; MultiSampleCount = preferredMultiSampleCount; RenderTargetUsage = usage; }
public Tile(Type type, SurfaceType surface) { this.type = type; this.surface = surface; if (type == Type.Platform) { image = new SpriteGameObject(Resources.test);// @"C:\Users\bezimienny\Desktop\Nowy folder\2dGame\2DGame\2DGame\Resources\test.png"); } if (image != null) { image.Parent = this; } }
//public IntPtr Pixels { get; set; } //public int Pitch { get; set; } public Surface(string filePath, SurfaceType surfaceType) { FilePath = filePath; Type = surfaceType; if (surfaceType == SurfaceType.BMP) Handle = SDL.SDL_LoadBMP(FilePath); else if (surfaceType == SurfaceType.PNG) Handle = SDL_image.IMG_Load(FilePath); if (Handle == IntPtr.Zero) throw new Exception(String.Format("Error while loading image surface: {0}", SDL.SDL_GetError())); GetSurfaceMetaData(); }
internal bool <> m__0(IntVec3 c) { if (c.GetFirstItem(this.map) != null) { return(false); } if (!c.Standable(this.map)) { SurfaceType surfaceType = c.GetSurfaceType(this.map); if (surfaceType != SurfaceType.Item && surfaceType != SurfaceType.Eat) { return(false); } } return(true); }
public static SurfaceType GetCurrentSurface(this RaycastHit2D hit, SurfaceType current) { if (Vector2.Dot(hit.normal, Vector2.up) > 0.1f) { if (hit.collider.CompareTag("Surface")) { var info = hit.collider.GetComponent <ColliderSurfaceInfo>(); if (info) { return(info.Surface); } } } return(current); }
void Parse(Stream s) { BinaryReader r = new BinaryReader(s); this.name = r.ReadUInt32(); this.priority = r.ReadByte(); this.areaTypeFlags = (AreaType)r.ReadUInt32(); this.closedPolygon = new PolygonPointList(handler, s); this.allowIntersectionFlags = (AllowIntersection)r.ReadUInt32(); this.surfaceTypeFlags = (SurfaceType)r.ReadUInt32(); this.surfaceAttributeFlags = (SurfaceAttribute)r.ReadUInt32(); this.levelOffset = r.ReadByte(); this.elevationOffset = ParentVersion >= 0x00000007 ? r.ReadSingle() : 0; this.lower = new PolygonPoint(requestedApiVersion, handler, s); this.upper = new PolygonPoint(requestedApiVersion, handler, s); }
/// <summary> /// Generates a bullet hole decal. /// </summary> /// <param name="surface">The surface properties of the hit object.</param> /// <param name="hitInfo">The information about the projectile impact such as position and rotation.</param> public virtual void CreateBulletDecal(SurfaceIdentifier surface, RaycastHit hitInfo) { SurfaceType surfaceType = surface.GetSurfaceType(hitInfo.point, hitInfo.triangleIndex); if (surface && surfaceType) { if (surface.AllowDecals(hitInfo.triangleIndex) && m_MaxDecals > 0) { Material material = surfaceType.GetRandomDecalMaterial(); if (material) { GameObject decal = new GameObject("BulletMark_Decal"); decal.transform.position = hitInfo.point; decal.transform.rotation = Quaternion.FromToRotation(Vector3.back, hitInfo.normal); decal.transform.Rotate(new Vector3(0, 0, Random.Range(0, 360))); float scale = surfaceType.GetRandomDecalSize() / 5; decal.transform.localScale = new Vector3(scale, scale, scale); decal.transform.parent = hitInfo.transform; DecalPresets decalPresets = new DecalPresets() { maxAngle = 60, pushDistance = 0.009f + RegisterDecal(decal, scale), material = material }; Decal d = decal.AddComponent <Decal>(); d.Calculate(decalPresets, hitInfo.collider.gameObject); } } GameObject particle = surfaceType.GetRandomImpactParticle(); if (particle) { Instantiate(particle, hitInfo.point, Quaternion.FromToRotation(Vector3.up, hitInfo.normal)); } AudioClip clip = surfaceType.GetRandomImpactSound(); if (clip) { AudioManager.Instance.PlayClipAtPoint(clip, hitInfo.point, 1, 25, surfaceType.BulletImpactVolume); } } }
public static bool EnsureSurfaceNotEmpty(SurfaceType surface) { Topography topo = Instance; if (surface == SurfaceType.None) { MessageBox.Show("Yüzey seçilmedi.", "XCOM", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } else if ((surface == SurfaceType.Original ? topo.OriginalTIN : topo.ProposedTIN).Triangles.Count == 0) { MessageBox.Show("Seçilen yüzey boş.", "XCOM", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } return(true); }
private Color GetColorForSurfaceType(SurfaceType type) { switch (type) { case SurfaceType.Track: return(Color.gray); case SurfaceType.Ground: return(Color.green); case SurfaceType.Undefined: return(Color.black); default: throw new NotImplementedException(); } }
public static SurfaceMaterialTags BuildMaterialTags(SurfaceType surfaceType) { SurfaceMaterialTags materialTags = new SurfaceMaterialTags(); if (surfaceType == SurfaceType.Opaque) { materialTags.renderQueue = SurfaceMaterialTags.RenderQueue.Geometry; materialTags.renderType = SurfaceMaterialTags.RenderType.Opaque; } else { materialTags.renderQueue = SurfaceMaterialTags.RenderQueue.Transparent; materialTags.renderType = SurfaceMaterialTags.RenderType.Transparent; } return(materialTags); }
private string GetMostSurface(int[] surfaceCounter) { int mostSurfaceIndex = 0; int mostSurfaceValue = 0; for (int i = 0; i < surfaceCounter.Length; i++) { if (surfaceCounter[i] > mostSurfaceValue) { mostSurfaceIndex = i; mostSurfaceValue = surfaceCounter[i]; } } SurfaceType surface = (SurfaceType)mostSurfaceIndex; return surface.ToString(); }
public Surface3D(SurfaceType type, float width, float height, int textureAtlasX, int textureAtlasY, uint textureWidth, uint textureHeight, uint mappedTextureWidth, uint mappedTextureHeight, Rect virtualScreen, WallOrientation wallOrientation, bool alpha, int frameCount, float extrude) { Type = type; Width = width; Height = height; this.virtualScreen = virtualScreen; textureAtlasOffset = new Position(textureAtlasX, textureAtlasY); WallOrientation = wallOrientation; TextureWidth = textureWidth; TextureHeight = textureHeight; MappedTextureWidth = mappedTextureWidth; MappedTextureHeight = mappedTextureHeight; Alpha = alpha; FrameCount = frameCount; this.extrude = extrude; }
public static void OnConstructTexture2D( XTexture2D __instance, GraphicsDevice graphicsDevice, int width, int height, bool mipmap, SurfaceFormat format, ref SurfaceType type, bool shared, int arraySize, ref bool __state ) { if (PlatformConstruct is not null && arraySize == 1 && type == SurfaceType.Texture) { type = SurfaceType.SwapChainRenderTarget; __state = true; }
/// <summary> /// Drapes the curve over the given surface and returns the curve profile. /// </summary> /// <param name="curve">The curve to drape</param> /// <param name="surface">The type of surface being operated on</param> /// <param name="curveDiscretizationLength">Length of discrete segments</param> public Point2dCollection ProfileOnCurve(Curve curve, SurfaceType surface, double curveDiscretizationLength = 1.0) { Curve planCurve = curve.GetOrthoProjectedCurve(new Plane(Point3d.Origin, Vector3d.ZAxis)); Point3dCollection curvePoints = DrapeCurve(curve, surface, curveDiscretizationLength); Point2dCollection profilePoints = new Point2dCollection(); if (curvePoints.Count > 0) { foreach (Point3d pt in curvePoints) { double dist = planCurve.GetDistAtPoint(planCurve.GetClosestPointTo(pt, true)); profilePoints.Add(new Point2d(dist, pt.Z)); } } return(profilePoints); }
public static void Postfix(ref SurfaceType __result, ref List <SurfaceType> ___allowedSurfaceTypes) { if (__result == SurfaceType.Ceiling) { if (___allowedSurfaceTypes.Contains(SurfaceType.Ceiling)) { __result = SurfaceType.Ceiling; } else if (___allowedSurfaceTypes.Contains(SurfaceType.Ground)) { __result = SurfaceType.Ground; } else if (___allowedSurfaceTypes.Contains(SurfaceType.Wall)) { __result = SurfaceType.Wall; } } }
private Vector3 GetPerfectNormal(SurfaceType surfaceType, Vector3 normal) { if (surfaceType == SurfaceType.Horizontal) { // Collapse the normal to be straight. Vector3 phase1 = Vector3.ProjectOnPlane(normal, Vector3.right).normalized; Vector3 phase2 = Vector3.ProjectOnPlane(phase1, Vector3.forward).normalized; return(phase2); } if (surfaceType == SurfaceType.Vertical) { return(Vector3.ProjectOnPlane(normal, Vector3.up).normalized); } return(Vector3.zero); }
public Area(EventHandler handler, uint version, uint name, byte priority, AreaType areaTypeFlags, IEnumerable <PolygonPoint> closedPolygon, AllowIntersection allowIntersectionFlags, SurfaceType surfaceTypeFlags, SurfaceAttribute surfaceAttributeFlags, byte levelOffset, PolygonPoint lower, PolygonPoint upper) : this(handler, version, name, priority, areaTypeFlags, closedPolygon, allowIntersectionFlags, surfaceTypeFlags, surfaceAttributeFlags, levelOffset, 0, lower, upper) { if (version >= 0x00000007) { throw new InvalidOperationException($"Constructor requires ElevationOffset for version {version}"); } }
private Vector3 GetPerfectNormal(SurfaceType surfaceType, Vector3 normal) { if (surfaceType == SurfaceType.Vertical) { normal.y = 0; return(normal); } if (surfaceType == SurfaceType.Horizontal) { normal.x = 0; normal.z = 0; normal.y = normal.y > 0 ? 1.0f : -1.0f; return(normal); } return(Vector3.zero); }
/// <summary> /// Detects the type of surface the cursor is at. /// </summary> private void OnRaycastResult(MLRaycast.ResultState state, MLRaycastBehavior.Mode mode, Ray ray, RaycastHit hit, float confidence) { if (_firstPlacement == true) { return; } else { _isValid = true; float dot = Vector3.Dot(-Cursor.transform.forward, Vector3.up); //are we oriented like a table/floor or a wall? if (dot > .5f || dot < -.5f) { if (dot < 0) { _type = SurfaceType.Floor; } else if (dot > 0) { _type = SurfaceType.Ceiling; } } else { _type = SurfaceType.Wall; } } if (StatusLabel != null) { StatusLabel.text = "Valid Plane " + _type.ToString(); StatusLabel.color = Color.green; } if (StatusLabel != null) { StatusLabel.text = "Invalid Location"; StatusLabel.color = Color.red; } UpdatePad(); UpdateObject(); }
private List <GameObject> marksList = new List <GameObject>(); // List of existing bullet marks. /// <summary> /// Create a bullet mark based on surface. /// Parameters: The surface type, position, rotation and is it attached to any object (parent)? /// </summary> public void Instantiate(SurfaceType surface, Vector3 pos, Quaternion rot, Transform parent) { GameObject bulletMark = null; // Creates the object that will be our bullet mark. for (int i = 0; i < marks.Length; i++) // Search in the list of surfaces if the given surface has been set. { if (surface == marks[i].surface) { // Instances the particle corresponding to the surface type. bulletMark = Instantiate(GetParticle(marks[i].particles), pos, rot) as GameObject; // If there is any impact sound for the given surface. if (marks[i].sounds.Length > 0) { // Play the surface hit sound at position. audioManager.PlayBulletImpact(marks[i].sounds[Random.Range(0, marks[i].sounds.Length)], 0.8f, pos); } if (marks[i].textures.Length > 0 && bulletMark.GetComponentInChildren <MeshRenderer>() != null) { // Adds a random texture to the bullet mark. bulletMark.GetComponentInChildren <MeshRenderer>().material.mainTexture = marks[i].textures[Random.Range(0, marks[i].textures.Length)]; } } } // Sets a random size for the bullet mark. float size = Random.Range(0.5f, 1.2f); bulletMark.transform.localScale = new Vector3(size, size, size); bulletMark.transform.Rotate(new Vector3(0, Random.Range(-180.0f, 180.0f), 0)); // Sets a random rotation. bulletMark.GetComponent <ParticleSystem>().Play(); // Play the particles of the bullet mark // Attaches the bullet to the object so that they are connected. bulletMark.transform.parent = parent; // Add the current bullet mark to bullet mark list. AddToList(bulletMark); // Destroy after 90 secs Destroy(bulletMark, 90); }
/// <summary> /// Creates a surface from the given points. /// </summary> /// <param name="points">Input points</param> /// <param name="surface">The type of surface being operated on</param> public void SurfaceFromPoints(Point3dCollection points, SurfaceType surface) { TriangleNet.Mesh mesh = new TriangleNet.Mesh(); TriangleNet.Geometry.InputGeometry geometry = new TriangleNet.Geometry.InputGeometry(points.Count); foreach (Point3d point in points) { geometry.AddPoint(point.X, point.Y, 0, point.Z); } mesh.Triangulate(geometry); if (surface == SurfaceType.Original) { originalSurface = mesh; } else { proposedSurface = mesh; } }
/// <summary> /// Returns the contour polylines. /// </summary> /// <param name="surface">The type of surface being operated on</param> /// <param name="interval">Contour interval</param> public IEnumerable <Polyline> ContourMap(SurfaceType surface, double interval) { ElevationLimits(surface, out double zmin, out double zmax); zmin = Math.Ceiling(zmin / interval); zmax = Math.Floor(zmax / interval); int count = (int)((zmax - zmin) / interval); double z = zmin; List <Polyline> contours = new List <Polyline>(); for (int i = 0; i < count; i++) { IEnumerable <Polyline> contoursAtLevel = ContourAt(surface, z); contours.AddRange(contoursAtLevel); z = z + interval; } return(contours); }
/// <summary> /// Returns the volume of the sound based on the player's current state and the surface he is currently on. /// </summary> private float GetVolume(MoveState s) { RaycastHit hitInfo; // Structure used to get information back from a raycast. SurfaceType surface = SurfaceType.Default; // Check the surface below the player. if (Physics.Raycast(transform.position, Vector3.down, out hitInfo, Mathf.Infinity)) { // If the object that the player is on has the component Surface. if (hitInfo.transform.GetComponent <Surface>() != null) { // Take the surface type of the object. surface = hitInfo.collider.GetComponent <Surface>().GetSurface(hitInfo.point, hitInfo.collider.gameObject); } else { // If the object does not have the component, assume that it is a generic surface. surface = SurfaceType.Default; } } // Check whether the surface is set in the list of surfaces. for (int i = 0; i < surfaces.Count; i++) { // If the surface is found, returns its respective sound volume based on the player's current state. if (surface == surfaces[i].surfaceType) { if (s == MoveState.Crouched) { return(surfaces[i].crouchVolume); } else if (s == MoveState.Walking) { return(surfaces[i].walkVolume); } else if (s == MoveState.Running) { return(surfaces[i].runVolume); } } } return(0); }
} // Patch whose coordinate system this surface is using. public Surface(SurfaceType surfaceType, Region region) { SurfaceType = surfaceType; Region = region; GridsPerEdge = 0; OOGridsPerEdge = 0f; PatchesPerEdge = 0; NumberOfPatches = 0; DetailTextureScale = 0f; OriginGlobal = new Vector3Double(0.0, 0.0, 0.0); //STexturep(NULL), //WaterTexturep(NULL), GridsPerPatchEdge = 0; MetersPerGrid = 1.0f; MetersPerEdge = 1.0f; // Surface data SurfaceZ = null; Norm = null; // Patch data PatchList = null; // One of each for each camera VisiblePatchCount = 0; HasZData = false; // "uninitialized" min/max z MinZ = 10000f; MaxZ = -10000f; //WaterObj = NULL; // In here temporarily. SurfacePatchUpdateCount = 0; for (int i = 0; i < 8; i++) { Neighbours[i] = null; } }
public static SurfaceMaterialOptions BuildMaterialOptions(SurfaceType surfaceType, AlphaMode alphaMode, bool twoSided) { SurfaceMaterialOptions materialOptions = new SurfaceMaterialOptions(); if (surfaceType == SurfaceType.Opaque) { materialOptions.srcBlend = SurfaceMaterialOptions.BlendMode.One; materialOptions.dstBlend = SurfaceMaterialOptions.BlendMode.Zero; materialOptions.zTest = SurfaceMaterialOptions.ZTest.LEqual; materialOptions.zWrite = SurfaceMaterialOptions.ZWrite.On; materialOptions.renderQueue = SurfaceMaterialOptions.RenderQueue.Geometry; materialOptions.renderType = SurfaceMaterialOptions.RenderType.Opaque; } else { switch (alphaMode) { case AlphaMode.Alpha: materialOptions.srcBlend = SurfaceMaterialOptions.BlendMode.SrcAlpha; materialOptions.dstBlend = SurfaceMaterialOptions.BlendMode.OneMinusSrcAlpha; materialOptions.zTest = SurfaceMaterialOptions.ZTest.LEqual; materialOptions.zWrite = SurfaceMaterialOptions.ZWrite.Off; materialOptions.renderQueue = SurfaceMaterialOptions.RenderQueue.Transparent; materialOptions.renderType = SurfaceMaterialOptions.RenderType.Transparent; break; case AlphaMode.Additive: materialOptions.srcBlend = SurfaceMaterialOptions.BlendMode.One; materialOptions.dstBlend = SurfaceMaterialOptions.BlendMode.One; materialOptions.zTest = SurfaceMaterialOptions.ZTest.LEqual; materialOptions.zWrite = SurfaceMaterialOptions.ZWrite.Off; materialOptions.renderQueue = SurfaceMaterialOptions.RenderQueue.Transparent; materialOptions.renderType = SurfaceMaterialOptions.RenderType.Transparent; break; // TODO: other blend modes } } materialOptions.cullMode = twoSided ? SurfaceMaterialOptions.CullMode.Off : SurfaceMaterialOptions.CullMode.Back; return(materialOptions); }
private void FixedUpdate() { var contactFilter = new ContactFilter2D(); contactFilter.SetLayerMask(1 << LayerMask.NameToLayer("Tile")); contactFilter.useLayerMask = true; contactFilter.useTriggers = false; float minDistance = float.MaxValue; SurfaceType surface = null; int count = Physics2D.CircleCast(RB.position, 0.32f, Vector2.down, contactFilter, _raycastHitBuffer, 0.1f); for (int i = 0; i < count; i++) { var surf = _raycastHitBuffer[i].GetCurrentSurface(null); if (surf != null) { // get closest surface if (_raycastHitBuffer[i].distance < minDistance) { surface = surf; minDistance = _raycastHitBuffer[i].distance; } } } if (_prevSurface != _currentSurface) { _prevSurface = _currentSurface; } _currentSurface = surface; // DEBUG colors /* * if (_currentSurface == null) * HamsterSprite.color = Color.black; * else * HamsterSprite.color = _currentSurface.DebugSurfaceColor; */ }
public static void AddBlendingStatesShaderProperties( PropertyCollector collector, SurfaceType surface, BlendMode blend, int sortingPriority, bool alphaToMask, bool zWrite, TransparentCullMode transparentCullMode, CompareFunction zTest, bool backThenFrontRendering, bool fogOnTransparent) { collector.AddFloatProperty("_SurfaceType", (int)surface); collector.AddFloatProperty("_BlendMode", (int)blend); // All these properties values will be patched with the material keyword update collector.AddFloatProperty("_SrcBlend", 1.0f); collector.AddFloatProperty("_DstBlend", 0.0f); collector.AddFloatProperty("_AlphaSrcBlend", 1.0f); collector.AddFloatProperty("_AlphaDstBlend", 0.0f); collector.AddToggleProperty("_AlphaToMask", alphaToMask); collector.AddToggleProperty(kZWrite, (surface == SurfaceType.Transparent) ? zWrite : true); collector.AddToggleProperty(kTransparentZWrite, zWrite); collector.AddFloatProperty("_CullMode", (int)CullMode.Back); collector.AddIntProperty(kTransparentSortPriority, sortingPriority); collector.AddToggleProperty(kEnableFogOnTransparent, fogOnTransparent); collector.AddFloatProperty("_CullModeForward", (int)CullMode.Back); collector.AddShaderProperty(new Vector1ShaderProperty { overrideReferenceName = kTransparentCullMode, floatType = FloatType.Enum, value = (int)transparentCullMode, enumNames = { "Front", "Back" }, enumValues = { (int)TransparentCullMode.Front, (int)TransparentCullMode.Back }, hidden = true, }); // Add ZTest properties: collector.AddIntProperty("_ZTestDepthEqualForOpaque", (int)CompareFunction.LessEqual); collector.AddShaderProperty(new Vector1ShaderProperty { overrideReferenceName = kZTestTransparent, floatType = FloatType.Enum, value = (int)zTest, enumType = EnumType.CSharpEnum, cSharpEnumType = typeof(CompareFunction), hidden = true, }); collector.AddToggleProperty(kTransparentBackfaceEnable, backThenFrontRendering); }
SurfaceFormat ToXnaSurfaceFormat(SurfaceType format) { switch (format) { case SurfaceType.A8R8G8B8: return SurfaceFormat.Color; case SurfaceType.R16F: return SurfaceFormat.HalfSingle; case SurfaceType.A16B16G16R16F: return SurfaceFormat.HalfVector4; case SurfaceType.R32F: return SurfaceFormat.Single; case SurfaceType.A32B32G32R32F: return SurfaceFormat.Vector4; default: break; } throw new NotImplementedException(); }
public void AddRenderTarget(int index, int width, int height, SurfaceType colorFormat, bool depthEnable, bool stencilEnable) { var depthFormat = DepthFormat.None; if (stencilEnable) { depthFormat = DepthFormat.Depth24Stencil8; } else if (depthEnable) { depthFormat = DepthFormat.Depth24; } RenderTargetDic[index] = new RenderTarget2D( GraphicsDevice, width, height, false, ToXnaSurfaceFormat(colorFormat), depthFormat, 1, RenderTargetUsage.PreserveContents); // 深度バッファを保存するため }
public GameMap(string mapFile, int startDoor) { this.skyColor = Color.Black; this.flashColor = Color.Yellow; this.fadeChange = 0.1f; this.flashDelay = new CountDown(2, true); this.editorPoint = new Point(0, 0); this.dragOffset = new Point(0, 0); this.curTexture = new Point(1, 0); this.selectionStart = new Point(0, 0); this.screenPos = new PointF(0f, 0f); this.drawObjects = true; this.liquidSurface = SurfaceType.WaterSurface; this.nextMap = ""; this.gameOverTimer = -1; if (this.SetupScene(mapFile)) { foreach (Door door in this.doors) { if (door.ID == startDoor) { GameEngine.Game.GetPlayerStats().PlayerEntry = new PointF(door.Location.X + 16f, door.Location.Y + 64f); if (door.TypeOfDoor == DoorType.ExitOnly) { GameEngine.Framework.PlaySound(SoundEffects.OpenDoor); this.state = SceneState.DoorOut; this.currentDoor = door; } if ((door.TypeOfDoor == DoorType.PlayerStart) && (door.DestinationDoor > 0)) { ((PlayerBehavior) this.player.ObjectBehavior).Boost(); } } } this.SetScreenPos(); this.tileMap.DetermineVisibleTiles(this.screenPos); } }
public override int MovementCostOn(SurfaceType Surface) { switch (Surface) { case SurfaceType.Sea: return 1; default: return -1; } }
public bool LoadMap(string filename, bool loadTiles, bool loadObjects) { this.mapFilename = filename.Substring(filename.LastIndexOf('\\') + 1); if (GameEngine.Framework.UsingExternalMaps) { filename = GameEngine.Framework.GetMapFolder() + this.mapFilename; } else { filename = "Maps." + filename.ToLower(); } string tileSet = ""; this.yOffset = 0; this.alternatePalette = false; int fromIndex = 0; string[] lines = GameEngine.ReadTextFile(filename, !GameEngine.Framework.UsingExternalMaps, !GameEngine.Framework.UsingExternalMaps); if (lines == null) { return false; } if (loadObjects) { this.objects.Clear(); this.gameObjects.Clear(); this.doors.Clear(); this.objects.Add(this.player); this.gameObjects.Add(this.player); } GameEngine.Game.BaseDifficulty = 1; string[] strArray2 = GameEngine.GetSaveFileSegment(lines, "LEVELDATA", 0); foreach (string str2 in strArray2) { string[] strArray3 = str2.Split(new char[] { '=' }); switch (strArray3[0]) { case "alternatePalette": this.alternatePalette = bool.Parse(strArray3[1]); goto Label_0357; case "tileset": tileSet = strArray3[1]; if (!this.alternatePalette) { goto Label_024E; } if (this.mapFilename.IndexOf("SKYDUNGEON") != 0) { break; } this.tileTexture = new GameTexture(tileSet + ".bmp", TileSize, ColorSwaps.SkyNormal, ColorSwaps.SkyAlternate, TextureDisposePolicy.DisposeOnTileChange); goto Label_0357; case "music": this.song = Utility.ParseSongString(strArray3[1]); GameEngine.Framework.PlayMusic(this.song); goto Label_0357; case "skycolor": { string[] strArray4 = strArray3[1].Split(new char[] { ',' }); base.BackColor = Color.FromArgb(0xff, int.Parse(strArray4[0]), int.Parse(strArray4[1]), int.Parse(strArray4[2])); this.skyColor = base.BackColor; goto Label_0357; } case "liquid": if (!strArray3[1].Equals(SurfaceType.LavaSurface.ToString())) { goto Label_0306; } this.liquidSurface = SurfaceType.LavaSurface; goto Label_0357; case "tremor": this.castleTremor = bool.Parse(strArray3[1]); if (this.castleTremor) { this.flashColor = Color.Red; } goto Label_0357; case "mapdifficulty": GameEngine.Game.BaseDifficulty = int.Parse(strArray3[1]); goto Label_0357; case "yoffset": this.yOffset = int.Parse(strArray3[1]); goto Label_0357; default: goto Label_0357; } this.tileTexture = new GameTexture(tileSet + ".bmp", TileSize, ColorSwaps.CaveNormal, ColorSwaps.CaveAlternate, TextureDisposePolicy.DisposeOnTileChange); goto Label_0357; Label_024E: this.tileTexture = new GameTexture(tileSet + ".bmp", TileSize, TextureDisposePolicy.DisposeOnTileChange); goto Label_0357; Label_0306: this.liquidSurface = SurfaceType.WaterSurface; Label_0357:; } if (loadTiles) { fromIndex += strArray2.Length; string[] strArray5 = GameEngine.GetSaveFileSegment(lines, "MAP", fromIndex); fromIndex += strArray5.Length; string[] strArray6 = GameEngine.GetSaveFileSegment(lines, "MAP", fromIndex); fromIndex += strArray6.Length; string[] foredata = GameEngine.GetSaveFileSegment(lines, "MAP", fromIndex); this.tileMap = new TileMap(this.tileTexture, strArray5, strArray6, foredata); } if (loadObjects) { string[] strArray9 = GameEngine.GetSaveFileSegment(lines, "OBJECTS", 0)[1].Split(new char[] { ';' }); for (int i = 0; i < strArray9.Length; i++) { string[] strArray10 = strArray9[i].Split(new char[] { ' ' }); if (strArray10.Length > 1) { if (strArray10[0].Equals("Door")) { Door item = new Door(int.Parse(strArray10[2]), Utility.ParseDoorTypeString(strArray10[5]), this.mapFilename); Point point = Utility.ParsePointString(strArray10[1]); item.Location = new PointF((float) point.X, (float) point.Y); item.DestinationDoor = int.Parse(strArray10[3]); item.DestinationMap = strArray10[4]; item.ObjClass = ObjectClass.Door; if (strArray10.Length > 6) { item.IsWaterTransition = bool.Parse(strArray10[6]); } if (strArray10.Length > 7) { item.Flipped = bool.Parse(strArray10[7]); } this.objects.Insert(0, item); this.doors.Add(item); } else if (strArray10[0].Equals("PrizeBlock")) { string str3 = ""; if (strArray10.Length > 2) { str3 = strArray10[2]; } DragonTrap.PrizeBlock block = new DragonTrap.PrizeBlock(str3, this.mapFilename); Point point2 = Utility.ParsePointString(strArray10[1]); block.Location = new PointF((float) point2.X, (float) point2.Y); this.objects.Add(block); } else if (strArray10[0].Equals("FallingBlock")) { FallingBlockTrigger playerOn = FallingBlockTrigger.PlayerOn; if (strArray10[3].Equals("PlayerNear")) { playerOn = FallingBlockTrigger.PlayerNear; } if (strArray10[3].Equals("PlayerHit")) { playerOn = FallingBlockTrigger.PlayerHit; } if (strArray10[3].Equals("PlayerOn")) { playerOn = FallingBlockTrigger.PlayerOn; } FallingBlock block2 = new FallingBlock(this.mapFilename, playerOn, int.Parse(strArray10[2])); Point point3 = Utility.ParsePointString(strArray10[1]); block2.Location = new PointF((float) (point3.X * 0x10), (float) (point3.Y * 0x10)); this.objects.Add(block2); } else if (strArray10[0].Equals("Treasure")) { Point point4 = Utility.ParsePointString(strArray10[1]); PointF tf = new PointF((float) point4.X, (float) point4.Y); Direction left = Direction.Left; if (strArray10.Length > 4) { left = Utility.ParseDirectionString(strArray10[4]); } TreasureChest chest = new TreasureChest(int.Parse(strArray10[2]), strArray10[3].Split(new char[] { ':' }), this.mapFilename, left) { Location = tf }; this.objects.Add(chest); } else if (strArray10[0].Equals("Generator")) { Point point5 = Utility.ParsePointString(strArray10[1]); PointF tf2 = new PointF((float) point5.X, (float) point5.Y); EnemyGenerator generator = new EnemyGenerator(Utility.ParseObjectTypeString(strArray10[2]), Utility.ParseColorSwapString(strArray10[3]), int.Parse(strArray10[4])) { Location = tf2 }; this.objects.Add(generator); } else if (strArray10[0].Equals("ExplosionGenerator")) { Point point6 = Utility.ParsePointString(strArray10[1]); PointF tf3 = new PointF((float) point6.X, (float) point6.Y); ExplosionPoint point7 = new ExplosionPoint(100, 10) { Location = tf3 }; this.objects.Add(point7); } else { ObjectType t = Utility.ParseObjectTypeString(strArray10[0]); ColorSwaps normal = ColorSwaps.Normal; int delay = 0; if (strArray10.Length > 2) { normal = Utility.ParseColorSwapString(strArray10[2]); } if (strArray10.Length > 5) { delay = int.Parse(strArray10[5]); } GameObject obj2 = ObjectFactory.CreateObjectOfType(t, normal, Utility.ParseDirectionString(strArray10[3]), strArray10[4], delay); Point point8 = Utility.ParsePointString(strArray10[1]); obj2.Location = new PointF((float) point8.X, (float) point8.Y); this.objects.Add(obj2); this.gameObjects.Add(obj2); } } } } this.InitSpecialTiles(tileSet); if (!this.castleTremor) { if (this.mapFilename.ToUpper().Equals("SKYFALL.TXT")) { this.tileMap.ScrollBackground = true; this.castleTremor = true; this.flashColor = Color.Black; this.skyColor = Color.Black; } else { this.castleTremor = false; this.tileMap.ScrollBackground = false; } } return true; }
public void HandleOnLedge(SurfaceType surfacetype, RectangleF block, Corner corner) { }
public void SetSurface(SurfaceType surface) { _currentIndices = _stepIndices[surface]; _currentIndex = Random.Range(0, _currentIndices.Count); _currentClips = GetSurfaceList(surface); }
public void Paint(int trackPos, RoadBrush road, AboveBrush above, SceneryBrush left, SceneryBrush right) { switch (road) { case RoadBrush.Road: Offset = new Vector3(0f, 0f, 0f); Size = new Vector2(1f, 0.05f); TextureName = "road-normal"; TrackSurface = SurfaceType.Road; if (trackPos % 2 == 0) Tint = Color.DarkGray.ToVector3(); else Tint = Color.White.ToVector3(); break; case RoadBrush.Wood: Offset = new Vector3(0f, 0f, 0f); Size = new Vector2(1f, 0.05f); TextureName = "road-wood"; TrackSurface = SurfaceType.Road; if (trackPos % 2 == 0) Tint = Color.DarkGray.ToVector3(); else Tint = Color.White.ToVector3(); break; case RoadBrush.Crossroad: Offset = new Vector3(0f, 0f, 0f); Size = new Vector2(1f, 0.05f); TextureName = "crossroad"; TrackSurface = SurfaceType.Road; //if (trackPos % 2 == 0) Tint = Color.DarkGray.ToVector3(); Tint = Color.White.ToVector3(); break; } Vector3 leftV = Vector3.Cross(Normal, Vector3.Up); Vector3 rightV = -Vector3.Cross(Normal, Vector3.Up); switch (above) { case AboveBrush.Tunnel: AboveOffset = new Vector3(0f,0.45f,0f); AboveSize = new Vector2(3f, 1f); AboveTextureName = "tunnel"; if (trackPos % 4 == 0) AboveTint = Color.DarkGray.ToVector3(); else AboveTint = Color.White.ToVector3(); break; case AboveBrush.TunnelUpper: AboveOffset = new Vector3(0f, 1.25f, 0f); AboveSize = new Vector2(1f, 0.5f); AboveTextureName = "tunnel-upper"; if (trackPos % 4 == 0) AboveTint = Color.DarkGray.ToVector3(); else AboveTint = Color.White.ToVector3(); break; case AboveBrush.StartGrid: if (trackPos % 10 == 0) { AboveOffset = new Vector3(0f, 0.45f, 0f); AboveSize = new Vector2(1.5f, 1f); AboveTextureName = "start"; AboveTint = Color.White.ToVector3(); } break; case AboveBrush.Erase: AboveTextureName = ""; break; } switch (left) { case SceneryBrush.Trees: if (trackPos % 10 == 0) { LeftOffset = (leftV * 1f) + (leftV * new Vector3(((float)randomNumber.NextDouble()*3f), 0f, 0f)) + new Vector3(0f, (-Position.Y) +0.4f, 0f); LeftSize = new Vector2(0.5f, 1f); LeftTextureName = "tree"; LeftScenery = SceneryType.Offroad; LeftTint = Color.White.ToVector3(); } break; case SceneryBrush.LampPost: if (trackPos % 10 == 0) { LeftOffset = (leftV * 1f) + new Vector3(0f, (-Position.Y) + 0.4f, 0f); LeftSize = new Vector2(0.5f, 1f); LeftTextureName = "lamppost-left"; LeftScenery = SceneryType.Offroad; LeftTint = Color.White.ToVector3(); } break; case SceneryBrush.SignLeft: case SceneryBrush.SignRight: if (trackPos % 20 == 0) { LeftOffset = (leftV * 1f) + new Vector3(0f, (-Position.Y) + 0.4f, 0f); LeftSize = new Vector2(0.5f, 1f); LeftTextureName = left==SceneryBrush.SignLeft?"sign-left":"sign-right"; LeftScenery = SceneryType.Wall; LeftTint = Color.White.ToVector3(); } break; case SceneryBrush.Girders: if (trackPos % 20 == 0) { LeftSize = new Vector2(0.25f, Position.Y + 1f); LeftOffset = (leftV * 0.625f) + new Vector3(0f, (-Position.Y) + ((LeftSize.Y / 2)-0.1f), 0f); LeftTextureName = "girder"; LeftScenery = SceneryType.Wall; LeftTint = Color.White.ToVector3(); } break; case SceneryBrush.UpperWall: LeftOffset = (leftV * 1f) + new Vector3(0f, 0f, 0f); LeftSize = new Vector2(1f, 3f); LeftTextureName = "wall"; LeftScenery = SceneryType.Wall; if (trackPos % 4 == 0) LeftTint = Color.DarkGray.ToVector3(); else LeftTint = Color.White.ToVector3(); break; case SceneryBrush.LowerWall: LeftOffset = new Vector3(0f, -0.8f, 0f); LeftSize = new Vector2(1.1f, 1.5f); LeftTextureName = "wall"; LeftScenery = SceneryType.Wall; if (trackPos % 4 == 0) LeftTint = Color.DarkGray.ToVector3(); else LeftTint = Color.White.ToVector3(); break; case SceneryBrush.Ground: LeftOffset = (leftV * 4f) + new Vector3(0f, (-Position.Y) -3f, 0f); LeftSize = new Vector2(5f, 6f); LeftTextureName = "ground"; LeftScenery = SceneryType.Offroad; LeftTint = Color.White.ToVector3(); break; case SceneryBrush.Building: if (trackPos % 15 == 0) { LeftOffset = (leftV * 1f) + new Vector3(0f, (-Position.Y) + 1.2f, 0f); LeftSize = new Vector2(2.5f, 2.5f); LeftTextureName = "building"; LeftScenery = SceneryType.Offroad; LeftTint = Color.White.ToVector3(); } break; case SceneryBrush.BuildingCorner: if (trackPos % 1 == 0) { LeftOffset = (leftV * 2f) + new Vector3(0f, (-Position.Y) + 1.2f, 0f); LeftSize = new Vector2(2f, 2.5f); LeftTextureName = "buildingcorner"; LeftScenery = SceneryType.Offroad; LeftTint = Color.White.ToVector3(); } break; case SceneryBrush.Crossroad: LeftOffset = (leftV * 3f) + new Vector3(0f, 0f, 0f); LeftSize = new Vector2(5f, 0.05f); LeftTextureName = "crossroad"; LeftScenery = SceneryType.Offroad; if (trackPos % 20 == 0) LeftTint = Color.Red.ToVector3(); else LeftTint = Color.White.ToVector3(); break; case SceneryBrush.Erase: LeftTextureName = ""; break; } switch (right) { case SceneryBrush.Trees: if (trackPos % 10 == 0) { RightOffset = (rightV * 1f) + (rightV * new Vector3(((float)randomNumber.NextDouble() * 3f), 0f, 0f)) + new Vector3(0f, (-Position.Y) +0.4f, 0f); RightSize = new Vector2(0.5f, 1f); RightTextureName = "tree"; RightScenery = SceneryType.Offroad; RightTint = Color.White.ToVector3(); } break; case SceneryBrush.LampPost: if (trackPos % 10 == 0) { RightOffset = (rightV * 1f) + new Vector3(0f, (-Position.Y) + 0.4f, 0f); RightSize = new Vector2(0.5f, 1f); RightTextureName = "lamppost-right"; RightScenery = SceneryType.Offroad; RightTint = Color.White.ToVector3(); } break; case SceneryBrush.SignLeft: case SceneryBrush.SignRight: if (trackPos % 20 == 0) { RightOffset = (rightV * 1f) + new Vector3(0f, (-Position.Y) + 0.4f, 0f); RightSize = new Vector2(0.5f, 1f); RightTextureName = right == SceneryBrush.SignLeft ? "sign-left" : "sign-right"; RightScenery = SceneryType.Wall; RightTint = Color.White.ToVector3(); } break; case SceneryBrush.Girders: if (trackPos % 20 == 0) { RightSize = new Vector2(0.25f, Position.Y+1f); RightOffset = (rightV * 0.625f) + new Vector3(0f, (-Position.Y) + ((RightSize.Y / 2)-0.1f), 0f); RightTextureName = "girder"; RightScenery = SceneryType.Wall; RightTint = Color.White.ToVector3(); } break; case SceneryBrush.UpperWall: RightOffset = (rightV * 1f) + new Vector3(0f, 0f, 0f); RightSize = new Vector2(1f, 3f); RightTextureName = "wall"; RightScenery = SceneryType.Wall; if (trackPos % 4 == 0) RightTint = Color.DarkGray.ToVector3(); else RightTint = Color.White.ToVector3(); break; case SceneryBrush.LowerWall: RightOffset = new Vector3(0f, -0.8f, 0f); RightSize = new Vector2(1.1f, 1.5f); RightTextureName = "wall"; RightScenery = SceneryType.Wall; if (trackPos % 4 == 0) RightTint = Color.DarkGray.ToVector3(); else RightTint = Color.White.ToVector3(); break; case SceneryBrush.Ground: RightOffset = (rightV * 4f) + new Vector3(0f, (-Position.Y) -3f, 0f); RightSize = new Vector2(4f, 6f); RightTextureName = "ground"; RightScenery = SceneryType.Offroad; RightTint = Color.White.ToVector3(); break; case SceneryBrush.Building: if (trackPos % 20 == 0) { RightOffset = (rightV * 1f) + new Vector3(0f, (-Position.Y) + 1.2f, 0f); RightSize = new Vector2(2.5f, 2.5f); RightTextureName = "building"; RightScenery = SceneryType.Offroad; RightTint = Color.White.ToVector3(); } break; case SceneryBrush.BuildingCorner: if (trackPos % 1 == 0) { RightOffset = (rightV * 2f) + new Vector3(0f, (-Position.Y) + 1.2f, 0f); RightSize = new Vector2(2f, 2.5f); RightTextureName = "buildingcorner"; RightScenery = SceneryType.Offroad; RightTint = Color.White.ToVector3(); } break; case SceneryBrush.Crossroad: RightOffset = (rightV * 3f) + new Vector3(0f, 0f, 0f); RightSize = new Vector2(5f, 0.05f); RightTextureName = "crossroad"; RightScenery = SceneryType.Offroad; if (trackPos % 20 == 0) RightTint = Color.Red.ToVector3(); else RightTint = Color.White.ToVector3(); break; case SceneryBrush.Erase: RightTextureName = ""; break; } }
public void HandleHitSurface(SurfaceType surfaceType, RectangleF block, Direction side) { }
public abstract int MovementCostOn(SurfaceType Surface);
public StandingsItem() { driver = new DriverInfo(); laps = new List<LapInfo>(); fastestlap = 0; lapsled = 0; classlapsled = 0; surface = SurfaceType.NotInWorld; trackpct = 0; prevtrackpct = 0; speed = 0; prevspeed = 0; position = 0; currentlap = new LapInfo(); sector = 0; sectorbegin = 0; pitstops = 0; pitstoptime = 0; pitstorbegin = DateTime.MinValue; begin = 0; finished = false; offtracksince = 0; positionlive = 0; }
public void SetSurface(int type) { surfaceType = (SurfaceType)type; Reset(); }
public GameMap(string mapFile, Direction enterDir, float position) { this.skyColor = Color.Black; this.flashColor = Color.Yellow; this.fadeChange = 0.1f; this.flashDelay = new CountDown(2, true); this.editorPoint = new Point(0, 0); this.dragOffset = new Point(0, 0); this.curTexture = new Point(1, 0); this.selectionStart = new Point(0, 0); this.screenPos = new PointF(0f, 0f); this.drawObjects = true; this.liquidSurface = SurfaceType.WaterSurface; this.nextMap = ""; this.gameOverTimer = -1; PointF playerEntry = GameEngine.Game.GetPlayerStats().PlayerEntry; int num = 0x20; this.SetupScene(mapFile); switch (enterDir) { case Direction.Left: playerEntry.Y = position; playerEntry.X = num; break; case Direction.Right: playerEntry.Y = position; playerEntry.X = (this.tileMap.MapSize.Width * TileSize.Width) - num; break; case Direction.Up: playerEntry.X = position; playerEntry.Y = num; break; case Direction.Down: playerEntry.X = position; playerEntry.Y = (this.tileMap.MapSize.Height * TileSize.Height) - num; break; default: playerEntry.X = -1f; playerEntry.Y = -1f; break; } this.SetScreenPos(); this.tileMap.DetermineVisibleTiles(this.screenPos); GameEngine.Game.GetPlayerStats().PlayerEntry = new PointF(playerEntry.X, playerEntry.Y); }
public void SetLiquid(SurfaceType surface) { this.liquidSurface = surface; }
public void HandleHitSurface(SurfaceType surfaceType, RectangleF block, Direction side) { if (this.destroyOnHitBackground && (((this.thisObject.YSpeed.CurrentSpeed != 0f) || (side == Direction.Left)) || (side == Direction.Right))) { this.duration = 0; } if (this.thisObject.Type == ObjectType.SmogFireball2) { this.thisObject.YSpeed.SetSpeed((float) 0f); } else if ((this.thisObject.Type == ObjectType.SmogFireball3) && !this.thisObject.IsOnGround) { float num = 3f; if (this.thisObject.X > GameEngine.Game.GetPlayer().X) { num = -3f; } this.thisObject.Solid = true; this.thisObject.XSpeed.Acceleration = 0.2f; this.thisObject.XSpeed.TargetSpeed = num; } else if ((this.thisObject.Type == ObjectType.ZombieBreath) && (this.thisObject.YSpeed.CurrentSpeed > 0f)) { this.thisObject.YSpeed.SetSpeed((float) 0f); } else if (this.thisObject.Type == ObjectType.PirateHook) { this.DoBounce(Math.Abs(this.thisObject.XSpeed.CurrentSpeed) + 1f); } else if (this.thisObject.Type == ObjectType.BouncingBullet) { if (this.thisObject.YSpeed.CurrentSpeed >= 0f) { if (this.thisObject.XSpeed.CurrentSpeed == 0f) { if (Utility.RandomInt(1, 2) == 1) { this.thisObject.CurrentDirection = Direction.Left; } else { this.thisObject.CurrentDirection = Direction.Right; } this.thisObject.XSpeed.Acceleration = 0.5f; this.DoBounce((float) Utility.RandomInt(1, 2)); } else if (Math.Abs(this.thisObject.XSpeed.CurrentSpeed) == 1f) { this.DoBounce(0.5f); this.thisObject.Solid = false; } else if (this.thisObject.XSpeed.CurrentSpeed > 1f) { Speed xSpeed = this.thisObject.XSpeed; xSpeed.CurrentSpeed--; } else if (this.thisObject.XSpeed.CurrentSpeed < -1f) { Speed speed2 = this.thisObject.XSpeed; speed2.CurrentSpeed++; } } } else if (this.thisObject.Type == ObjectType.MechaFireball2) { this.thisObject.YSpeed.SetSpeed((float) 0f); } else if ((this.thisObject.Type == ObjectType.ExplodingFireball) && (this.duration > 0)) { this.duration = 0; for (int i = 0; i < 10; i++) { new Shoot(ObjectType.BouncingBullet, ObjectFactory.GetEnemyBulletDamage(10, 2), (float) Utility.RandomInt(-3, 3), (float) Utility.RandomInt(-6, -3), 0.5f, 1, false).DoAction(this.thisObject); } } }
public override int MovementCostOn(SurfaceType Surface) { switch (Surface) { case SurfaceType.Swamp: return 3; case SurfaceType.Road: return 1; case SurfaceType.Ground: return 2; case SurfaceType.Hedge: return 2; case SurfaceType.Forest: return 3; case SurfaceType.Hill: return 3; default: return -1; } }
public override int MovementCostOn(SurfaceType Surface) { switch (Surface) { case SurfaceType.Road: return 1; case SurfaceType.Ground: return 2; case SurfaceType.Forest: return 5; default: return -1; } }
public override int MovementCostOn(SurfaceType Surface) { return 1; }