本文整理汇总了C#中ParameterSet.GetVector2方法的典型用法代码示例。如果您正苦于以下问题:C# ParameterSet.GetVector2方法的具体用法?C# ParameterSet.GetVector2怎么用?C# ParameterSet.GetVector2使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParameterSet
的用法示例。
在下文中一共展示了ParameterSet.GetVector2方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseParmSet
/// <summary>
/// Read trigger specific parameters from the world parm and add them to the actor parm
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
public static new void ParseParmSet(ref ParameterSet actorParm, ref ParameterSet worldParm)
{
if (worldParm.HasParm("TextPosition"))
actorParm.AddParm("TextPosition", worldParm.GetVector2("TextPosition"));
if (worldParm.HasParm("Text"))
actorParm.AddParm("Text", worldParm.GetString("Text"));
}
示例2: Sun
public Sun(ParameterSet parm)
{
if (parm.HasParm("SunColor"))
lightColor = parm.GetVector4("SunColor");
if (parm.HasParm("AmbientLightColor"))
ambientLightColor = parm.GetVector4("AmbientLightColor");
Vector2 sunAngles = Vector2.Zero;
if (parm.HasParm("SunAngles"))
sunAngles = parm.GetVector2("SunAngles");
if ( shadowMap == null )
shadowMap = new RenderTarget2D(Renderer.Instance.GraphicsDevice, SHADOW_MAP_WIDTH_HEIGHT * NUM_CASCADES, SHADOW_MAP_WIDTH_HEIGHT, false, SurfaceFormat.Single, DepthFormat.Depth24);
SetSunDirectionFromSphericalCoords(sunAngles.X, sunAngles.Y);
}
示例3: switch
// position and rotation come from world parm file, which we dont have access to here
/*public PhysicsObject(PhysicsType physicsType, Model model, Vector3 position, float mass)
{
this.physicsType = physicsType;
int id = idCounter++;
if (DisableMass)
mass = -1.0f;
switch (physicsType)
{
case PhysicsType.Box:
spaceObject = PhysicsHelpers.ModelToPhysicsBox(model, position, mass);
// boxes contain a broadphase entry which is what shows up in ray casts, so we need to make sure its tag is set to the right id
// this will need to be done fore anything that is an ibroadphaseentryowner
((IBroadPhaseEntryOwner)spaceObject).Entry.Tag = id;
break;
case PhysicsType.StaticMesh:
spaceObject = PhysicsHelpers.ModelToStaticMesh(model, new BEPUphysics.MathExtensions.AffineTransform(position));
//staticmesh's are not ibroadphaseentryowners...they will turn directly on the raycast, so nothing else to set the tag on
break;
case PhysicsType.None:
spaceObject = null;
this.position = position;
return;
}
spaceObject.Tag = id;
Stage.ActiveStage.GetQB<PhysicsQB>().Space.Add(spaceObject);
}*/
/// <summary>
/// Create a physics object
/// </summary>
/// <param name="actor">Actor that we are attached to</param>
/// <param name="Parm">Actor's parm file</param>
/// <param name="model">Actors model (so we can size the collider)</param>
/// <param name="position">Position (from world parm)</param>
/// <param name="rotation">Rotation (from world parm)</param>
public PhysicsObject(Actor actor, ParameterSet Parm, Model model, Vector3 position, Vector3 rotation, Stage stage)
{
// **rotation comes in from file as ( pitch, yaw, roll )**
this.actor = actor;
this.physicsType = GameLib.PhysicsObject.PhysicsTypeFromString(Parm.GetString("PhysicsType"));
this.position = position;
this.rotation = Matrix.CreateFromYawPitchRoll(rotation.Y, rotation.X, rotation.Z);
if (ForceStaticMesh)
this.physicsType = PhysicsType.StaticMesh;
switch (this.physicsType)
{
case PhysicsType.Box:
{
float mass;
if (DisableMass)
mass = -1.0f;
else
mass = Parm.GetFloat("Mass");
BEPUphysics.Entities.Entity entity = PhysicsHelpers.ModelToPhysicsBox(model, position, mass, rotation.X, rotation.Y, rotation.Z);
entity.CollisionInformation.OwningActor = actor;
spaceObject = entity;
break;
}
case PhysicsType.StaticMesh:
BEPUphysics.Collidables.StaticMesh mesh = PhysicsHelpers.ModelToStaticMesh(model, new BEPUphysics.MathExtensions.AffineTransform(Quaternion.CreateFromRotationMatrix( this.rotation ), position));
mesh.OwningActor = actor;
spaceObject = mesh;
break;
case PhysicsType.Character:
{
float mass = Parm.GetFloat("Mass");
float scaleRadius = 1.0f;
if (Parm.HasParm("ScaleRadius"))
scaleRadius = Parm.GetFloat("ScaleRadius");
characterController = PhysicsHelpers.ModelToCharacterController(model, position, mass, scaleRadius);
spaceObject = characterController.Body;
characterController.Body.CollisionInformation.OwningActor = actor;
stage.GetQB<PhysicsQB>().AddToSpace(CharacterController);
return;
}
case PhysicsType.CylinderCharacter:
{
float mass = Parm.GetFloat("Mass");
float scaleRadius = 1.0f;
if (Parm.HasParm("ScaleRadius"))
scaleRadius = Parm.GetFloat("ScaleRadius");
if (Parm.HasParm("ColliderDims"))
{
Vector2 v = Parm.GetVector2("ColliderDims");
cylinderCharController = new CylinderCharacterController(position, v.Y, v.X, mass);
}
else
cylinderCharController = PhysicsHelpers.ModelToCylinderCharacterController(model, position, mass, scaleRadius);
cylinderCharController.Body.Orientation = Quaternion.CreateFromYawPitchRoll(rotation.Y, rotation.X, rotation.Z);
spaceObject = cylinderCharController.Body;
cylinderCharController.Body.CollisionInformation.OwningActor = actor;
stage.GetQB<PhysicsQB>().AddToSpace(cylinderCharController);
return;
}
//.........这里部分代码省略.........