Пример #1
0
        public AnimalEntity(Scene scene, Vector2 location, AnimalType <T> animal, float rotation = 0) : base(scene, EntityType.Game, location, bodyType: BodyType.Dynamic)
        {
            AnimalType             = animal;
            AddComponent(animation = new AnimatedSpriteComponent(animal.Asset, animal.Size, animal.AssetOrigin));
            AddComponent(new PhysicsComponent(animal.CollisionShape));
            AddComponent(viewSensor = new SensorComponent("view",
                                                          new PolygonShape(PolygonTools.CreateCapsule(animal.ViewDistance, animal.ViewSize / 2, 4, animal.ViewSize, 8), 1),
                                                          e => e is PlayerEntity && ((PlayerEntity)e).State == PlayerState.Luring));

            AddComponent(hearingSensor = new SensorComponent("hearing",
                                                             new CircleShape(animal.HearingDistance, 1),
                                                             e => e is PlayerEntity && ((PlayerEntity)e).State == PlayerState.Shouting));

            AddComponent(new MovementBasicsComponent());
            AddComponent(new RaycastSensorComponent(animal.ViewDistance));
            AddComponent(new AudioSourceComponent());

            aiComponent = new StateBasedAIComponent <T>(animal.InitalState);

            AddComponent(aiComponent);
            aiComponent.StateChanged += AiComponent_StateChanged1;

            // [FOREACH PERFORMANCE] Should not allocate garbage
            foreach (var b in animal.Behaviors)
            {
                AddComponent(b());
            }

            Body.Rotation = rotation;
        }
Пример #2
0
        private void CreateGFX(AssetCreator assets)
        {
            _face  = new Sprite(assets.CircleTexture(0.9f, MaterialType.Squares, Color.Gray, 1f, 24f));
            _torso = new Sprite(assets.TextureFromVertices(PolygonTools.CreateRoundedRectangle(2f, 4f, 0.5f, 0.7f, 2), MaterialType.Squares, Color.LightSlateGray, 0.8f, 24f));

            _upperArm = new Sprite(assets.TextureFromVertices(PolygonTools.CreateCapsule(1.9f, 0.45f, 16), MaterialType.Squares, Color.DimGray, 0.8f, 24f));
            _lowerArm = new Sprite(assets.TextureFromVertices(PolygonTools.CreateCapsule(1.9f, 0.45f, 16), MaterialType.Squares, Color.DarkSlateGray, 0.8f, 24f));

            _upperLeg = new Sprite(assets.TextureFromVertices(PolygonTools.CreateCapsule(2f, 0.5f, 16), MaterialType.Squares, Color.DimGray, 0.8f, 24f));
            _lowerLeg = new Sprite(assets.TextureFromVertices(PolygonTools.CreateCapsule(2f, 0.5f, 16), MaterialType.Squares, Color.DarkSlateGray, 0.8f, 24f));
        }
Пример #3
0
        public static Body CreateCapsule(World world, float height, float topRadius, int topEdges, float bottomRadius, int bottomEdges, float density, Vector2 position = new Vector2(), float rotation = 0, BodyType bodyType = BodyType.Static, object userData = null)
        {
            var verts = PolygonTools.CreateCapsule(height, topRadius, topEdges, bottomRadius, bottomEdges);

            //There are too many vertices in the capsule. We decompose it.
            if (verts.Count >= Settings.MaxPolygonVertices)
            {
                var vertList = Triangulate.ConvexPartition(verts, TriangulationAlgorithm.Earclip);
                return(CreateCompoundPolygon(world, vertList, density, position, rotation, bodyType, userData));
            }

            return(CreatePolygon(world, verts, density, position, rotation, bodyType, userData));
        }
Пример #4
0
    /// <summary>
    /// Setups the physics. The default directionf of this laser is pointing straight down!! 0 degrees is pointing straight down!!
    /// </summary>
    private void SetupPhysics()
    {
        if (body == null)
        {
            body = GetComponent <FSBodyComponent>().PhysicsBody;
            Vertices laserPoints = PolygonTools.CreateCapsule(length, width, edgeCount);
            laserPoints.Translate(new FVector2(0.0f, -(offsetRadius + length / 2.0f)));

            Fixture fix = body.CreateFixture(new PolygonShape(laserPoints, 1.0f));
            CollisionPresets.SetAsEnemyShot(fix);
            body.OnCollision += OnCollisionEvent;
        }
    }
Пример #5
0
        public Body CreateCapsule(float height, float topRadius, int topEdges, float bottomRadius, int bottomEdges, float density, Vector2 position = new Vector2(), float rotation = 0, BodyType bodyType = BodyType.Static, IPhysicsDependencyBody physicsBody = null)
        {
            Vertices verts = PolygonTools.CreateCapsule(height, topRadius, topEdges, bottomRadius, bottomEdges);

            //There are too many vertices in the capsule. We decompose it.
            if (verts.Count >= Settings.MaxPolygonVertices)
            {
                List <Vertices> vertList = Triangulate.ConvexPartition(verts, TriangulationAlgorithm.Earclip);
                return(CreateCompoundPolygon(vertList, density, position, rotation, bodyType, physicsBody));
            }

            return(CreatePolygon(verts, density, position, rotation, bodyType, physicsBody));
        }
Пример #6
0
        public ChickenEntity(Scene scene, Vector2 location, float rotation = 0, int chickenType = -1) : base(scene, location, CreateType(scene.Game.Content, chickenType), rotation)
        {
            AddComponent(proximitySensor = new SensorComponent(
                             "proximity",
                             new PolygonShape(PolygonTools.CreateCapsule(2f, 0.1f, 1, 0.8f, 8), 1f),
                             e => e is ChickenEntity
                             ));

            AddComponent(playerProximitySensor = new SensorComponent(
                             "playerproximity",
                             new CircleShape(0.3f, 1f),
                             e => e is PlayerEntity
                             ));
        }
Пример #7
0
        /// <summary>
        /// Creates a capsule.
        /// Note: Automatically decomposes the capsule if it contains too many vertices (controlled by Settings.MaxPolygonVertices)
        /// </summary>
        /// <param name="world">The world.</param>
        /// <param name="height">The height.</param>
        /// <param name="topRadius">The top radius.</param>
        /// <param name="topEdges">The top edges.</param>
        /// <param name="bottomRadius">The bottom radius.</param>
        /// <param name="bottomEdges">The bottom edges.</param>
        /// <param name="density">The density.</param>
        /// <param name="position">The position.</param>
        /// <returns></returns>
        public static List <Fixture> CreateCapsule(World world, float height, float topRadius, int topEdges,
                                                   float bottomRadius,
                                                   int bottomEdges, float density, Vector2 position)
        {
            Vertices verts = PolygonTools.CreateCapsule(height, topRadius, topEdges, bottomRadius, bottomEdges);

            //There are too many vertices in the capsule. We decompose it.
            if (verts.Count >= Settings.MaxPolygonVertices)
            {
                List <Vertices> vertList    = EarclipDecomposer.ConvexPartition(verts);
                List <Fixture>  fixtureList = CreateCompoundPolygon(world, vertList, density);
                fixtureList[0].Body.Position = position;

                return(fixtureList);
            }

            return(new List <Fixture> {
                CreatePolygon(world, verts, density)
            });
        }
Пример #8
0
        /// <summary>
        /// Creates a capsule.
        /// Note: Automatically decomposes the capsule if it contains too many vertices (controlled by Settings.MaxPolygonVertices)
        /// </summary>
        /// <returns></returns>
        public static Body CreateCapsule(World world, float height, float topRadius, int topEdges, float bottomRadius, int bottomEdges, float density, Vector2 position, object userData = null)
        {
            Vertices verts = PolygonTools.CreateCapsule(height, topRadius, topEdges, bottomRadius, bottomEdges);

            Body body;

            //There are too many vertices in the capsule. We decompose it.
            if (verts.Count >= Settings.MaxPolygonVertices)
            {
                List <Vertices> vertList = Triangulate.ConvexPartition(verts, TriangulationAlgorithm.Earclip);
                body          = CreateCompoundPolygon(world, vertList, density, userData);
                body.Position = position;

                return(body);
            }

            body          = CreatePolygon(world, verts, density, userData);
            body.Position = position;

            return(body);
        }
Пример #9
0
        /// <summary>
        /// Creates a capsule.
        /// Note: Automatically decomposes the capsule if it contains too many vertices (controlled by Settings.MaxPolygonVertices)
        /// </summary>
        /// <param name="world">The world.</param>
        /// <param name="height">The height.</param>
        /// <param name="topRadius">The top radius.</param>
        /// <param name="topEdges">The top edges.</param>
        /// <param name="bottomRadius">The bottom radius.</param>
        /// <param name="bottomEdges">The bottom edges.</param>
        /// <param name="density">The density.</param>
        /// <param name="position">The position.</param>
        /// <returns></returns>
        public static Body CreateCapsule(World world, float height, float topRadius, int topEdges,
                                         float bottomRadius,
                                         int bottomEdges, float density, Vector2 position, PressPlay.FFWD.Components.Collider userData)
        {
            Vertices verts = PolygonTools.CreateCapsule(height, topRadius, topEdges, bottomRadius, bottomEdges);

            Body body;

            //There are too many vertices in the capsule. We decompose it.
            if (verts.Count >= Settings.MaxPolygonVertices)
            {
                List <Vertices> vertList = EarclipDecomposer.ConvexPartition(verts);
                body          = CreateCompoundPolygon(world, vertList, density, userData);
                body.Position = position;

                return(body);
            }

            body          = CreatePolygon(world, verts, density, userData);
            body.Position = position;

            return(body);
        }
Пример #10
0
        public Ragdoll(World world, Vector2 position)
        {
            // Physics
            // Head
            _head                = world.CreateCircle(0.75f, 10f);
            _head.BodyType       = BodyType.Dynamic;
            _head.AngularDamping = LimbAngularDamping;
            _head.Mass           = 2f;
            _head.Position       = position;

            // Torso
            _upperBody          = world.CreateCapsule(0.5f, 0.75f, LegDensity);
            _upperBody.BodyType = BodyType.Dynamic;
            _upperBody.Mass     = 1f;
            _upperBody.SetTransform(position + new Vector2(0f, -1.75f), -MathHelper.Pi / 2f);
            _middleBody          = world.CreateCapsule(0.5f, 0.75f, LegDensity);
            _middleBody.BodyType = BodyType.Dynamic;
            _middleBody.Mass     = 1f;
            _middleBody.SetTransform(position + new Vector2(0f, -3f), -MathHelper.Pi / 2f);
            _lowerBody          = world.CreateCapsule(0.5f, 0.75f, LegDensity);
            _lowerBody.BodyType = BodyType.Dynamic;
            _lowerBody.Mass     = 1f;
            _lowerBody.SetTransform(position + new Vector2(0f, -4.25f), -MathHelper.Pi / 2f);

            // Left Arm
            _lowerLeftArm                = world.CreateCapsule(1f, 0.45f, ArmDensity);
            _lowerLeftArm.BodyType       = BodyType.Dynamic;
            _lowerLeftArm.AngularDamping = LimbAngularDamping;
            _lowerLeftArm.Mass           = 2f;
            _lowerLeftArm.Rotation       = -1.4f;
            _lowerLeftArm.Position       = position + new Vector2(-4f, -2.2f);

            _upperLeftArm                = world.CreateCapsule(1f, 0.45f, ArmDensity);
            _upperLeftArm.BodyType       = BodyType.Dynamic;
            _upperLeftArm.AngularDamping = LimbAngularDamping;
            _upperLeftArm.Mass           = 2f;
            _upperLeftArm.Rotation       = -1.4f;
            _upperLeftArm.Position       = position + new Vector2(-2f, -1.8f);

            // Right Arm
            _lowerRightArm                = world.CreateCapsule(1f, 0.45f, ArmDensity);
            _lowerRightArm.BodyType       = BodyType.Dynamic;
            _lowerRightArm.AngularDamping = LimbAngularDamping;
            _lowerRightArm.Mass           = 2f;
            _lowerRightArm.Rotation       = 1.4f;
            _lowerRightArm.Position       = position + new Vector2(4f, -2.2f);

            _upperRightArm                = world.CreateCapsule(1f, 0.45f, ArmDensity);
            _upperRightArm.BodyType       = BodyType.Dynamic;
            _upperRightArm.AngularDamping = LimbAngularDamping;
            _upperRightArm.Mass           = 2f;
            _upperRightArm.Rotation       = 1.4f;
            _upperRightArm.Position       = position + new Vector2(2f, -1.8f);

            // Left Leg
            _lowerLeftLeg                = world.CreateCapsule(1f, 0.5f, LegDensity);
            _lowerLeftLeg.BodyType       = BodyType.Dynamic;
            _lowerLeftLeg.AngularDamping = LimbAngularDamping;
            _lowerLeftLeg.Mass           = 2f;
            _lowerLeftLeg.Position       = position + new Vector2(-0.6f, -8f);

            _upperLeftLeg                = world.CreateCapsule(1f, 0.5f, LegDensity);
            _upperLeftLeg.BodyType       = BodyType.Dynamic;
            _upperLeftLeg.AngularDamping = LimbAngularDamping;
            _upperLeftLeg.Mass           = 2f;
            _upperLeftLeg.Position       = position + new Vector2(-0.6f, -6f);

            // Right Leg
            _lowerRightLeg                = world.CreateCapsule(1f, 0.5f, LegDensity);
            _lowerRightLeg.BodyType       = BodyType.Dynamic;
            _lowerRightLeg.AngularDamping = LimbAngularDamping;
            _lowerRightLeg.Mass           = 2f;
            _lowerRightLeg.Position       = position + new Vector2(0.6f, -8f);

            _upperRightLeg                = world.CreateCapsule(1f, 0.5f, LegDensity);
            _upperRightLeg.BodyType       = BodyType.Dynamic;
            _upperRightLeg.AngularDamping = LimbAngularDamping;
            _upperRightLeg.Mass           = 2f;
            _upperRightLeg.Position       = position + new Vector2(0.6f, -6f);

            // head -> upper body
            DistanceJoint jointHeadBody = new DistanceJoint(_head, _upperBody, new Vector2(0f, -1f), new Vector2(-0.75f, 0f));

            jointHeadBody.CollideConnected = true;
            jointHeadBody.DampingRatio     = DampingRatio;
            jointHeadBody.Frequency        = Frequency;
            jointHeadBody.Length           = 0.025f;
            world.Add(jointHeadBody);

            // lowerLeftArm -> upperLeftArm
            DistanceJoint jointLeftArm = new DistanceJoint(_lowerLeftArm, _upperLeftArm, new Vector2(0f, 1f), new Vector2(0f, -1f));

            jointLeftArm.CollideConnected = true;
            jointLeftArm.DampingRatio     = DampingRatio;
            jointLeftArm.Frequency        = Frequency;
            jointLeftArm.Length           = 0.02f;
            world.Add(jointLeftArm);

            // upperLeftArm -> upper body
            DistanceJoint jointLeftArmBody = new DistanceJoint(_upperLeftArm, _upperBody, new Vector2(0f, 1f), new Vector2(-0.15f, -1f));

            jointLeftArmBody.DampingRatio = DampingRatio;
            jointLeftArmBody.Frequency    = Frequency;
            jointLeftArmBody.Length       = 0.02f;
            world.Add(jointLeftArmBody);

            // lowerRightArm -> upperRightArm
            DistanceJoint jointRightArm = new DistanceJoint(_lowerRightArm, _upperRightArm, new Vector2(0f, 1f), new Vector2(0f, -1f));

            jointRightArm.CollideConnected = true;
            jointRightArm.DampingRatio     = DampingRatio;
            jointRightArm.Frequency        = Frequency;
            jointRightArm.Length           = 0.02f;
            world.Add(jointRightArm);

            // upperRightArm -> upper body
            DistanceJoint jointRightArmBody = new DistanceJoint(_upperRightArm, _upperBody, new Vector2(0f, 1f), new Vector2(-0.15f, 1f));

            jointRightArmBody.DampingRatio = DampingRatio;
            jointRightArmBody.Frequency    = 25;
            jointRightArmBody.Length       = 0.02f;
            world.Add(jointRightArmBody);

            // lowerLeftLeg -> upperLeftLeg
            DistanceJoint jointLeftLeg = new DistanceJoint(_lowerLeftLeg, _upperLeftLeg, new Vector2(0f, 1.1f), new Vector2(0f, -1f));

            jointLeftLeg.CollideConnected = true;
            jointLeftLeg.DampingRatio     = DampingRatio;
            jointLeftLeg.Frequency        = Frequency;
            jointLeftLeg.Length           = 0.05f;
            world.Add(jointLeftLeg);

            // upperLeftLeg -> lower body
            DistanceJoint jointLeftLegBody = new DistanceJoint(_upperLeftLeg, _lowerBody, new Vector2(0f, 1.1f), new Vector2(0.7f, -0.8f));

            jointLeftLegBody.CollideConnected = true;
            jointLeftLegBody.DampingRatio     = DampingRatio;
            jointLeftLegBody.Frequency        = Frequency;
            jointLeftLegBody.Length           = 0.02f;
            world.Add(jointLeftLegBody);

            // lowerRightleg -> upperRightleg
            DistanceJoint jointRightLeg = new DistanceJoint(_lowerRightLeg, _upperRightLeg, new Vector2(0f, 1.1f), new Vector2(0f, -1f));

            jointRightLeg.CollideConnected = true;
            jointRightLeg.DampingRatio     = DampingRatio;
            jointRightLeg.Frequency        = Frequency;
            jointRightLeg.Length           = 0.05f;
            world.Add(jointRightLeg);

            // upperRightleg -> lower body
            DistanceJoint jointRightLegBody = new DistanceJoint(_upperRightLeg, _lowerBody, new Vector2(0f, 1.1f), new Vector2(0.7f, 0.8f));

            jointRightLegBody.CollideConnected = true;
            jointRightLegBody.DampingRatio     = DampingRatio;
            jointRightLegBody.Frequency        = Frequency;
            jointRightLegBody.Length           = 0.02f;
            world.Add(jointRightLegBody);

            // upper body -> middle body
            RevoluteJoint jointUpperTorso = new RevoluteJoint(_upperBody, _middleBody, _upperBody.Position + new Vector2(0f, -0.625f), true);

            jointUpperTorso.LimitEnabled = true;
            jointUpperTorso.SetLimits(MathHelper.Pi / 16f, -MathHelper.Pi / 16f);
            world.Add(jointUpperTorso);

            // middle body -> lower body
            RevoluteJoint jointLowerTorso = new RevoluteJoint(_middleBody, _lowerBody, _middleBody.Position + new Vector2(0f, -0.625f), true);

            jointLowerTorso.LimitEnabled = true;
            jointLowerTorso.SetLimits(MathHelper.Pi / 8f, -MathHelper.Pi / 8f);
            world.Add(jointLowerTorso);

            // GFX
            _face      = new Sprite(ContentWrapper.CircleTexture(0.75f, "Square", ContentWrapper.Gold, ContentWrapper.Orange, ContentWrapper.Grey, 1f, 24f));
            _torso     = new Sprite(ContentWrapper.PolygonTexture(PolygonTools.CreateRoundedRectangle(1.5f, 2f, 0.75f, 0.75f, 2), "Stripe", ContentWrapper.Gold, ContentWrapper.Orange, ContentWrapper.Black, 2.0f, 24f));
            _upperLimb = new Sprite(ContentWrapper.PolygonTexture(PolygonTools.CreateCapsule(1.9f, 0.45f, 16), "Square", ContentWrapper.Gold, ContentWrapper.Orange, ContentWrapper.Black, 1f, 24f));
            _lowerLimb = new Sprite(ContentWrapper.PolygonTexture(PolygonTools.CreateCapsule(2f, 0.5f, 16), "Square", ContentWrapper.Gold, ContentWrapper.Orange, ContentWrapper.Black, 1f, 24f));
        }
Пример #11
0
        private void TextureFromDictionary(Dictionary <string, object> shapeParam, out Texture2D texture, out Vertices shapeVertices)
        {
            shapeVertices = null;
            texture       = null;
            ObjectType objectType = (ObjectType)shapeParam[ShapeParametersKeys.ObjectType];

            switch (objectType)
            {
            case ObjectType.Arc:
                shapeVertices = PolygonTools.CreatePreTransformedArt(MathHelper.ToRadians((float)shapeParam[ShapeParametersKeys.ArcDegrees]), (int)shapeParam[ShapeParametersKeys.ArcSides], (float)shapeParam[ShapeParametersKeys.ArcRadius]);
                texture       = ContentService.GetContentService().AssetCreator.TextureFromVertices(shapeVertices, (string)shapeParam[ShapeParametersKeys.Material], (Color)shapeParam[ShapeParametersKeys.Color], (float)shapeParam[ShapeParametersKeys.MaterialScale]);

                //shapeVertices.GetCollisionBox().;
                //Vector2 arcOffset = Vector2.One;
                //shapeVertices.Translate(ref arcOffset);
                break;

            case ObjectType.Capsule:
                shapeVertices = PolygonTools.CreateCapsule((float)shapeParam[ShapeParametersKeys.CapsuleHeight], (float)shapeParam[ShapeParametersKeys.CapsuleBottomRadius], (int)shapeParam[ShapeParametersKeys.CapsuleBottomEdges], (float)shapeParam[ShapeParametersKeys.CapsuleTopRadius], (int)shapeParam[ShapeParametersKeys.CapsuleTopEdges]);
                texture       = ContentService.GetContentService().AssetCreator.TextureFromVertices(shapeVertices, (string)shapeParam[ShapeParametersKeys.Material], (Color)shapeParam[ShapeParametersKeys.Color], (float)shapeParam[ShapeParametersKeys.MaterialScale]);
                break;

            case ObjectType.Gear:
                shapeVertices = PolygonTools.CreateGear((float)shapeParam[ShapeParametersKeys.GearTipPercentage], (int)shapeParam[ShapeParametersKeys.GearNumberOfTeeth], (float)shapeParam[ShapeParametersKeys.GearTipPercentage], (float)shapeParam[ShapeParametersKeys.GearToothHeigt]);
                texture       = ContentService.GetContentService().AssetCreator.TextureFromVertices(shapeVertices, (string)shapeParam[ShapeParametersKeys.Material], (Color)shapeParam[ShapeParametersKeys.Color], (float)shapeParam[ShapeParametersKeys.MaterialScale]);
                break;

            case ObjectType.Rectangle:
                shapeVertices = PolygonTools.CreateRectangle((float)shapeParam[ShapeParametersKeys.RectangleWidth], (float)shapeParam[ShapeParametersKeys.RectangleHeight]);
                texture       = ContentService.GetContentService().AssetCreator.TextureFromVertices(shapeVertices, (string)shapeParam[ShapeParametersKeys.Material], (Color)shapeParam[ShapeParametersKeys.Color], (float)shapeParam[ShapeParametersKeys.MaterialScale]);
                break;

            case ObjectType.RoundedRectangle:
                shapeVertices = PolygonTools.CreateRoundedRectangle((float)shapeParam[ShapeParametersKeys.RoundedRectangleWidth], (float)shapeParam[ShapeParametersKeys.RoundedRectangleHeight], (float)shapeParam[ShapeParametersKeys.RoundedRectangleXRadius], (float)shapeParam[ShapeParametersKeys.RoundedRectangleYRadius], (int)shapeParam[ShapeParametersKeys.RoundedRectangleSegments]);
                texture       = ContentService.GetContentService().AssetCreator.TextureFromVertices(shapeVertices, (string)shapeParam[ShapeParametersKeys.Material], (Color)shapeParam[ShapeParametersKeys.Color], (float)shapeParam[ShapeParametersKeys.MaterialScale]);
                break;

            case ObjectType.Ellipse:
                shapeVertices = PolygonTools.CreateEllipse((float)shapeParam[ShapeParametersKeys.EllipseXRadius], (float)shapeParam[ShapeParametersKeys.EllipseYRadius], (int)shapeParam[ShapeParametersKeys.EllipseNumberOfEdges]);
                texture       = ContentService.GetContentService().AssetCreator.EllipseTexture((float)shapeParam[ShapeParametersKeys.EllipseXRadius], (float)shapeParam[ShapeParametersKeys.EllipseYRadius], (string)shapeParam[ShapeParametersKeys.Material], (Color)shapeParam[ShapeParametersKeys.Color], (float)shapeParam[ShapeParametersKeys.MaterialScale]);
                break;

            case ObjectType.Circle:
                shapeVertices = PolygonTools.CreateCircle((float)shapeParam[ShapeParametersKeys.CircleRadius], (int)shapeParam[ShapeParametersKeys.CircleSegments]);
                texture       = ContentService.GetContentService().AssetCreator.CircleTexture((float)shapeParam[ShapeParametersKeys.CircleRadius], (string)shapeParam[ShapeParametersKeys.Material], (Color)shapeParam[ShapeParametersKeys.Color], (float)shapeParam[ShapeParametersKeys.MaterialScale]);
                break;

            case ObjectType.CustomShape:
                if ((bool)shapeParam[ShapeParametersKeys.CustomObjectUseOriginalTexture])
                {
                    ContentService.GetContentService().AssetCreator.ShapeFromTexture((string)shapeParam[ShapeParametersKeys.CustomObjectShape], (float)shapeParam[ShapeParametersKeys.CustomObjectScale], (Color)shapeParam[ShapeParametersKeys.Color], out texture, out shapeVertices);
                }
                else
                {
                    ContentService.GetContentService().AssetCreator.ShapeFromTexture((string)shapeParam[ShapeParametersKeys.CustomObjectShape], (float)shapeParam[ShapeParametersKeys.CustomObjectScale], (string)shapeParam[ShapeParametersKeys.Material], (Color)shapeParam[ShapeParametersKeys.Color], (float)shapeParam[ShapeParametersKeys.MaterialScale], out texture, out shapeVertices);
                }
                break;

            default:
                throw new Exception("Unknown Shape");
            }
        }