public void Draw(SpriteBatch batch) { if (enabled && render) { Main.graphics.GraphicsDevice.SetRenderTarget(swapTarget); Main.graphics.GraphicsDevice.Clear(Color.Transparent); batch.End(); batch.Begin(); batch.Draw(visualGridSprites[focus], Main.screenRect, Color.White); for (int i = 0; i < width; i++) for (int j = 0; j < height; j++) { if (grid[i, j].inhabitants.Count > 0) { batch.Draw(Main.sprites["filledGrid"], new Rectangle((int)(i * gridSize.X), (int)(j * gridSize.Y), (int)gridSize.X, (int)gridSize.Y), (grid[i, j].inhabitants[0] as IDrawableGridAsset).gridColor); } } batch.End(); batch.Begin(); Main.graphics.GraphicsDevice.SetRenderTarget(null); visualGrid = new DrawableAsset<RenderTarget2D>(new Vector2(Main.windowSize.X / 2, Main.windowSize.Y / 2), new Vector2(0, -1), Main.windowSize, swapTarget); visualGrid.Draw(batch); } }
/// <summary> /// Deletes the specified drawable asset from the specified actor and its children. /// </summary> /// <param name="drawableAsset">The drawable asset to delete.</param> /// <param name="actor">The actor.</param> /// <param name="items">Stores items to delete.</param> public static void DeleteFromActors(DrawableAsset drawableAsset, Actor actor, HashSet <ItemForDeletion> items) { if (actor.DrawableAsset == drawableAsset) { items.Add(new ActorDrawableAssetForDeletion(actor) { Type = DeletionType.Remove }); } foreach (Actor child in actor.Children) { DeleteFromActors(drawableAsset, child, items); } }
public override void Activate(InputState input) { AddGestureOption(" - Hold Up Right Arm to Select Right", GestureTests.RightArmUp, OnRight, Main.sprites["confirmGesture"]); AddGestureOption(" - Hold Up Left Arm to Left Right", GestureTests.LeftArmUp, OnLeft, Main.sprites["cancelGesture"]); help = new Text("", gestureOptions[gestureOptions.Count - 1].Position + new Vector2(0, padding * 3), (Main.windowSize.X / 1920.0f) * 2.0f, Color.Goldenrod); armIndicator = new Text("", Main.windowSize * 0.5f, (Main.windowSize.X / 1920.0f) * 3.0f, Color.Lime); Vector2 selectionSize = new Vector2(Main.windowSize.X / 4.0f, Main.windowSize.X / 4.0f); selectionLoader = new DrawableAsset<Animation2D>(Main.windowSize * 0.5f, new Vector2(0, -1), selectionSize, Main.content.Load<Animation2D>("Content\\Images\\load")); if (input.Kinect.IsEnabled()) { input.Kinect.EnableGestureTest(GestureTests.RightArmDown, OnRightDown); input.Kinect.EnableGestureTest(GestureTests.LeftArmDown, OnLeftDown); } base.Activate(input); }
/// <inheritdoc /> protected Actor(SerializationInfo info, StreamingContext ctxt) : base(info, ctxt) { Layer = (Layer)info.GetValue("Layer", typeof(Layer)); _parent = (Actor)info.GetValue("Parent", typeof(Actor)); _children = (ChildrenList)info.GetValue("Children", typeof(ChildrenList)); _position = (Vector2)info.GetValue("Position", typeof(Vector2)); _angle = info.GetSingle("Angle"); _scale = (Vector2)info.GetValue("ScaleFactor", typeof(Vector2)); _type = (ActorType)info.GetValue("ActorType", typeof(ActorType)); _drawableAsset = (DrawableAsset)info.GetValue("DrawableAsset", typeof(DrawableAsset)); _physics = (PhysicsComponent)info.GetValue("Physics", typeof(PhysicsComponent)); _scripting = (ScriptingComponent)info.GetValue("Scripting", typeof(ScriptingComponent)); _shapes = (ObservableList <Shape>)info.GetValue("Shapes", typeof(ObservableList <Shape>)); DrawableAssetVisible = info.GetBoolean("DrawableAssetVisible"); }
public void addAnimation(DrawableAsset asset) { List <AnimatedEffect> addedAnimations = new List <AnimatedEffect>(); switch (asset.type) { case "HIT": addedAnimations.Add(new BloodAnimation(asset.position, content, this)); addedAnimations.Add(new MessageAnimation("HIT_MESSAGE", asset.position, content, this)); break; case "DEATH": addedAnimations.Add(new DeathAnimation(asset.position, content, this)); addedAnimations.Add(new MessageAnimation("DEATH_MESSAGE", asset.position, content, this)); break; } animations.AddRange(addedAnimations); }
private void SetSprite() { miniMapSprite = ToolBox.Instance.Get <AssetManager>().DrawableAssets[openedDoors.X + "" + openedDoors.Y + "" + openedDoors.Z + "" + openedDoors.W]; SetRoomTiles(); }
protected virtual void SetBackground(DrawableAsset<Texture2D> back) { background = back; }
public void SetSelectionSprite(Animation2D selectionSprite) { Vector2 screenDimensions = new Vector2(ScreenManager.GraphicsDevice.Viewport.Width, ScreenManager.GraphicsDevice.Viewport.Height); selectionLoader = new DrawableAsset<Animation2D>(Vector2.Zero, new Vector2(0, -1), new Vector2(screenDimensions.X / 4.0f, screenDimensions.X / 4.0f), selectionSprite); }
public void SetHandCursor(Texture2D cursor) { Vector2 screenDimensions = new Vector2(ScreenManager.GraphicsDevice.Viewport.Width, ScreenManager.GraphicsDevice.Viewport.Height); handCursor = new DrawableAsset<Texture2D>(Vector2.Zero, new Vector2(0, -1), new Vector2(screenDimensions.X / 8.0f, screenDimensions.X / 8.0f), cursor); }