//初始化DebugSprite数组 public void CreateDebugSprites() { if (dbSprites != null) { for (int index = 0; index < 1; ++index) { dbSprites[index].RemoveFromRoom(); } } if (!tentacle.debugViz) { return; } dbSprites = new DebugSprite[3]; dbSprites[0] = new DebugSprite(pos, new FSprite("Circle20", true), tentacle.room); dbSprites[0].sprite.scale = 0.5f; dbSprites[0].sprite.alpha = 1f; dbSprites[1] = new DebugSprite(pos, new FSprite("pixel", true), tentacle.room); dbSprites[1].sprite.color = new Color(1f, 0.0f, 1f); dbSprites[1].sprite.alpha = 0.3f; dbSprites[1].sprite.anchorY = 0.0f; dbSprites[2] = new DebugSprite(pos, new FSprite("pixel", true), tentacle.room); dbSprites[2].sprite.alpha = 1f; dbSprites[2].sprite.anchorY = 0.0f; dbSprites[2].sprite.scaleX = 2f; for (int index = 0; index < 3; ++index) { tentacle.room.AddObject(dbSprites[index]); } }
void Start() { //Vector2 destiny = Camera.main.ScreenToWorldPoint(Input.mousePosition); DebugSprite start = GetComponentInParent <DebugSprite>(); //curHook = Instantiate(hook, transform.position, Quaternion.identity); //curHook.GetComponent<Rope2D>().destiny = start.transform.position; }
public RopeDebugVisualizer(Rope rope) { this.rope = rope; mainDebugSprite = new DebugSprite(rope.A, new FSprite("pixel", true), rope.room); mainDebugSprite.sprite.anchorY = 0.0f; mainDebugSprite.sprite.color = new Color(0.0f, 1f, 0.1f); mainDebugSprite.sprite.scaleX = 3f; mainDebugSprite.sprite.alpha = 0.5f; rope.room.AddObject(mainDebugSprite); sprts = new List <DebugSprite>(); }
public override void NewRoom(Room room) { base.NewRoom(room); if (debugViz) { if (grabGoalSprites != null) { grabGoalSprites[0].RemoveFromRoom(); grabGoalSprites[1].RemoveFromRoom(); } grabGoalSprites = new DebugSprite[2]; grabGoalSprites[0] = new DebugSprite(new Vector2(0f, 0f), new FSprite("pixel", true), room); grabGoalSprites[0].sprite.scale = 10f; grabGoalSprites[0].sprite.color = new Color(1f, 0f, 0f); room.AddObject(grabGoalSprites[0]); grabGoalSprites[1] = new DebugSprite(new Vector2(0f, 0f), new FSprite("pixel", true), room); grabGoalSprites[1].sprite.scale = 10f; grabGoalSprites[1].sprite.color = new Color(0f, 5f, 0f); room.AddObject(grabGoalSprites[1]); } IntVector2 tilePosition = room.GetTilePosition(FloatBase + new Vector2(0f, -400f) + tentacleDir * 100f); IntVector2?intVector = SharedPhysics.RayTraceTilesForTerrainReturnFirstSolid(room, BasePos, tilePosition); if (intVector != null) { Vector2 newGrabDest = Custom.RestrictInRect(FloatBase, room.TileRect(intVector.Value).Grow(2f)); segments = SharedPhysics.RayTracedTilesArray(FloatBase, room.MiddleOfTile(intVector.Value)); if (segments.Count > 2) { segments.RemoveAt(segments.Count - 1); } MoveGrabDest(newGrabDest); for (int i = 0; i < tChunks.Length; i++) { tChunks[i].Reset(); } attachedAtTip = true; smoothedFootingSecurity = 1f; } }
/// <summary> /// Loads the content. /// </summary> protected override void LoadContent() { this.consoleFont = this.Content.Load <SpriteFont>("Content\\LucidaConsole"); // Create Tiled Sprites RectangleF bounds = this.RenderSystem.GetCameraRenderBounds(); this.background = new TiledSprite(this.GameWorld, "Content/floortile", "Content/floortilenormal", null, bounds.Position, Vector2.Zero, bounds.AreaBounds) { RenderScale = new Vector2(0.4f, 0.4f), RenderOptions = SpriteRenderOptions.IsLit }; SimpleSprite test = new SimpleSprite(this.GameWorld, "Content/box", null, false) { Position = new Vector2(8, 7), RenderScale = new Vector2(0.4f, 0.4f), RenderOptions = SpriteRenderOptions.CastsShadows | SpriteRenderOptions.IsLit, SpecularReflectivity = 0, LayerDepth = 1 }; test.Body.BodyType = FarseerPhysics.Dynamics.BodyType.Static; test.Body.CollisionCategories = FarseerPhysics.Dynamics.Category.Cat1; test.Body.Friction = 0; test.Body.Restitution = 1.0f; if (this.IsDebug) { var x = new DebugSprite(this.GameWorld, test); } SimpleSprite test2 = new SimpleSprite(this.GameWorld, "Content/box", null, false) { Position = new Vector2(10, 8), Rotation = -MathHelper.PiOver2, RenderScale = new Vector2(0.4f, 0.4f), RenderOptions = SpriteRenderOptions.CastsShadows | SpriteRenderOptions.IsLit, SpecularReflectivity = 0, LayerDepth = 2 }; test2.Body.BodyType = FarseerPhysics.Dynamics.BodyType.Static; test2.Body.CollisionCategories = FarseerPhysics.Dynamics.Category.Cat1; test2.Body.Friction = 0; test2.Body.Restitution = 1.0f; if (this.IsDebug) { var x = new DebugSprite(this.GameWorld, test2); } SimpleSprite test3 = new SimpleSprite(this.GameWorld, "Content/gear", null, true) { Position = new Vector2(20, 8), Rotation = -MathHelper.PiOver2, RenderScale = new Vector2(0.4f, 0.4f), RenderOptions = SpriteRenderOptions.CastsShadows | SpriteRenderOptions.IsLit, SpecularReflectivity = 0, LayerDepth = 2 }; test3.Body.BodyType = FarseerPhysics.Dynamics.BodyType.Static; test3.Body.CollisionCategories = FarseerPhysics.Dynamics.Category.Cat1; test3.Body.Friction = 0; test3.Body.Restitution = 1.0f; if (this.IsDebug) { var x = new DebugSprite(this.GameWorld, test3); } this.amLight = new AmbientLight(Color.White, 0.02f, true, 1); this.RenderSystem.AddPostProcessEffect(this.amLight); mouseLight = new PointLight(this.GameWorld) { Color = Color.White, Power = 1f, Range = 8, SpecularStrength = 4.75f, CastsShadows = true, MinShadowBlurDistance = .5f, MaxShadowBlurDistance = 1.5f }; lightCount++; if (this.IsDebug) { DebugSimulatedPostProcess y = new DebugSimulatedPostProcess(this.GameWorld, mouseLight); } this.RenderSystem.AddPostProcessEffect(mouseLight); // https://www.youtube.com/watch?v=BExTagcymo0 // George Ellinas - Pulse (George Ellinas Remix) (Free - Creative Commons MP3) // http://creativecommons.org/licenses/by/3.0/ this.song = Content.Load <Song>("Content/George_Ellinas_-_Pulse_(George_Ellinas_remix)_LoopEdit"); MediaPlayer.Volume = 0.1f; MediaPlayer.Play(song); base.LoadContent(); }