Example #1
0
        public static Text AddText(string displayText, BitmapFont bitmapFont, string contentManagerName)
        {
            Text text = new Text(bitmapFont);

            text.ContentManager = contentManagerName;
            text.DisplayText    = displayText;

            text.AdjustPositionForPixelPerfectDrawing = true;

#if DEBUG
            if (mDrawnTexts.Contains(text))
            {
                throw new InvalidOperationException("Can't add the text to the Drawn Text list because it's already there.  This error is here to prevent you from double-adding Texts.");
            }
            if (mAutomaticallyUpdatedTexts.Contains(text))
            {
                throw new InvalidOperationException("Can't add the text to the Automatically Updated (Managed) Text list because it's already there.  This error is here to prevent you from double-adding Texts.");
            }
#endif

            mDrawnTexts.Add(text);
            mAutomaticallyUpdatedTexts.Add(text);

            text.SetPixelPerfectScale(SpriteManager.Camera);

            return(text);
        }
Example #2
0
        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);
                }
            }
        }
        /// <summary>
        /// Gets a positioned sound
        /// </summary>
        /// <param name="soundName">The name of the sound in the XACT project</param>
        /// <param name="soundBankFile">The name of the sound bank to retrieve the sound from</param>
        /// <returns>A new positioned sound</returns>
        #endregion
        public static PositionedSound GetPositionedSound(String soundName, string soundBankFile)
        {
            PositionedSound newPosSound = new PositionedSound(GetCue(soundName, soundBankFile), soundName, soundBankFile);

            PositionedSounds.Add(newPosSound);
            return(newPosSound);
        }
Example #4
0
        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();
        }
Example #5
0
        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]);
            }
        }
Example #6
0
        internal void Add(Text text)
        {
#if DEBUG
            if (text.mListsBelongingTo.Contains(mTexts))
            {
                throw new InvalidOperationException("This text is already part of this layer.");
            }
#endif
            mTexts.Add(text);
        }
        public void AutoPosition()
        {
            const float depthSpacing = 4;

            for (int i = 0; i < mNodesAsList.Count; i++)
            {
                HierarchyNode node = mNodesAsList[i];

                node.RelativeY = -depthSpacing;

                IAttachable parent = GetParent(node.ObjectRepresenting);

                if (parent == null)
                {
                    node.AttachTo(null, false);
                    node.Y = 5;
                }
                else
                {
                    HierarchyNode parentNode = GetNodeFromAttachable(parent);
                    node.AttachTo(parentNode, false);
                }
            }

            mUnparentedNodes.Clear();

            // Gotta do this after all attachments have been made
            for (int i = 0; i < mNodesAsList.Count; i++)
            {
                HierarchyNode node = mNodesAsList[i];

                if (node.Parent != null)
                {
                    node.SetRelativeX();
                    node.ForceUpdateDependencies();
                }
                else
                {
                    float xToStartAt = 0;

                    if (mUnparentedNodes.Count != 0)
                    {
                        xToStartAt = mUnparentedNodes.Last.X +
                                     mUnparentedNodes.Last.Width / 2.0f;
                    }

                    node.Y = 5;
                    node.X = xToStartAt + node.Width / 2.0f;

                    mUnparentedNodes.Add(node);
                }
            }

            UpdateSelectionMarker();
        }
Example #8
0
        public PositionedObjectList <Circle> ToCircleList()
        {
            PositionedObjectList <Circle> listToReturn = new PositionedObjectList <Circle>();

            foreach (CircleSave circleSave in CircleSaves)
            {
                Circle circle = circleSave.ToCircle();
                listToReturn.Add(circle);
            }

            return(listToReturn);
        }
        public PositionedObjectList <FlatRedBall.Math.Geometry.Polygon> ToPolygonList()
        {
            PositionedObjectList <FlatRedBall.Math.Geometry.Polygon> listToReturn = new PositionedObjectList <FlatRedBall.Math.Geometry.Polygon>();

            foreach (PolygonSave polygonSave in PolygonSaves)
            {
                FlatRedBall.Math.Geometry.Polygon polygon = polygonSave.ToPolygon();
                listToReturn.Add(polygon);
            }

            return(listToReturn);
        }
Example #10
0
        public PositionedObjectList <FlatRedBall.Math.Geometry.AxisAlignedCube> ToAxisAlignedCubeList()
        {
            PositionedObjectList <FlatRedBall.Math.Geometry.AxisAlignedCube> listToReturn = new PositionedObjectList <FlatRedBall.Math.Geometry.AxisAlignedCube>();

            foreach (AxisAlignedCubeSave cubeSave in AxisAlignedCubeSaves)
            {
                FlatRedBall.Math.Geometry.AxisAlignedCube cube = cubeSave.ToAxisAlignedCube();
                listToReturn.Add(cube);
            }

            return(listToReturn);
        }
Example #11
0
        public PositionedObjectList <FlatRedBall.Math.Geometry.AxisAlignedRectangle> ToAxisAlignedRectangleList()
        {
            PositionedObjectList <FlatRedBall.Math.Geometry.AxisAlignedRectangle> listToReturn = new PositionedObjectList <FlatRedBall.Math.Geometry.AxisAlignedRectangle>();

            foreach (AxisAlignedRectangleSave rectangleSave in AxisAlignedRectangleSaves)
            {
                FlatRedBall.Math.Geometry.AxisAlignedRectangle rectangle = rectangleSave.ToAxisAlignedRectangle();
                listToReturn.Add(rectangle);
            }

            return(listToReturn);
        }
Example #12
0
        public PositionedObjectList <Sphere> ToSphereList()
        {
            PositionedObjectList <Sphere> listToReturn = new PositionedObjectList <Sphere>();

            foreach (SphereSave sphereSave in SphereSaves)
            {
                Sphere sphere = sphereSave.ToSphere();
                listToReturn.Add(sphere);
            }

            return(listToReturn);
        }
Example #13
0
            private void SettleVerticalFishingLine()
            {
                lineHasSettled = true;
                var totalX = FishingLineLinesList[0].AbsolutePoint1.X - FishingLineLinesList.Last.AbsolutePoint2.X;
                var totalY = FishingLineLinesList[0].AbsolutePoint1.Y - FishingLineLinesList.Last.AbsolutePoint2.Y;

                double  pointY, relativeY, pointX, newX;
                Point3D point1, point2;

                PositionedObjectList <Line> settledFishingLineLines = new PositionedObjectList <Line>();
                PositionedObjectList <Line> originalLines           = new PositionedObjectList <Line>();
                Line clonedLine;

                for (int i = 0; i < FishingLineLinesList.Count; i++)
                {
                    clonedLine = FishingLineLinesList[i].Clone();
                    originalLines.Add(clonedLine.Clone());

                    if (i == 0)
                    {
                        point1 = clonedLine.AbsolutePoint1;
                    }
                    else
                    {
                        pointY    = FishingLineLinesList[0].AbsolutePoint1.Y - clonedLine.AbsolutePoint1.Y;
                        relativeY = (pointY / totalY) - 1;
                        pointX    = CalculateCatenaryHeight(relativeY);
                        newX      = pointX * totalX;

                        point1 = new Point3D(FishingLineLinesList.Last.AbsolutePoint2.X + newX, clonedLine.AbsolutePoint1.Y);
                    }

                    if (i > 0)
                    {
                        var previousLine = settledFishingLineLines[i - 1];
                        previousLine.SetFromAbsoluteEndpoints(previousLine.AbsolutePoint1, point1);
                    }

                    pointY    = FishingLineLinesList[0].AbsolutePoint1.Y - clonedLine.AbsolutePoint1.Y;
                    relativeY = (pointY / totalY) - 1;
                    pointX    = CalculateCatenaryHeight(relativeY);
                    newX      = pointX * totalX;

                    point2 = new Point3D(FishingLineLinesList.Last.AbsolutePoint2.X + newX, clonedLine.AbsolutePoint2.Y);

                    clonedLine.SetFromAbsoluteEndpoints(point1, point2);

                    settledFishingLineLines.Add(clonedLine);
                }

                TweenAllLines(originalLines, settledFishingLineLines, 2f, () => { lineIsSettling = false; lineHasSettled = true; });
            }
Example #14
0
 public static void IgnorePausingFor(FlatRedBall.PositionedObject positionedObject)
 {
     // This function needs to tolerate
     // the same object being added multiple
     // times.  The reason is that an Entity in
     // Glue may set one of its objects to be ignored
     // in pausing, but then the object itself may also
     // be set to be ignored.
     if (!PositionedObjectsIgnoringPausing.Contains(positionedObject))
     {
         PositionedObjectsIgnoringPausing.Add(positionedObject);
     }
 }
Example #15
0
        public DamageCircle AddCircle(Hero heroOwner, Mob mobOwner, TimeSpan lifeSpan,
                                      bool destroyOnHit, MapRoom room)
        {
            DamageCircle c = new DamageCircle(heroOwner, mobOwner, destroyOnHit, NextId++, room);

            Circles.Add(c);
            //remove event
            Globals.EventManager.AddEvent(delegate()
            {
                c.Destroy();
                return(0);
            }, $"removecircle{NextId - 1}", false, lifeSpan, TimeSpan.Zero, TimeSpan.Zero);
            return(c);
        }
Example #16
0
        public void ShowPath(List <PositionedNode> path)
        {
            if (path.Count == 0)
            {
                return;
            }

            Text text;

            for (int i = 0; i < path.Count - 1; i++)
            {
                Line line = new Line();
                line.Visible          = true;
                line.RelativePoint1.X = 0;
                line.RelativePoint1.Y = 0;

                line.Position = path[i].Position;

                line.RelativePoint2.X = path[i + 1].X - line.Position.X;
                line.RelativePoint2.Y = path[i + 1].Y - line.Position.Y;
                line.Color            = Color.Yellow;

                mPath.Add(line);

                text          = TextManager.AddText(path[i].CostToGetHere.ToString());
                text.Position = path[i].Position;
                text.X       += .5f;
                text.Y       += .5f;
                mCosts.Add(text);
            }

            text          = TextManager.AddText(path[path.Count - 1].CostToGetHere.ToString());
            text.Position = path[path.Count - 1].Position;
            text.X       += .5f;
            text.Y       += .5f;
            mCosts.Add(text);
        }
Example #17
0
            public void ReactToTugging()
            {
                TweenerManager.Self.StopAllTweenersOwnedBy(this);
                isReelingIn = true;

                var startX = FishingLineLinesList[0].AbsolutePoint1.X;
                var endX   = FishingLineLinesList.Last.AbsolutePoint2.X;
                var startY = FishingLineLinesList[0].AbsolutePoint1.Y;
                var endY   = FishingLineLinesList.Last.AbsolutePoint2.Y;

                var rise  = endY - startY;
                var run   = endX - startX;
                var slope = rise / run;

                PositionedObjectList <Line> settledFishingLineLines = new PositionedObjectList <Line>();
                PositionedObjectList <Line> originalLines           = new PositionedObjectList <Line>();
                Line    clonedLine;
                Point3D point1, point2;
                double  pointX;

                for (int i = 0; i < FishingLineLinesList.Count; i++)
                {
                    clonedLine = FishingLineLinesList[i].Clone();
                    originalLines.Add(clonedLine.Clone());
                    if (i == 0)
                    {
                        point1 = FishingLineLinesList[0].AbsolutePoint1;
                    }
                    else
                    {
                        point1 = settledFishingLineLines[i - 1].AbsolutePoint2;
                    }
                    if (i == FishingLineLinesList.Count - 1)
                    {
                        point2 = FishingLineLinesList.Last.AbsolutePoint2;
                    }
                    else
                    {
                        pointX = FishingLineLinesList[i].AbsolutePoint2.X;
                        point2 = new Point3D(pointX, startY + (slope * (pointX - startX)));
                    }
                    clonedLine.SetFromAbsoluteEndpoints(point1, point2);
                    settledFishingLineLines.Add(clonedLine);
                }
                TweenAllLines(originalLines, settledFishingLineLines, 0.2f, SwitchToSingleLine, InterpolationType.Linear);
            }
Example #18
0
        public static void CopyCurrentEmitter()
        {
            if (AppState.Self.CurrentEmitter == null)
            {
                return;
            }

            Emitter tempEmitter = AppState.Self.CurrentEmitter.Clone();

            tempEmitter.Name = StringFunctions.IncrementNumberAtEnd(tempEmitter.Name);
            while (Emitters.FindWithNameContaining(tempEmitter.Name) != null)
            {
                tempEmitter.Name = StringFunctions.IncrementNumberAtEnd(tempEmitter.Name);
            }

            Emitters.Add(tempEmitter);
            SpriteManager.AddEmitter(tempEmitter);
        }
Example #19
0
        private void UpdateCornerRectangleCount()
        {
            int numberOfEdges = AppState.Self.CurrentEmitter.EmissionBoundary.Points.Count - 1; // assume the last point repeats

            while (mCurrentEmitterBoundaryCorners.Count < numberOfEdges)
            {
                AxisAlignedRectangle newRectangle = ShapeManager.AddAxisAlignedRectangle();
                newRectangle.Color = Color.Red;

                newRectangle.ScaleX = newRectangle.ScaleY = .3f;

                mCurrentEmitterBoundaryCorners.Add(newRectangle);
            }

            while (mCurrentEmitterBoundaryCorners.Count > numberOfEdges)
            {
                ShapeManager.Remove(mCurrentEmitterBoundaryCorners[mCurrentEmitterBoundaryCorners.Count - 1]);
            }
        }
Example #20
0
        public override void UpdateShapes()
        {
            base.UpdateShapes();


            if (Visible == false)
            {
                while (mOccupiedTileCircles.Count != 0)
                {
                    ShapeManager.Remove(mOccupiedTileCircles[mOccupiedTileCircles.Count - 1]);
                }
            }
            else
            {
                // Remove circles if necessary
                while (mOccupiedTileCircles.Count > mOccupiedTiles.Count)
                {
                    ShapeManager.Remove(mOccupiedTileCircles.Last);
                }
                while (mOccupiedTileCircles.Count < mOccupiedTiles.Count)
                {
                    Circle circle = new Circle();

                    circle.Color = Color.Orange;

                    ShapeManager.AddToLayer(circle, LayerToDrawOn);

                    mOccupiedTileCircles.Add(circle);
                }



                for (int i = 0; i < mOccupiedTiles.Count; i++)
                {
                    IndexToWorld(mOccupiedTiles[i].X, mOccupiedTiles[i].Y,
                                 out mOccupiedTileCircles[i].Position.X,
                                 out mOccupiedTileCircles[i].Position.Y);

                    mOccupiedTileCircles[i].Radius = OccupiedCircleRadius;
                }
            }
        }
Example #21
0
        private void UpdateDistanceDisplay()
        {
            int numberOfLinks = mNodeGrabbed.Links.Count;

            while (mDistanceDisplay.Count < numberOfLinks)
            {
                mDistanceDisplay.Add(TextManager.AddText(""));
            }

            for (int i = 0; i < numberOfLinks; i++)
            {
#if FRB_MDX
                mDistanceDisplay[i].Position =
                    Vector3.Scale((mNodeGrabbed.Position + mNodeGrabbed.Links[i].NodeLinkingTo.Position), .5f);
#else
                mDistanceDisplay[i].Position = (mNodeGrabbed.Position + mNodeGrabbed.Links[i].NodeLinkingTo.Position) * .5f;
#endif
                mDistanceDisplay[i].DisplayText =
                    (mNodeGrabbed.Position - mNodeGrabbed.Links[i].NodeLinkingTo.Position).Length().ToString();
            }
        }
        void CustomInitialize()
        {
            FlatRedBall.FlatRedBallServices.GraphicsOptions.TextureFilter = Microsoft.Xna.Framework.Graphics.TextureFilter.Point;
            SolidColorTransparencyTestSprite.TextureScale = SpriteTextureScale;

            SolidColorTransparencyTestSprite.Left = Camera.Main.AbsoluteLeftXEdgeAt(0);
            SolidColorTransparencyTestSprite.Top  = Camera.Main.AbsoluteTopYEdgeAt(0);


            float nextLeft = SolidColorTransparencyTestSprite.Right;

            for (int i = 0; i < 6; i++)
            {
                var newSprite = SolidColorTransparencyTestSprite.Clone();
                newSprite.Left = nextLeft;
                nextLeft       = newSprite.Right;

                dynamicSprites.Add(newSprite);
                SpriteManager.AddSprite(newSprite);
                newSprite.Alpha = 1 - ((i + 1) * .12f);
            }
        }
Example #23
0
        private static ElementRuntime CreateNewOrGetExistingElementRuntime(NamedObjectSave namedObjectSave, Layer layerToPutOn, PositionedObjectList <ElementRuntime> listToPopulate, ElementRuntime parent)
        {
            ElementRuntime newOrExisting = null;

            for (int i = 0; i < listToPopulate.Count; i++)
            {
                if (listToPopulate[i].AssociatedNamedObjectSave == namedObjectSave)
                {
                    newOrExisting = listToPopulate[i];
                    break;
                }
            }

            if (newOrExisting == null)
            {
                newOrExisting      = new ElementRuntime(null, layerToPutOn, namedObjectSave, parent.CreationOptions.OnBeforeVariableSet, parent.CreationOptions.OnAfterVariableSet);
                newOrExisting.Name = namedObjectSave.InstanceName;
                listToPopulate.Add(newOrExisting);
            }

            return(newOrExisting);
        }
        public PositionedObjectList<FlatRedBall.Math.Geometry.AxisAlignedRectangle> ToAxisAlignedRectangleList()
        {
            PositionedObjectList<FlatRedBall.Math.Geometry.AxisAlignedRectangle> listToReturn = new PositionedObjectList<FlatRedBall.Math.Geometry.AxisAlignedRectangle>();

            foreach (AxisAlignedRectangleSave rectangleSave in AxisAlignedRectangleSaves)
            {
                FlatRedBall.Math.Geometry.AxisAlignedRectangle rectangle = rectangleSave.ToAxisAlignedRectangle();
                listToReturn.Add(rectangle);
            }

            return listToReturn;
        }
        private object CreateFlatRedBallTypeNos(NamedObjectSave namedObjectSave, 
            PositionedObjectList<ElementRuntime> listToPopulate, Layer layerToPutOn)
        {
            object returnObject = null;

            ElementRuntime newElementRuntime = null;

            switch (namedObjectSave.SourceClassType)
            {
                case "Layer":
                case "FlatRedBall.Graphics.Layer":
                    returnObject = CreateLayerObject(namedObjectSave, returnObject);
                    break;
                case "AxisAlignedRectangle":
                case "FlatRedBall.Math.Geometry.AxisAlignedRectangle":
                    AxisAlignedRectangle aaRectangle = ShapeManager.AddAxisAlignedRectangle();
                    if (layerToPutOn != null)
                    {
                        ShapeManager.AddToLayer(aaRectangle, layerToPutOn);
                    }
                    aaRectangle.Name = namedObjectSave.InstanceName;
                    returnObject = aaRectangle;
                    break;
                case "Camera":
                case "FlatRedBall.Camera":
                    if (namedObjectSave.IsNewCamera)
                    {
                        returnObject = null;
                    }
                    else
                    {
                        returnObject = SpriteManager.Camera;
                    }
                    break;
                case "Circle":
                case "FlatRedBall.Math.Geometry.Circle":
                    Circle circle = ShapeManager.AddCircle();
                    circle.Name = namedObjectSave.InstanceName;
                    if (layerToPutOn != null)
                    {
                        ShapeManager.AddToLayer(circle, layerToPutOn);
                    }
                    returnObject = circle;

                    break;
                case "Polygon":
                case "FlatRedBall.Math.Geometry.Polygon":
                    Polygon polygon = ShapeManager.AddPolygon();
                    polygon.Name = namedObjectSave.InstanceName;

                    if(layerToPutOn != null)
                    {
                        ShapeManager.AddToLayer(polygon, layerToPutOn);
                    }
                    returnObject = polygon;

                    break;
                case "Sprite":
                case "FlatRedBall.Sprite":
                    Sprite sprite = SpriteManager.AddSprite((Texture2D)null);
                    if (layerToPutOn != null)
                    {
                        SpriteManager.AddToLayer(sprite, layerToPutOn);
                    }
                    sprite.Name = namedObjectSave.InstanceName;
                    returnObject = sprite;
                    break;
                case "SpriteFrame":
                case "FlatRedBall.ManagedSpriteGroups.SpriteFrame":
                    SpriteFrame spriteFrame = SpriteManager.AddSpriteFrame(null, SpriteFrame.BorderSides.All);
                    if (layerToPutOn != null)
                    {
                        SpriteManager.AddToLayer(spriteFrame, layerToPutOn);
                    }
                    spriteFrame.Name = namedObjectSave.InstanceName;
                    returnObject = spriteFrame;
                    break;
                case "Text":
                case "FlatRedBall.Graphics.Text":
                    Text text = TextManager.AddText("");
                    if (layerToPutOn != null)
                    {
                        TextManager.AddToLayer(text, layerToPutOn);
                        text.SetPixelPerfectScale(layerToPutOn);
                    }
                    text.Name = namedObjectSave.InstanceName;
                    returnObject = text;
                    break;
                case "Scene":
                case "FlatRedBall.Scene":
                    Scene scene = new Scene();

                    scene.Name = namedObjectSave.InstanceName;
                    returnObject = scene;
                    break;
                default:
                    // do nothing - need to add more types?
                    break;
            }

            if (returnObject != null)
            {
                if (returnObject is IScalable)
                {
                    newElementRuntime = new ScalableElementRuntime(null, layerToPutOn, namedObjectSave, CreationOptions.OnBeforeVariableSet, CreationOptions.OnAfterVariableSet);
                }
                else
                {
                    newElementRuntime = new ElementRuntime(null, layerToPutOn, namedObjectSave, CreationOptions.OnBeforeVariableSet, CreationOptions.OnAfterVariableSet);
                }
                newElementRuntime.mDirectObjectReference = returnObject;

                if (returnObject is Camera && !namedObjectSave.IsNewCamera)
                {
                    SpriteManager.Camera.AttachTo(newElementRuntime, false);
                    SpriteManager.Camera.RelativePosition = Vector3.Zero;
                    newElementRuntime.Z = 40;
                    newElementRuntime.Name = namedObjectSave.InstanceName;
                }
                else if (returnObject is FlatRedBall.Utilities.INameable)
                {
                    newElementRuntime.Name = ((FlatRedBall.Utilities.INameable)returnObject).Name;
                }
                else
                {
                    object nameValueAsObject;
                    if (LateBinder.TryGetValueStatic(returnObject, "Name", out nameValueAsObject))
                    {

                        newElementRuntime.Name = (string)nameValueAsObject;

                    }
                }

                listToPopulate.Add(newElementRuntime);
            }

            return returnObject;
        }
        public override void Initialize(bool addToManagers)
        {
            // Generated Initialize
            LoadStaticContent(ContentManagerName);
            BulletList = new PositionedObjectList<Bullet>();
            RockList = new PositionedObjectList<Rock>();
            MainShipList = new PositionedObjectList<MainShip>();
            Player1Ship = new RockBlaster.Entities.MainShip(ContentManagerName, false);
            Player1Ship.Name = "Player1Ship";
            EndGameUiInstance = new RockBlaster.Entities.EndGameUi(ContentManagerName, false);
            EndGameUiInstance.Name = "EndGameUiInstance";
            HudInstance = new RockBlaster.Entities.Hud(ContentManagerName, false);
            HudInstance.Name = "HudInstance";
            RockSpawnerInstance = new RockBlaster.Entities.RockSpawner(ContentManagerName, false);
            RockSpawnerInstance.Name = "RockSpawnerInstance";
            MainShipList.Add(Player1Ship);

            PostInitialize();
            base.Initialize(addToManagers);
            if (addToManagers)
            {
                AddToManagers();
            }
        }
Example #27
0
        private void UpdateGrid()
        {
            #region Make sure there are enough horizontal lines

            while (mHorizontalLines.Count < mNumberOfHorizontalLines)
            {
                Line newLine = new Line();

                if (mLayer != null)
                {
                    ShapeManager.AddToLayer(newLine, mLayer, false);
                }
                mHorizontalLines.Add(newLine);
            }

            while (mHorizontalLines.Count > mNumberOfHorizontalLines)
            {
                ShapeManager.Remove(mHorizontalLines.Last);
            }

            #endregion

            #region Make sure there are enough vertical lines

            while (mVerticalLines.Count < mNumberOfVerticalLines)
            {
                Line newLine = new Line();
                if (mLayer != null)
                {
                    ShapeManager.AddToLayer(newLine, mLayer, false);
                }
                mVerticalLines.Add(newLine);
            }

            while (mVerticalLines.Count > mNumberOfVerticalLines)
            {
                ShapeManager.Remove(mVerticalLines.Last);
            }

            #endregion

            #region Get top, bottom, left, right of LineGrid

            float bottom = mY -
                           mDistanceBetweenLines * (mNumberOfHorizontalLines - 1) / 2.0f;

            float top = mY +
                        mDistanceBetweenLines * (mNumberOfHorizontalLines - 1) / 2.0f;

            float left = mX -
                         mDistanceBetweenLines * (mNumberOfVerticalLines - 1) / 2.0f;

            float right = mX +
                          mDistanceBetweenLines * (mNumberOfVerticalLines - 1) / 2.0f;

            #endregion

            #region Position, color, and scale the horizontal lines


            for (int i = 0; i < mNumberOfHorizontalLines; i++)
            {
                mHorizontalLines[i].X = mX;
                mHorizontalLines[i].Y = bottom + i * mDistanceBetweenLines;
                mHorizontalLines[i].Z = mZ;
                mHorizontalLines[i].RelativePoint1.X = left - mX;
                mHorizontalLines[i].RelativePoint1.Y = 0;

                mHorizontalLines[i].RelativePoint2.X = right - mX;
                mHorizontalLines[i].RelativePoint2.Y = 0;

                if (i == mNumberOfHorizontalLines / 2)
                {
                    mHorizontalLines[i].Color = CenterLineColor;
                }
                else
                {
                    mHorizontalLines[i].Color = GridColor;
                }
            }

            #endregion

            #region Position, color, and scale the vertical lines


            for (int i = 0; i < mNumberOfVerticalLines; i++)
            {
                mVerticalLines[i].X = left + i * mDistanceBetweenLines;;
                mVerticalLines[i].Y = mY;
                mVerticalLines[i].Z = mZ;
                mVerticalLines[i].RelativePoint1.X = 0;
                mVerticalLines[i].RelativePoint1.Y = bottom - mY;

                mVerticalLines[i].RelativePoint2.X = 0;
                mVerticalLines[i].RelativePoint2.Y = top - mY;

                if (i == mNumberOfVerticalLines / 2)
                {
                    mVerticalLines[i].Color = CenterLineColor;
                }
                else
                {
                    mVerticalLines[i].Color = GridColor;
                }
            }

            #endregion

            UpdateVisibility();
        }
        public PositionedObjectList<Circle> ToCircleList()
        {
            PositionedObjectList<Circle> listToReturn = new PositionedObjectList<Circle>();

            foreach (CircleSave circleSave in CircleSaves)
            {
                Circle circle = circleSave.ToCircle();
                listToReturn.Add(circle);
            }

            return listToReturn;
        }
Example #29
0
        /// <summary>
        /// Updates the visible representation of the NodeNetwork.  This is only needed to be called if the NodeNetwork
        /// is visible and if any contained PositionedNodes or Links have changed.
        /// </summary>
        public virtual void UpdateShapes()
        {
            Vector3 zeroVector = new Vector3();

            if (mVisible == false)
            {
                while (mNodeVisibleRepresentation.Count != 0)
                {
                    ShapeManager.Remove(mNodeVisibleRepresentation[mNodeVisibleRepresentation.Count - 1]);
                }

                while (mLinkVisibleRepresentation.Count != 0)
                {
                    ShapeManager.Remove(mLinkVisibleRepresentation[mLinkVisibleRepresentation.Count - 1]);
                }
            }
            else
            {
                #region Create nodes to match how many nodes are in the network
                while (mNodes.Count > mNodeVisibleRepresentation.Count)
                {
                    Polygon newPolygon = Polygon.CreateEquilateral(4, 1, MathHelper.PiOver4);
                    newPolygon.Name = "NodeNetwork Polygon";

                    const bool makeAutomaticallyUpdated = false;
                    ShapeManager.AddToLayer(newPolygon, LayerToDrawOn, makeAutomaticallyUpdated);
                    // This was commented out and I'm not sure why.  With this
                    // uncommented, it makes it so the NodeNetwork is never drawn.
                    // I discovered this while working on the AIEditor on Sept 22, 2010.
                    newPolygon.Visible = true;


                    newPolygon.Color = mNodeColor;
                    mNodeVisibleRepresentation.Add(newPolygon);
                }
                #endregion

                #region Remove nodes if there are too many
                while (mNodes.Count < mNodeVisibleRepresentation.Count)
                {
                    ShapeManager.Remove(mNodeVisibleRepresentation[mNodeVisibleRepresentation.Count - 1]);
                }
                #endregion

                #region Create/update links and update node positions

                int nextLine = 0;
                //List<PositionedNode> nodesAlreadyLinkedTo = new List<PositionedNode>();

                for (int i = 0; i < mNodes.Count; i++)
                {
                    mNodeVisibleRepresentation[i].Position = mNodes[i].Position;

                    mNodeVisibleRepresentation[i].ScaleBy(
                        GetVisibleNodeRadius(SpriteManager.Camera, i) /
                        mNodeVisibleRepresentation[i].BoundingRadius);
                    mNodeVisibleRepresentation[i].UpdateDependencies(-1, true);

                    foreach (Link link in mNodes[i].mLinks)
                    {
                        #region If this line hasn't been created or updated during this method yet, update it
                        //if (nodesAlreadyLinkedTo.Contains(link.NodeLinkingTo) == false)
                        {
                            // haven't drawn links to this node yet so draw it

                            #region Create a line for this link if there isn't one already
                            if (nextLine >= mLinkVisibleRepresentation.Count)
                            {
                                Line line = new Line();
                                line.Name = "NodeNetwork Link Line";
                                mLinkVisibleRepresentation.Add(line);

                                const bool makeAutomaticallyUpdated = false;
                                ShapeManager.AddToLayer(line, LayerToDrawOn, makeAutomaticallyUpdated);

                                //line.Visible = true;
                            }
                            #endregion

                            #region Adjust the line if necessary

                            Line lineModifying = mLinkVisibleRepresentation[nextLine];

                            nextLine++;

                            lineModifying.SetFromAbsoluteEndpoints(
                                mNodes[i].Position, link.NodeLinkingTo.Position);

                            Vector3 offsetVector = link.NodeLinkingTo.Position - mNodes[i].Position;
                            offsetVector.Normalize();
                            offsetVector *= mLinkPerpendicularOffset;
                            // A negative 90 degree rotation will result in forward being "on the right side"
                            MathFunctions.RotatePointAroundPoint(zeroVector, ref offsetVector, -(float)System.Math.PI / 2.0f);

                            lineModifying.Position += offsetVector;
                            //lineModifying.Position.X = (mNodes[i].X + link.NodeLinkingTo.X) / 2.0f;
                            //lineModifying.Position.Y = (mNodes[i].Y + link.NodeLinkingTo.Y) / 2.0f;

                            //lineModifying.RelativePoint1.X = mNodes[i].X - lineModifying.X;
                            //lineModifying.RelativePoint1.Y = mNodes[i].Y - lineModifying.Y;

                            //lineModifying.RelativePoint2.X = link.NodeLinkingTo.X - lineModifying.X;
                            //lineModifying.RelativePoint2.Y = link.NodeLinkingTo.Y - lineModifying.Y;

                            UpdateLinkColor(lineModifying, link.Cost);
                            #endregion
                        }
                        #endregion
                    }
                    //nodesAlreadyLinkedTo.Add(mNodes[i]);
                }
                #endregion

                while (nextLine < mLinkVisibleRepresentation.Count)
                {
                    ShapeManager.Remove(mLinkVisibleRepresentation[mLinkVisibleRepresentation.Count - 1]);
                }
            }
        }
Example #30
0
        public void UpdateShapes()
        {
            #region If Invisible, remove everything
            if (mVisible == false)
            {
                while (mSplinePointsCircles.Count != 0)
                {
                    ShapeManager.Remove(mSplinePointsCircles.Last);
                }

                while (mPathRectangles.Count != 0)
                {
                    ShapeManager.Remove(mPathRectangles.Last);
                }
            }
            #endregion

            else
            {
                float radius = SplinePointVisibleRadius;

                #region Create enough SplinePoint Circles for the Spline


                while (mSplinePoints.Count > mSplinePointsCircles.Count)
                {
                    Circle newCircle = ShapeManager.AddCircle();
                    mSplinePointsCircles.Add(newCircle);
                }

                #endregion

                #region Remove any extra SplinePoints

                while (mSplinePoints.Count < mSplinePointsCircles.Count)
                {
                    ShapeManager.Remove(mSplinePointsCircles.Last);
                }

                #endregion

                double duration           = Duration;
                int    numberOfRectangles = 1 + (int)(duration / PointFrequency);

                #region Create enough Path Rectangles for the Spline

                while (numberOfRectangles > mPathRectangles.Count)
                {
                    AxisAlignedRectangle aar = ShapeManager.AddAxisAlignedRectangle();
                    mPathRectangles.Add(aar);
                }

                #endregion

                #region Remove any extra Path Rectangles

                while (numberOfRectangles < mPathRectangles.Count)
                {
                    ShapeManager.Remove(mPathRectangles.Last);
                }

                #endregion

                #region Update the SplinePoint Circle Positions and Colors

                for (int i = 0; i < mSplinePoints.Count; i++)
                {
                    mSplinePointsCircles[i].Position = mSplinePoints[i].Position;
                    mSplinePointsCircles[i].Color    = PointColor;
                    mSplinePointsCircles[i].Radius   = radius;
                }

                #endregion

                #region Update the Path Rectangle Positions and Colors

                double fractionOfTime = this.Duration / (double)mPathRectangles.Count;

                double startTime = 0;

                if (mSplinePoints.Count != 0)
                {
                    startTime = mSplinePoints[0].Time;
                }

                for (int i = 0; i < mPathRectangles.Count; i++)
                {
                    mPathRectangles[i].Position = GetPositionAtTime(startTime + i * fractionOfTime);
                    mPathRectangles[i].Color    = PathColor;
                    mPathRectangles[i].ScaleX   = mPathRectangles[i].ScaleY = radius / 2.0f;
                }

                #endregion
            }
        }
        public void UpdateToList()
        {
            bool hasAnythingChanged = false;

            #region If there is no list watching, then return
            if (mListOfAttachables == null)
            {
                return;
            }
            #endregion

            #region Add nodes to the dictionary if there are any in the list that aren't in the dictionary

            for (int i = 0; i < mListOfAttachables.Count; i++)
            {
                IAttachable iAttachable = (IAttachable)mListOfAttachables[i];

                if (iAttachable == null)
                {
                    throw new Exception();
                }

                if (!IsNodeCreatedForAttachable(iAttachable))
                {
                    HierarchyNode hierarchyNode = new HierarchyNode(VisibleRepresentationType.Sprite);

                    hierarchyNode.TextRed   = mTextColor.R;
                    hierarchyNode.TextGreen = mTextColor.G;
                    hierarchyNode.TextBlue  = mTextColor.B;

                    if (LayerUsing != null)
                    {
                        hierarchyNode.AddToLayer(LayerUsing);
                    }

                    mNodes.Add(iAttachable, hierarchyNode);

                    hierarchyNode.ObjectRepresenting = iAttachable;
                    mNodesAsList.Add(hierarchyNode);

                    hasAnythingChanged = true;
                }
            }

            #endregion

            #region Remove nodes if necessary

            if (mListOfAttachables.Count < this.mNodesAsList.Count)
            {
                for (int i = 0; i < mNodesAsList.Count; i++)
                {
                    HierarchyNode node = mNodesAsList[i];

                    if (!this.mListOfAttachables.Contains(node.ObjectRepresenting))
                    {
                        // Remove this node
                        mNodes.Remove(node.ObjectRepresenting);
                        node.Destroy();

                        hasAnythingChanged = true;
                    }
                }
                //There are nodes in the dictionary that have to be removed
            }

            #endregion

            #region Update the element visibility of each node

            foreach (HierarchyNode node in mNodesAsList)
            {
                HierarchyNode parentNode = null;

                IAttachable nodeParent = GetParent(node.ObjectRepresenting);

                if (nodeParent != null)
                {
                    parentNode = GetNodeFromAttachable(nodeParent);
                }

                hasAnythingChanged |= node.UpdateElementVisibility(parentNode);
            }

            #endregion

            if (hasAnythingChanged)
            {
                AutoPosition();
            }
        }
Example #32
0
        ElementRuntime LoadEntityObject(NamedObjectSave n, Layer layerToPutOn, PositionedObjectList<ElementRuntime> listToPopulate)
        {
            IElement entityElement = ObjectFinder.Self.GetEntitySave(n.SourceClassType);

            ElementRuntime newElement = new ElementRuntime(entityElement, layerToPutOn, n, CreationOptions.OnBeforeVariableSet, CreationOptions.OnAfterVariableSet);

            newElement.Name = n.InstanceName;

            listToPopulate.Add(newElement);
            SpriteManager.AddPositionedObject(newElement);


            return newElement;
        }
Example #33
0
        static void UpdateSelectionUI()
        {
            #region Handle Text, Sprite, and SpriteFrame selection

            #region Get the number of objects needed
            int numberOfRectangles =
                GameData.EditorLogic.CurrentSprites.Count +
                GameData.EditorLogic.CurrentSpriteFrames.Count;// +
            //GameData.EditorLogic.CurrentTexts.Count;
            #endregion

            #region Create and destroy to get the number needed

            while (numberOfRectangles < mCurrentSelectionRectangles.Count)
            {
                mCurrentSelectionRectangles[0].Destroy();
            }
            while (numberOfRectangles > mCurrentSelectionRectangles.Count)
            {
                mCurrentSelectionRectangles.Add(new ScalableSelector());
            }
            #endregion


            int currentIndex = 0;

            foreach (Sprite sprite in GameData.EditorLogic.CurrentSprites)
            {
                mCurrentSelectionRectangles[currentIndex].UpdateToObject(sprite, SpriteManager.Camera);
                currentIndex++;
            }

            foreach (SpriteFrame spriteFrame in GameData.EditorLogic.CurrentSpriteFrames)
            {
                mCurrentSelectionRectangles[currentIndex].UpdateToObject(spriteFrame, SpriteManager.Camera);
                currentIndex++;
            }

            //foreach (Text text in GameData.EditorLogic.CurrentTexts)
            //{
            //    mCurrentSelectionRectangles[currentIndex].UpdateToObject(text, SpriteManager.Camera);
            //    currentIndex++;
            //}

            #endregion

            #region Handle PositionedModel selection

            mSelectedModelHighlight.Visible = GameData.EditorLogic.CurrentPositionedModels.Count > 0;

            if (mSelectedModelHighlight.Visible)
            {
                PositionedModel selectedModel = GameData.EditorLogic.CurrentPositionedModels[0];

                mSelectedModelHighlight.SetDataFrom(selectedModel);

                mSelectedModelHighlight.Position       = selectedModel.Position;
                mSelectedModelHighlight.RotationMatrix = selectedModel.RotationMatrix;
                mSelectedModelHighlight.ScaleX         = selectedModel.ScaleX;
                mSelectedModelHighlight.ScaleY         = selectedModel.ScaleY;
                mSelectedModelHighlight.ScaleZ         = selectedModel.ScaleZ;
            }


            #endregion
        }
        public PositionedObjectList<Sphere> ToSphereList()
        {
            PositionedObjectList<Sphere> listToReturn = new PositionedObjectList<Sphere>();

            foreach (SphereSave sphereSave in SphereSaves)
            {
                Sphere sphere = sphereSave.ToSphere();
                listToReturn.Add(sphere);
            }

            return listToReturn;
        }
Example #35
0
        private object CreateFlatRedBallTypeNos(NamedObjectSave namedObjectSave,
                                                PositionedObjectList <ElementRuntime> listToPopulate, Layer layerToPutOn)
        {
            object returnObject = null;

            ElementRuntime newElementRuntime = null;

            switch (namedObjectSave.SourceClassType)
            {
            case "Layer":
            case "FlatRedBall.Graphics.Layer":
                returnObject = CreateLayerObject(namedObjectSave, returnObject);
                break;

            case "AxisAlignedRectangle":
            case "FlatRedBall.Math.Geometry.AxisAlignedRectangle":
                AxisAlignedRectangle aaRectangle = ShapeManager.AddAxisAlignedRectangle();
                if (layerToPutOn != null)
                {
                    ShapeManager.AddToLayer(aaRectangle, layerToPutOn);
                }
                aaRectangle.Name = namedObjectSave.InstanceName;
                returnObject     = aaRectangle;
                break;

            case "Camera":
            case "FlatRedBall.Camera":
                if (namedObjectSave.IsNewCamera)
                {
                    returnObject = null;
                }
                else
                {
                    returnObject = SpriteManager.Camera;
                }
                break;

            case "Circle":
            case "FlatRedBall.Math.Geometry.Circle":
                Circle circle = ShapeManager.AddCircle();
                circle.Name = namedObjectSave.InstanceName;
                if (layerToPutOn != null)
                {
                    ShapeManager.AddToLayer(circle, layerToPutOn);
                }
                returnObject = circle;

                break;

            case "Polygon":
            case "FlatRedBall.Math.Geometry.Polygon":
                Polygon polygon = ShapeManager.AddPolygon();
                polygon.Name = namedObjectSave.InstanceName;

                if (layerToPutOn != null)
                {
                    ShapeManager.AddToLayer(polygon, layerToPutOn);
                }
                returnObject = polygon;

                break;

            case "Sprite":
            case "FlatRedBall.Sprite":
                Sprite sprite = SpriteManager.AddSprite((Texture2D)null);
                if (layerToPutOn != null)
                {
                    SpriteManager.AddToLayer(sprite, layerToPutOn);
                }
                sprite.Name  = namedObjectSave.InstanceName;
                returnObject = sprite;
                break;

            case "SpriteFrame":
            case "FlatRedBall.ManagedSpriteGroups.SpriteFrame":
                SpriteFrame spriteFrame = SpriteManager.AddSpriteFrame(null, SpriteFrame.BorderSides.All);
                if (layerToPutOn != null)
                {
                    SpriteManager.AddToLayer(spriteFrame, layerToPutOn);
                }
                spriteFrame.Name = namedObjectSave.InstanceName;
                returnObject     = spriteFrame;
                break;

            case "Text":
            case "FlatRedBall.Graphics.Text":
                Text text = TextManager.AddText("");
                if (layerToPutOn != null)
                {
                    TextManager.AddToLayer(text, layerToPutOn);
                    text.SetPixelPerfectScale(layerToPutOn);
                }
                text.Name    = namedObjectSave.InstanceName;
                returnObject = text;
                break;

            case "Scene":
            case "FlatRedBall.Scene":
                Scene scene = new Scene();

                scene.Name   = namedObjectSave.InstanceName;
                returnObject = scene;
                break;

            default:
                // do nothing - need to add more types?
                break;
            }

            if (returnObject != null)
            {
                if (returnObject is IScalable)
                {
                    newElementRuntime = new ScalableElementRuntime(null, layerToPutOn, namedObjectSave, CreationOptions.OnBeforeVariableSet, CreationOptions.OnAfterVariableSet);
                }
                else
                {
                    newElementRuntime = new ElementRuntime(null, layerToPutOn, namedObjectSave, CreationOptions.OnBeforeVariableSet, CreationOptions.OnAfterVariableSet);
                }
                newElementRuntime.mDirectObjectReference = returnObject;

                if (returnObject is Camera && !namedObjectSave.IsNewCamera)
                {
                    SpriteManager.Camera.AttachTo(newElementRuntime, false);
                    SpriteManager.Camera.RelativePosition = Vector3.Zero;
                    newElementRuntime.Z    = 40;
                    newElementRuntime.Name = namedObjectSave.InstanceName;
                }
                else if (returnObject is FlatRedBall.Utilities.INameable)
                {
                    newElementRuntime.Name = ((FlatRedBall.Utilities.INameable)returnObject).Name;
                }
                else
                {
                    object nameValueAsObject;
                    if (LateBinder.TryGetValueStatic(returnObject, "Name", out nameValueAsObject))
                    {
                        newElementRuntime.Name = (string)nameValueAsObject;
                    }
                }

                listToPopulate.Add(newElementRuntime);
            }

            return(returnObject);
        }
        public PositionedObjectList<FlatRedBall.Math.Geometry.Polygon> ToPolygonList()
        {
            PositionedObjectList<FlatRedBall.Math.Geometry.Polygon> listToReturn = new PositionedObjectList<FlatRedBall.Math.Geometry.Polygon>();

            foreach (PolygonSave polygonSave in PolygonSaves)
            {
                FlatRedBall.Math.Geometry.Polygon polygon = polygonSave.ToPolygon();
                listToReturn.Add(polygon);
            }

            return listToReturn;
        }
        public PositionedObjectList<FlatRedBall.Math.Geometry.AxisAlignedCube> ToAxisAlignedCubeList()
        {
            PositionedObjectList<FlatRedBall.Math.Geometry.AxisAlignedCube> listToReturn = new PositionedObjectList<FlatRedBall.Math.Geometry.AxisAlignedCube>();

            foreach (AxisAlignedCubeSave cubeSave in AxisAlignedCubeSaves)
            {
                FlatRedBall.Math.Geometry.AxisAlignedCube cube = cubeSave.ToAxisAlignedCube();
                listToReturn.Add(cube);
            }

            return listToReturn;
        }
Example #38
0
        // *** Set initial game state ***
        public override void Initialize(bool addToManagers)
        {
            // Set the screen up here instead of in the Constructor to avoid
            // exceptions occurring during the constructor.

            TimeManager.CurrentTime = 0f;
            timeLimit = 200f;

            #region farseer_world_init

            // *** Farseer world initialisation ***
            //
            float gravity = -10;
            farWorld = new World(new Vector2(0f, gravity));
            //
            // ***

            #endregion


            // >>> Remove cursor for WP.
            #region ui_init

            // *** UI initialisation ***
            //
            // *** Cursor *** (not required for WP)
            //
            frbCursor = new CursorEntity("CursorSprite");
            frbCursor.Initialize();
            //
            frbRGripButton = new RGripButton("RGripButtonSprite");
            frbRGripButton.Initialize();
            frbLGripButton = new LGripButton("LGripButtonSprite");
            frbLGripButton.Initialize();
            //
            // frbRSwingButton = new RSwingButton("RSwingButtonSprite");
            //frbRSwingButton.Initialize();
            // frbLSwingButton = new LSwingButton("LSwingButtonSprite");
            // frbLSwingButton.Initialize();

            // frbPullUpButton = new PullUpButton("PullUpButtonSprite");
            // frbPullUpButton.Initialize();

            frbTut = new TutorialBubble("TutorialBubble");
            frbTut.Initialize();

            // ***

            #endregion


            #region entity_init

            // *** Create & initialise entities for game start ***
            //
            // *** Player character ***
            //
            frbClimber = new ClimberEntity(farWorld, new Vector2(0f, 0f));
            frbClimber.Initialize();
            //
            //
            #region grip_entites

            // *** Grips ***
            frbGrips = new PositionedObjectList <GripEntity>();
            //
            frbGrip1 = new GripEntity("GripSprite1", farWorld);
            frbGrip1.Initialize(new Vector2(-10f, 0f), false, 0);
            frbGrips.Add(frbGrip1);
            //
            frbGrip2 = new GripEntity("GripSprite2", farWorld);
            frbGrip2.Initialize(new Vector2(5f, 0f), false, 0);
            frbGrips.Add(frbGrip2);
            //
            frbGrip3 = new GripEntity("GripSprite3", farWorld);
            frbGrip3.Initialize(new Vector2(20f, 0f), false, 0);
            frbGrips.Add(frbGrip3);
            //
            frbGrip4 = new GripEntity("GripSprite4", farWorld);
            frbGrip4.Initialize(new Vector2(30f, 5f), false, 0);
            frbGrips.Add(frbGrip4);
            //
            frbGrip5 = new GripEntity("GripSprite5", farWorld);
            frbGrip5.Initialize(new Vector2(40f, 10f), false, 0);
            frbGrips.Add(frbGrip5);
            //
            frbGrip6 = new GripEntity("GripSprite6", farWorld);
            frbGrip6.Initialize(new Vector2(30f, 15f), false, 0);
            frbGrips.Add(frbGrip6);
            //
            frbGrip7 = new GripEntity("GripSprite7", farWorld);
            frbGrip7.Initialize(new Vector2(40f, 20f), false, 0);
            frbGrips.Add(frbGrip7);
            //
            frbGrip8 = new GripEntity("GripSprite8", farWorld);
            frbGrip8.Initialize(new Vector2(45f, 30f), false, 0);
            frbGrips.Add(frbGrip8);
            //
            frbGrip9 = new GripEntity("GripSprite9", farWorld);
            frbGrip9.Initialize(new Vector2(40f, 40f), false, 0);
            frbGrips.Add(frbGrip9);
            //
            frbGrip10 = new GripEntity("GripSprite10", farWorld);
            frbGrip10.Initialize(new Vector2(45f, 55f), false, 0);
            frbGrips.Add(frbGrip10);
            //
            frbGrip11 = new GripEntity("GripSprite11", farWorld);
            frbGrip11.Initialize(new Vector2(40f, 70f), false, 0);
            frbGrips.Add(frbGrip11);
            //
            frbGrip12 = new GripEntity("GripSprite12", farWorld);
            frbGrip12.Initialize(new Vector2(45f, 85f), true, 15);
            frbGrips.Add(frbGrip12);
            //
            frbGrip13 = new GripEntity("GripSprite13", farWorld);
            frbGrip13.Initialize(new Vector2(60f, 85f), true, 15);
            frbGrips.Add(frbGrip13);
            //
            frbGrip14 = new GripEntity("GripSprite14", farWorld);
            frbGrip14.Initialize(new Vector2(75f, 85f), true, 8);
            frbGrips.Add(frbGrip14);
            //
            frbGrip15 = new GripEntity("GripSprite15", farWorld);
            frbGrip15.Initialize(new Vector2(90f, 85f), false, 0);
            frbGrips.Add(frbGrip15);
            //

            #endregion
            //
            //
            // *** Scenery ***
            //
            // platform = new Platform(farWorld, new Vector2(100f, 1.5f), new Vector2(0f, -40f));
            //
            frbCheckpoints = new PositionedObjectList <CheckpointEntity>();
            //
            frbCheckpoint1 = new CheckpointEntity("CheckPointSprite1");
            frbCheckpoint1.Initialize(new Vector2(82.5f, 82.5f), 120f);
            frbCheckpoints.Add(frbCheckpoint1);

            #endregion


            // AddToManagers should be called LAST in this method:
            if (addToManagers)
            {
                AddToManagers();
            }
        }