本文整理汇总了C#中Stage.GetQB方法的典型用法代码示例。如果您正苦于以下问题:C# Stage.GetQB方法的具体用法?C# Stage.GetQB怎么用?C# Stage.GetQB使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stage
的用法示例。
在下文中一共展示了Stage.GetQB方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialize
public override void Initialize(Stage stage)
{
base.Initialize(stage);
if (actor.Parm.HasParm("AddToAIQB") && actor.Parm.GetBool("AddToAIQB"))
stage.GetQB<AIQB>().AddLiveEnemy(actor);
if (actor.PhysicsObject.physicsType == PhysicsObject.PhysicsType.Box)
{
//if we are a platform
if (actor.Parm.HasParm("Platform") && actor.Parm.GetBool("Platform"))
{
actor.PhysicsObject.CollisionInformation.CollisionRules.Group = PhysicsQB.platformGroup;
bloodOnDamage = false;
}
else
actor.PhysicsObject.CollisionInformation.CollisionRules.Group = PhysicsQB.normalAIGroup;
actor.PhysicsObject.CollisionInformation.Entity.IsAffectedByGravity = false;
stunnable = false;
}
else if(actor.PhysicsObject.physicsType == PhysicsObject.PhysicsType.CylinderCharacter)
{
actor.PhysicsObject.CollisionInformation.CollisionRules.Group = PhysicsQB.normalAIGroup;
actor.PhysicsObject.CylinderCharController.HorizontalMotionConstraint.Speed = 0;
}
}
示例2: FreeCamera
/// <summary>
/// Creates a camera.
/// </summary>
/// <param name="position">Initial position of the camera.</param>
/// <param name="speed">Speed of the camera per second.</param>
/// <param name="pitch">Initial pitch angle of the camera.</param>
/// <param name="yaw">Initial yaw value of the camera.</param>
/// <param name="projectionMatrix">Projection matrix used.</param>
public FreeCamera(Vector3 position, float speed, float pitch, float yaw, Matrix projectionMatrix, Stage stage)
{
Position = position;
Speed = speed;
Yaw = yaw;
Pitch = pitch;
ProjectionMatrix = projectionMatrix;
ControlsQB controlsQB = stage.GetQB<ControlsQB>();
moveForward = controlsQB.GetInputAction("MoveForward");
moveRight = controlsQB.GetInputAction("MoveRight");
moveUp = controlsQB.GetInputAction("FreeCamMoveUp");
rotateUp = controlsQB.GetInputAction("FreeCamRotateUp");
rotateRight = controlsQB.GetInputAction("FreeCamRotateRight");
speedMultiplier = controlsQB.GetInputAction("FreeCamSpeed");
}
示例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;
}
//.........这里部分代码省略.........
示例4: Initialize
public override void Initialize(Stage stage)
{
track = 0.0f;
track = actor.PhysicsObject.Position.Z;
Space = stage.GetQB<PhysicsQB>().Space;
//input actions
ControlsQB controlsQB = stage.GetQB<ControlsQB>();
strum = controlsQB.GetInputAction("Strum");
A = controlsQB.GetInputAction("A");
B = controlsQB.GetInputAction("B");
Y = controlsQB.GetInputAction("Y");
X = controlsQB.GetInputAction("X");
leftBumper = controlsQB.GetInputAction("LeftBumper");
rightBumper = controlsQB.GetInputAction("RightBumper");
triggers = controlsQB.GetInputAction("Triggers");
leftAxisX = controlsQB.GetInputAction("MoveRight");
guitarJump = controlsQB.GetInputAction("GuitarJump");
//set move direction
//TODO: look this up in a parm
MoveDirection = PlayerDirection.Right;
//get attack list
attacks = new Engine.AttackSystem.ComboSystem("MoveList");
//set camera
CameraQB cameraQB = stage.GetQB<CameraQB>();
PlayerCamera playerCamera = new PlayerCamera(actor.PhysicsObject, CameraQB.DefaultProjectionMatrix);
playerCamera.Reset();
cameraQB.JumpToCamera(playerCamera);
//animations
playerAnimation = actor.GetAgent<PlayerAnimationAgent>();
State = PlayerState.Normal;
facing = PlayerDirection.Right;
//dashing & lock on range
if (Player.PhysicsObject.physicsType == PhysicsObject.PhysicsType.Character)
{
Player.PhysicsObject.CollisionInformation.CollisionRules.Group = PhysicsQB.playerGroup;
if (Player.Parm.HasParm("DashSpeed"))
Player.PhysicsObject.CharacterController.DashSpeed = Player.Parm.GetFloat("DashSpeed");
if (Player.Parm.HasParm("DashTime"))
Player.PhysicsObject.CharacterController.DashTime = Player.Parm.GetFloat("DashTime");
}
//combat
input = new ButtonInput();
smash = 0;
//support for the flow mechanic
flow = new Flow();
//Load the player sounds here
AudioQB AQB = Stage.ActiveStage.GetQB<AudioQB>();
int index = 0;
while (Player.Parm.HasParm("Sound" + index))
{
AQB.AddSound(Player.Parm.GetString("Sound" + index));
index++;
}
if(!Stage.Editor)
isStrumMode = Stage.SaveGame.getStrumMode();
}
示例5: Initialize
public override void Initialize(Stage stage)
{
guitarCont = Stage.Content.Load<Texture2D>("UI/Tutorial/guitarContinueTut");
guitarContDim = new Rectangle((int)(Renderer.ScreenWidth * .5f) - 150, (int)(Renderer.ScreenHeight * .7f), 300, 100);
controllerCont = Stage.Content.Load<Texture2D>("UI/Tutorial/controllerContinueTut");
controllerContDim = new Rectangle((int)(Renderer.ScreenWidth * .5f) - 150, (int)(Renderer.ScreenHeight * .7f), 300, 100);
stage.GetQB<TriggerQB>().RegisterDrawFunction(Draw);
numTuts = actor.Parm.GetInt("Num");
#if INPUTREQUIRED
unpauseInput = new InputAction[numTuts][];
allInputsRequired = new bool[numTuts];
#endif
killEnemies = new bool[numTuts];
spawnEnemy = new bool[numTuts];
triggerDelay = new float[numTuts];
tutImgs = new Microsoft.Xna.Framework.Graphics.Texture2D[numTuts];
imgDim = new Rectangle[numTuts];
//get the control scheme
cQB = stage.GetQB<ControlsQB>();
#if !INPUTREQUIRED
Red = cQB.GetInputAction("B");
strum = cQB.GetInputAction("Strum");
#endif
gp = cQB.GetGamePadType();
Vector2 pos, size;
switch (gp)
{
case Microsoft.Xna.Framework.Input.GamePadType.Guitar:
case Microsoft.Xna.Framework.Input.GamePadType.AlternateGuitar:
for (int j = 0; j < numTuts; j++)
{
#if INPUTREQUIRED
GetInput(j,actor.Parm.GetString("GuitarInput" + j), ref cQB);
#endif
tutImgs[j] = Stage.Content.Load<Texture2D>("UI/Tutorial/" + actor.Parm.GetString("GuitarImage" + j));
pos = actor.Parm.GetVector2("GuitarImagePos" + j);
size = actor.Parm.GetVector2("GuitarImageSize" + j);
imgDim[j] = new Rectangle((int)pos.X, (int)pos.Y, (int)size.X, (int)size.Y);
}
break;
default:
for (int j = 0; j < numTuts; j++)
{
#if INPUTREQUIRED
GetInput(j, actor.Parm.GetString("ControllerInput" + j), ref cQB);
#endif
tutImgs[j] = Stage.Content.Load<Texture2D>("UI/Tutorial/" + actor.Parm.GetString("ControllerImage" + j));
pos = actor.Parm.GetVector2("ControllerImagePos" + j);
size = actor.Parm.GetVector2("ControllerImageSize" + j);
imgDim[j] = new Rectangle((int)pos.X, (int)pos.Y, (int)size.X, (int)size.Y);
}
break;
}
for (int i = 0; i < numTuts; i++)
{
#if INPUTREQUIRED
if (actor.Parm.HasParm("AllInputsRequired" + i))
allInputsRequired[i] = actor.Parm.GetBool("AllInputsRequired" + i);
else
allInputsRequired[i] = false;
#endif
if (actor.Parm.HasParm("SpawnEnemy" + i))
spawnEnemy[i] = actor.Parm.GetBool("SpawnEnemy" + i);
else
spawnEnemy[i] = false;
if (actor.Parm.HasParm("KillEnemies" + i))
killEnemies[i] = actor.Parm.GetBool("KillEnemies" + i);
else
killEnemies[i] = false;
if (actor.Parm.HasParm("TriggerDelay" + i))
triggerDelay[i] = actor.Parm.GetFloat("TriggerDelay" + i);
else
triggerDelay[i] = 0;
}
if (actor.Parm.HasParm("EndLevel"))
returnToMenu = actor.Parm.GetBool("EndLevel");
actor.RegisterUpdateFunction(Update);
UsingOnTriggerEnter = true;
UsingOnTriggerStay = false;
UsingOnTriggerExit = false;
base.Initialize(stage);
}
示例6: Initialize
public override void Initialize(Stage stage)
{
if (actor.Parm.HasParm("DieOnTrigger"))
DieOnTrigger = actor.Parm.GetBool("DieOnTrigger");
// if there is an input action param, we require a button push to trigger
if (actor.Parm.HasParm("InputAction"))
{
requiresButtonPush = true;
ControlsQB cqb = stage.GetQB<ControlsQB>();
inputAction = cqb.GetInputAction(actor.Parm.GetString("InputAction"));
}
// only pay for what we use
if ( UsingOnTriggerEnter )
actor.RegisterBeginCollideFunction(BeginCollide);
if ( UsingOnTriggerExit )
actor.RegisterEndCollideFunction(EndCollide);
if ( UsingOnTriggerStay )
actor.RegisterUpdateFunction(Update);
}
示例7: Initialize
public override void Initialize(Stage stage)
{
base.Initialize(stage);
if (stage.Parm.HasParm("AIRangedSpeedScalar"))
speed *= stage.Parm.GetFloat("AIRangedSpeedScalar");
missileOffset = Vector2.Zero;
if(actor.Parm.HasParm("MissileOffset"))
missileOffset = actor.Parm.GetVector2("MissileOffset");
timeForPogoSkip = .1f;
percAnimForSplat = .45f;
if (actor.Parm.HasParm("MaxJumps"))
maxRocketJumps = actor.Parm.GetInt("MaxJumps");
if (actor.Parm.HasParm("MinJumps"))
minRocketJumps = actor.Parm.GetInt("MinJumps");
if (actor.Parm.HasParm("MaxAttacks"))
maxRocketAttacks = actor.Parm.GetInt("MaxAttacks");
if (actor.Parm.HasParm("MinAttacks"))
minRocketAttacks = actor.Parm.GetInt("MinAttacks");
if (actor.Parm.HasParm("PogoStartTime"))
pogoStartTime = actor.Parm.GetFloat("PogoStartTime");
if (actor.Parm.HasParm("PogoSkipTime"))
timeForPogoSkip = actor.Parm.GetFloat("PogoSkipTime");
if (actor.Parm.HasParm("PercAnimForSplat"))
percAnimForSplat = actor.Parm.GetFloat("PercAnimForSplat");
jumpSpeed = 22;
spawnerIndex = -1;
GetNumJumps();
if (actor.PhysicsObject.physicsType == PhysicsObject.PhysicsType.CylinderCharacter)
{
actor.PhysicsObject.CylinderCharController.HorizontalMotionConstraint.Speed = speed;
actor.PhysicsObject.CollisionInformation.CollisionRules.Group = PhysicsQB.normalAIGroup;
}
shouldAttack = true;
target = PlayerAgent.Player;
state = AIState.Moving;
type = EnemyType.Ranged;
actor.RegisterUpdateFunction(Update);
actor.RegisterDeathFunction(DieFX);
enemyAnimationAgent = actor.GetAgent<RangedEnemyAnimationAgent>();
FaceTargetSnappedToPlane();
Vector3 zero = Vector3.Zero;
_myMissile = stage.GetQB<ActorQB>().CreateActor("Missile", "Missile", ref zero, ref zero, stage);
_myMissile.ShutDown();
}
示例8: Initialize
public override void Initialize(Stage stage)
{
soundName = actor.Parm.GetString("SoundName");
if (actor.Parm.HasParm("Volume"))
volume = actor.Parm.GetFloat("Volume");
if (actor.Parm.HasParm("Pitch"))
pitch = actor.Parm.GetFloat("Pitch");
if (actor.Parm.HasParm("Pan"))
pan = actor.Parm.GetFloat("Pan");
if (actor.Parm.HasParm("Type"))
{
switch (actor.Parm.GetString("Type"))
{
case "Zone":
soundTriggerType = SoundTriggerType.Zone;
break;
case "OneShot":
soundTriggerType = SoundTriggerType.OneShot;
break;
}
}
if (soundTriggerType == SoundTriggerType.Zone)
{
AudioQB audioQB = stage.GetQB<AudioQB>();
soundHandle = audioQB.CreateSoundInstance(soundName);
audioQB.ChangeSoundPan(soundHandle, pan);
audioQB.ChangeSoundPitch(soundHandle, pitch);
audioQB.ChangeSoundVolume(soundHandle, volume);
audioQB.SetSoundLooped(soundHandle, true);
UsingOnTriggerExit = true;
}
else
{
UsingOnTriggerExit = false;
}
UsingOnTriggerEnter = true;
UsingOnTriggerStay = false;
base.Initialize(stage); // let the trigger volume base class initialize itself
}