public void AddToLayer(Layer layer) { mLayer = layer; if (layer != null) { if (layer.CameraBelongingTo == null) { mText.CameraToAdjustPixelPerfectTo = SpriteManager.Camera; } else { mText.CameraToAdjustPixelPerfectTo = layer.CameraBelongingTo; } } if (mCircleVisibleRepresentation != null) { ShapeManager.AddToLayer(mCircleVisibleRepresentation, layer); } else { SpriteManager.AddToLayer(mSpriteVisibleRepresentation, layer); } ShapeManager.AddToLayer(mParentLine, layer); ShapeManager.AddToLayer(mParentAttachmentPoint, layer); TextManager.AddToLayer(mText, layer); mText.SetPixelPerfectScale(mLayer); }
private void CreateCollision() { frbCollision = ShapeManager.AddAxisAlignedRectangle(); frbCollision.ScaleX = 4; frbCollision.ScaleY = 4; frbCollision.AttachTo(this, false); }
public override void Transformate() { if (timer <= time) { switch (axis) { case 0: ShapeManager.Get().transform.localScale = new Vector3(Mathf.Lerp(pos1.x, toPos.x, ac.Evaluate(timer / time)), pos1.y, pos1.z); break; case 1: ShapeManager.Get().transform.localScale = new Vector3(pos1.x, Mathf.Lerp(pos1.y, toPos.y, ac.Evaluate(timer / time)), pos1.z); break; case 2: ShapeManager.Get().transform.localScale = new Vector3(pos1.x, pos1.y, Mathf.Lerp(pos1.z, toPos.z, ac.Evaluate(timer / time))); break; } timer += Time.deltaTime; } else { timer = 0.0f; running = false; } }
public void PlaceShape(ShapeManager sm) { if (sm == null) { Debug.Log("huh? shouldn't be null"); return; } sm.Begin(); shapesQueued.Remove(sm); shapesOnMap.Add(sm); lc.AddToScore(10); foreach (ShapeManager[] queue in allQueues) { if (queue[0] == sm) { queue [0] = null; return; } // for(int i = 0; i < 7; i++){ // if(queue[i] == sm){ // queue [i] = null; // return; // } // } } Debug.Log("uhhh"); }
protected override void UnloadContent() { base.UnloadContent(); spriteBatch.Dispose(); ShapeManager.UnloadContent(); }
static void Main(string[] args) { //jackson was here ShapeManager sm = new ShapeManager(); string userinput = ""; Console.WriteLine("Press 1 to create a square"); Console.WriteLine("Press 2 to create a triangle"); Console.WriteLine("Press 9 to close loop"); while (userinput != "9") { if (userinput == "1") { sm.AddShape(new Square(7)); Console.WriteLine("Parameter:" + sm.GetFirstShape().GetPerimeter()); Console.WriteLine("Area:" + sm.GetFirstShape().GetArea()); userinput = ""; } else if (userinput == "2") { sm.AddShape(new Triangle(3, 5, 7)); Console.WriteLine("Parameter:" + sm.GetFirstShape().GetPerimeter()); Console.WriteLine("Area:" + sm.GetFirstShape().GetArea()); userinput = ""; } else { userinput = Console.ReadLine(); } } }
public bool CollideAgainstBounce(Polygon polygon, float thisMass, float otherMass, float elasticity) { #if DEBUG if (thisMass == 0 && otherMass == 0) { throw new ArgumentException("Both masses cannot be 0. For equal masses pick a non-zero value"); } #endif if (CollideAgainstMove(polygon, thisMass, otherMass)) { PositionedObject thisTopParent = this.TopParent; PositionedObject otherTopParent = polygon.TopParent; Vector2 collisionNormal = LastMoveCollisionReposition; if (otherMass == 0) { collisionNormal = new Vector2(-polygon.LastMoveCollisionReposition.X, -polygon.LastMoveCollisionReposition.Y); } ShapeManager.ApplyBounce(thisTopParent, otherTopParent, thisMass, otherMass, elasticity, ref collisionNormal); return(true); } return(false); }
public override void Destroy() { for (var i = circles.Count - 1; i > -1; i--) { ShapeManager.Remove(circles[i]); circles[i] = null; circles.RemoveAt(i); } for (var i = rectangles.Count - 1; i > -1; i--) { ShapeManager.Remove(rectangles[i]); rectangles[i] = null; rectangles.RemoveAt(i); } for (var i = polygons.Count - 1; i > -1; i--) { ShapeManager.Remove(polygons[i]); polygons[i] = null; polygons.RemoveAt(i); } base.Destroy(); }
protected void AddSpritesToLayers(FlatRedBall.Graphics.Layer worldLayer, FlatRedBall.Graphics.Layer darknessLayer, FlatRedBall.Graphics.Layer hudLayer) { if (_AddedToLayers) { darknessLayer.Remove(LightSprite); if (CircleInstance != null) { hudLayer.Remove(CircleInstance); } if (AxisAlignedRectangleInstance != null) { hudLayer.Remove(AxisAlignedRectangleInstance); } } StunParticles.LayerToEmitOn = worldLayer; PoisonedParticles.LayerToEmitOn = worldLayer; FrozenParticles.LayerToEmitOn = worldLayer; SmokeParticles.LayerToEmitOn = worldLayer; HealthBar.MoveToLayer(hudLayer); SpriteManager.AddToLayer(SpriteInstance, worldLayer); SpriteManager.AddToLayer(LightSprite, darknessLayer); SpriteManager.AddToLayer(ShadowSprite, worldLayer); if (CircleInstance != null) { ShapeManager.AddToLayer(CircleInstance, hudLayer); } if (AxisAlignedRectangleInstance != null) { ShapeManager.AddToLayer(AxisAlignedRectangleInstance, hudLayer); } _AddedToLayers = true; }
public SpriteGridBorder(Cursor cursor, Camera camera) { this.cursor = cursor; this.camera = camera; mMainRectangle = Polygon.CreateRectangle(1, 1); ShapeManager.AddPolygon(mMainRectangle); mCornerHandles = new Polygon[4]; mSideHandles = new Polygon[4]; for (int i = 0; i < 4; i++) { mCornerHandles[i] = Polygon.CreateRectangle(.5f, .5f); mCornerHandles[i].Color = System.Drawing.Color.Yellow; ShapeManager.AddPolygon(mCornerHandles[i]); mSideHandles[i] = Polygon.CreateRectangle(.5f, .5f); mSideHandles[i].Color = System.Drawing.Color.Yellow; ShapeManager.AddPolygon(mSideHandles[i]); } Visible = false; }
private void UpdateCornerRectangleCount() { int numberOfEdges = 0; foreach (Polygon polygon in CurrentShapeCollection.Polygons) { // Polygons of 1 point should still draw their point if (polygon.Points.Count == 1) { numberOfEdges++; } else { numberOfEdges += polygon.Points.Count - 1; // assume the last point repeats } } while (mCorners.Count < numberOfEdges) { AxisAlignedRectangle newRectangle = ShapeManager.AddAxisAlignedRectangle(); newRectangle.Color = Color.Red; newRectangle.ScaleX = newRectangle.ScaleY = .3f; mCorners.Add(newRectangle); } while (mCorners.Count > numberOfEdges) { ShapeManager.Remove(mCorners[mCorners.Count - 1]); } }
protected void Start() { previousShape = ShapeSelected; previousColor = ColorSelected; //cash gameManager = GameManager.Instance; playerCharacter = FindObjectOfType <PlayerCharacter> (); shapeManager = ShapeManager.Instance; playerShapes = GameObject.FindWithTag("Player").transform; for (int i = 0; i < shapeRenderers.Length; i++) { //set shape renderers shapeRenderers[i] = gameManager.shapeRenderers[i]; //set rotate parts rotateParts[i] = gameManager.rotateParts[i]; } playerTrail = gameManager.playerTrail.GetComponent <LineRenderer> (); //enable only selected shape SwitchShape(); }
public ReactiveHud() { mObjectOverMarker = Polygon.CreateRectangle(1, 1); mObjectOverMarker.Color = System.Drawing.Color.Red; #region Create mModelOver mModelOverHighlight.Visible = false; ModelManager.AddModel(mModelOverHighlight); ModelManager.AddToLayer(mModelOverHighlight, SpriteManager.Camera.Layer); mModelOverHighlight.ColorOperation = Microsoft.DirectX.Direct3D.TextureOperation.Add; mModelOverHighlight.Red = 90f; mModelOverHighlight.Green = 90f; mModelOverHighlight.Blue = 90f; mSelectedModelHighlight.Visible = false; ModelManager.AddModel(mSelectedModelHighlight); ModelManager.AddToLayer(mSelectedModelHighlight, SpriteManager.Camera.Layer); mSelectedModelHighlight.ColorOperation = Microsoft.DirectX.Direct3D.TextureOperation.Add; mSelectedModelHighlight.Red = 160; mSelectedModelHighlight.Green = 160; mSelectedModelHighlight.Blue = 160; #endregion mSpriteFrameIndividualSpriteOutline = new SpriteFrameIndividualSpriteOutline(); mTextWidthHandles = new TextWidthHandles(); ShapeManager.AddPolygon(mObjectOverMarker); }
public void Destroy() { _backgroundSprite.Detach(); SpriteManager.RemoveSpriteFrame(_backgroundSprite); // Remove all the items from the datagrid var items = _items.Items.ToArray(); for (int x = items.Length - 1; x >= 0; x--) { var item = items[x]; if (item.Parent == _backgroundSprite) { item.Destroy(); } } _items.Clear(); if (_border != null) { ShapeManager.Remove(_border); } }
public static void ClearEngine() { while (ShapeManager.VisibleCircles.Count != 0) { ShapeManager.Remove(ShapeManager.VisibleCircles.Last()); } while (ShapeManager.VisibleRectangles.Count != 0) { ShapeManager.Remove(ShapeManager.VisibleRectangles.Last()); } while (ShapeManager.VisiblePolygons.Count != 0) { ShapeManager.Remove(ShapeManager.VisiblePolygons.Last()); } while (ShapeManager.VisibleLines.Count != 0) { ShapeManager.Remove(ShapeManager.VisibleLines.Last()); } while (SpriteManager.AutomaticallyUpdatedSprites.Count != 0) { SpriteManager.RemoveSprite(SpriteManager.AutomaticallyUpdatedSprites.Last()); } while (TextManager.AutomaticallyUpdatedTexts.Count != 0) { TextManager.RemoveText(TextManager.AutomaticallyUpdatedTexts.Last()); } }
public Hero(string name, HeroClass heroClass) { Collect = false; Online = TimeSpan.Zero; Target = Position; AcceptArrows = true; zLastPosition = Position; Netid = 0; Name = name; Class = heroClass; Position.Z = ZLayer.Npc; WalkingSpeed = 10; SpriteManager.AddPositionedObject(this); Collider = ShapeManager.AddCircle(); Collider.AttachTo(this, false); Collider.Visible = false; Sprite = LoadSprite(); Sprite.AttachTo(this, false); Sprite.Resize(4); Sprite.AnimationSpeed = 0.1f; Label = TextManager.AddText(name, Globals.Font); Label.AttachTo(this, false); Label.HorizontalAlignment = HorizontalAlignment.Center; Label.RelativePosition = new Vector3(0, 4, ZLayer.NpcLabel - Position.Z); InitStats(); }
public void Destroy() { ShapeManager.Remove(frbHeadCircle); ShapeManager.Remove(frbLHandCircle); ShapeManager.Remove(frbLLowerArmPolygon); ShapeManager.Remove(frbLLowerLegPolygon); ShapeManager.Remove(frbLUpperArmPolygon); ShapeManager.Remove(frbLUpperLegPolygon); ShapeManager.Remove(frbRHandCircle); ShapeManager.Remove(frbRLowerArmPolygon); ShapeManager.Remove(frbRLowerLegPolygon); ShapeManager.Remove(frbRUpperArmPolygon); ShapeManager.Remove(frbRUpperLegPolygon); ShapeManager.Remove(frbTorsoPolygon); SpriteManager.RemovePositionedObject(frbHeadCircle); SpriteManager.RemovePositionedObject(frbLHandCircle); SpriteManager.RemovePositionedObject(frbLLowerArmPolygon); SpriteManager.RemovePositionedObject(frbLLowerLegPolygon); SpriteManager.RemovePositionedObject(frbLUpperArmPolygon); SpriteManager.RemovePositionedObject(frbLUpperLegPolygon); SpriteManager.RemovePositionedObject(frbRHandCircle); SpriteManager.RemovePositionedObject(frbRLowerArmPolygon); SpriteManager.RemovePositionedObject(frbRLowerLegPolygon); SpriteManager.RemovePositionedObject(frbRUpperArmPolygon); SpriteManager.RemovePositionedObject(frbRUpperLegPolygon); SpriteManager.RemovePositionedObject(frbTorsoPolygon); }
protected void AddSpritesToLayers(Layer darknessLayer, Layer hudLayer) { _hudLayer = hudLayer; _lightLayer = darknessLayer; #if DEBUG if (DebugVariables.ShowDebugShapes) { LayerProvidedByContainer.Remove(AxisAlignedRectangleInstance); ShapeManager.AddToLayer(AxisAlignedRectangleInstance, hudLayer); } #endif LayerProvidedByContainer.Remove(RangePreviewSprite); SpriteManager.AddToLayer(RangePreviewSprite, hudLayer); LayerProvidedByContainer.Remove(LightSpriteInstance); SpriteManager.AddToLayer(LightSpriteInstance, darknessLayer); LayerProvidedByContainer.Remove(WarpSpriteInstance); SpriteManager.AddToLayer(WarpSpriteInstance, darknessLayer); LayerProvidedByContainer.Remove(LightAimSpriteInstance); SpriteManager.AddToLayer(LightAimSpriteInstance, darknessLayer); var gumLayer = RenderingLibrary.SystemManagers.Default.Renderer.Layers.FirstOrDefault(l => l.Name == "InfoLayerGum"); StructureUpgradeStatusInstance.MoveToFrbLayer(hudLayer, gumLayer); LayerProvidedByContainer.Remove(RangeCircleInstance); ShapeManager.AddToLayer(RangeCircleInstance, hudLayer); }
protected override void Initialize() { this.Window.Title = "spin boi"; GlobalWorld = Matrix.CreateTranslation(Vector3.Zero); GlobalView = Matrix.CreateLookAt(new Vector3(1, 1, 3), Vector3.Zero, Vector3.Up); GlobalProjection = Matrix.CreatePerspectiveFieldOfView( MathHelper.ToRadians(45), _graphics.PreferredBackBufferWidth / _graphics.PreferredBackBufferHeight, 0.01f, 100f); _graphics.PreferMultiSampling = true; for (int row = 0; row < 10; row++) { for (int col = 0; col < 10; col++) { var cube = new Cube(GraphicsDevice, GlobalWorld, GlobalView, GlobalProjection); cube.World *= Matrix.CreateTranslation(new Vector3(row + 0.3f * row, col + 0.3f * col, 0) + new Vector3(-5, -5, -5)); ShapeManager.AddShape(cube); } } base.Initialize(); }
public void ServerActivity() { GotoTarget(); //restore removed mobs if (Removed) { ShapeManager.AddCircle(this); Removed = false; } switch (State) { case MobState.Roaming: ServerRoaming(); break; case MobState.Chasing: ServerChasing(); break; case MobState.Atacking: ServerAttacking(); break; default: break; } }
public bool CollideAgainstBounce(AxisAlignedRectangle rectangle, float thisMass, float otherMass, float elasticity) { #if DEBUG if (thisMass == 0 && otherMass == 0) { throw new ArgumentException("Both masses cannot be 0. For equal masses pick a non-zero value"); } #endif if (CollideAgainstMove(rectangle, thisMass, otherMass)) { if (YVelocity + 103.6 < .01f) { int m = 3; } PositionedObject thisTopParent = this.TopParent; PositionedObject otherTopParent = rectangle.TopParent; Vector2 collisionNormal = LastMoveCollisionReposition; if (otherMass == 0) { collisionNormal = new Vector2(-rectangle.LastMoveCollisionReposition.X, -rectangle.LastMoveCollisionReposition.Y); } ShapeManager.ApplyBounce(thisTopParent, otherTopParent, thisMass, otherMass, elasticity, ref collisionNormal); return(true); } return(false); }
/// <summary> /// Initializes a new instance of the <see cref="ShapeAnimatorForm" /> class. /// Precondition: None /// </summary> public ShapeAnimatorForm() { this.InitializeComponent(); this.canvasManager = new ShapeManager(this.canvasPictureBox); this.enableOrDisableControls(ControlsEnum.Initialize); this.canvasPictureBox.Enabled = false; }
public void AddShape(Object prefab, int queueNum) { GameObject go = GameObject.Instantiate(prefab, StartPos(queueNum), Quaternion.identity) as GameObject; ShapeManager sm = go.GetComponent <ShapeManager> (); sm.SetShape(new Shape(Constants.shape1, 1)); // switch(Randomization.RandomInt(0, 6)){ // case 0: // sm.SetShape (new Shape (Constants.shape1, 1)); // break; // case 1: // sm.SetShape (new Shape(Constants.shape2, 2)); // break; // case 2: // sm.SetShape (new Shape(Constants.shape3, 3)); // break; // case 3: // sm.SetShape (new Shape(Constants.shape4, 4)); // break; // case 4: // sm.SetShape (new Shape(Constants.shape5, 5)); // break; // case 5: // sm.SetShape (new Shape(Constants.shape6, 6)); // break; // } sm.SC = this; shapesQueued.Add(sm); allQueues [queueNum - 1] [6] = sm; }
private void DebugActivity() { if (DebuggingVariables.ShowUnitPaths) { int numberOfLinesNeeded = this.ImmediateGoal?.Path?.Count ?? 0; while (this.pathLines.Count < numberOfLinesNeeded) { var line = new Line(); line.Visible = true; pathLines.Add(line); } while (this.pathLines.Count > numberOfLinesNeeded) { ShapeManager.Remove(pathLines.Last()); } for (int i = 0; i < numberOfLinesNeeded; i++) { Vector3 pointBefore; if (i == 0) { pointBefore = this.Position; } else { pointBefore = ImmediateGoal.Path[i - 1].Position; } Vector3 pointAfter = ImmediateGoal.Path[i].Position; pathLines[i].SetFromAbsoluteEndpoints(pointBefore, pointAfter); } } }
public new void AddSpritesToLayers(Layer darknessLayer, Layer hudLayer) { base.AddSpritesToLayers(darknessLayer, hudLayer); LayerProvidedByContainer.Remove(RangeCircleInstance); ShapeManager.AddToLayer(RangeCircleInstance, hudLayer); }
public TextWidthHandles() { mLeftLine = ShapeManager.AddLine(); mTopSolidLine = ShapeManager.AddLine(); mBottomSolidLine = ShapeManager.AddLine(); mTopSoftLine = ShapeManager.AddLine(); mBottomSoftLine = ShapeManager.AddLine(); mRightLine = ShapeManager.AddLine(); mRightBox = ShapeManager.AddAxisAlignedRectangle(); mLeftLine.Color = Color.Green; mTopSolidLine.Color = Color.Green; mBottomSolidLine.Color = Color.Green; mRightLine.Color = Color.Green; #if FRB_MDX mTopSoftLine.Color = Color.FromArgb( 128, Color.Green); mBottomSoftLine.Color = mTopSoftLine.Color; #else throw new NotImplementedException(); #endif mRightBox.Color = Color.Orange; }
public void AddSpritesToLayers(Layer darknessLayer, Layer hudLayer) { if (LayerProvidedByContainer != null) { if (HasLightSource) { LayerProvidedByContainer.Remove(LightOrShadowSprite); } LayerProvidedByContainer.Remove(CircleInstance); } if (_AddedToLayers) { darknessLayer.Remove(LightOrShadowSprite); hudLayer.Remove(CircleInstance); if (HasLightSource) { darknessLayer.Remove(SpriteInstance); } } if (HasLightSource) { SpriteManager.AddToLayer(SpriteInstance, darknessLayer); } if (HasLightSource) { SpriteManager.AddToLayer(LightOrShadowSprite, darknessLayer); } ShapeManager.AddToLayer(CircleInstance, hudLayer); _AddedToLayers = true; }
public void UpdateFromBoundingFrustum(BoundingFrustum sourceBoundingFrustum) { #region Create the lines if necessary if (mLines.Count == 0) { for (int i = 0; i < NumberOfLines; i++) { Line line = ShapeManager.AddLine(); mLines.Add(line); } } #endregion Vector3[] corners = sourceBoundingFrustum.GetCorners(); mLines[0].SetFromAbsoluteEndpoints(corners[0], corners[1]); mLines[1].SetFromAbsoluteEndpoints(corners[1], corners[2]); mLines[2].SetFromAbsoluteEndpoints(corners[2], corners[3]); mLines[3].SetFromAbsoluteEndpoints(corners[3], corners[0]); mLines[4].SetFromAbsoluteEndpoints(corners[4], corners[5]); mLines[5].SetFromAbsoluteEndpoints(corners[5], corners[6]); mLines[6].SetFromAbsoluteEndpoints(corners[6], corners[7]); mLines[7].SetFromAbsoluteEndpoints(corners[7], corners[4]); mLines[8].SetFromAbsoluteEndpoints(corners[0], corners[4]); mLines[9].SetFromAbsoluteEndpoints(corners[1], corners[5]); mLines[10].SetFromAbsoluteEndpoints(corners[2], corners[6]); mLines[11].SetFromAbsoluteEndpoints(corners[3], corners[7]); sourceBoundingFrustum.Near.ToString(); }
// Generated AddToManagers public virtual void ReAddToManagers(Layer layerToAddTo) { LayerProvidedByContainer = layerToAddTo; SpriteManager.AddPositionedObject(this); ShapeManager.AddToLayer(mCollision, LayerProvidedByContainer); SpriteManager.AddToLayer(Sprite, LayerProvidedByContainer); }
public override void Destroy() { // Generated Destroy base.Destroy(); if (SpriteInstance != null) { SpriteManager.RemoveSprite(SpriteInstance); } if (HandSprite != null) { SpriteManager.RemoveSprite(HandSprite); } if (GunRectangle != null) { ShapeManager.Remove(GunRectangle); } if (FedoraSprite != null) { SpriteManager.RemoveSprite(FedoraSprite); } CustomDestroy(); }