本文整理汇总了C#中PlayerIndex类的典型用法代码示例。如果您正苦于以下问题:C# PlayerIndex类的具体用法?C# PlayerIndex怎么用?C# PlayerIndex使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PlayerIndex类属于命名空间,在下文中一共展示了PlayerIndex类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AmountFaceRightUp
public Vector2 AmountFaceRightUp(PlayerIndex? controllingPlayer, out PlayerIndex playerIndex)
{
Vector2 amountFaceRightUp;
bool w, a, s, d;
w = a = s = d = false;
if (controllingPlayer.HasValue && GamePad.GetState((PlayerIndex)controllingPlayer).IsConnected)
{
playerIndex = (PlayerIndex)controllingPlayer; //we have the player set if it's a controller.
amountFaceRightUp = GamePad.GetState((PlayerIndex)controllingPlayer).ThumbSticks.Left;
}
else
{
w = IsKeyDown(Keys.W, controllingPlayer, out playerIndex);
a = IsKeyDown(Keys.A, controllingPlayer, out playerIndex);
s = IsKeyDown(Keys.S, controllingPlayer, out playerIndex);
d = IsKeyDown(Keys.D, controllingPlayer, out playerIndex);
float amountFaceRight = ((d) ? 1.0f : 0.0f) + (((a)) ? -1.0f : 0.0f);
float amountFaceUp = ((w) ? 1.0f : 0.0f) + (((s)) ? -1.0f : 0.0f);
amountFaceRightUp = new Vector2(amountFaceRight, amountFaceUp);
}
return amountFaceRightUp;
}
示例2: Ship
public Ship(PlayerIndex playerIndex, Texture2D txShipTexture,Texture2D txBulletTexture,WeaponTypes WeaponType)
{
this.player = playerIndex;
this._weaponType = WeaponType;
this.ShipTexture = txShipTexture;
this._txBulletTexture = txBulletTexture;
}
示例3: PlayerInput
internal PlayerInput(PlayerIndex playerIndex)
{
PlayerIndex = playerIndex;
Index = (int)playerIndex;
Keyboard = new Keyboard();
Gamepad = new Gamepad(PlayerIndex);
}
示例4: FlxGamepad
public FlxGamepad(PlayerIndex IndexOfPlayer)
{
index = IndexOfPlayer;
leftVibe = 0;
rightVibe = 0;
vibeDuration = 0;
}
示例5: Start
public override void Start()
{
this.controllingPlayer = ((CharacterInformationComponent)Parent.GetComponent("CharacterInformationComponent")).PlayerIndex;
this.movementComponent = (MoveComponent)Parent.GetComponent("MoveComponent");
this.bepuPhysicsComponent = (BepuPhysicsComponent)Parent.GetComponent("BepuPhysicsComponent");
this.health = (VitalityComponent)Parent.GetComponent("VitalityComponent");
}
示例6: KeyboardHelper
public KeyboardHelper( Game game, PlayerIndex index )
: base(game)
{
PressCount = new Dictionary<MeanOfKey, int>();
Config = new Dictionary<Keys, MeanOfKey>();
this.playerIndex = index;
}
示例7: IsMenuSelected
public bool IsMenuSelected(PlayerIndex? controllingPlayer, out PlayerIndex playerIndex)
{
return IsNewKeyPress(Keys.Space, controllingPlayer, out playerIndex) ||
IsNewKeyPress(Keys.Enter, controllingPlayer, out playerIndex) ||
IsNewButtonPress(Buttons.A, controllingPlayer, out playerIndex) ||
IsNewButtonPress(Buttons.Start, controllingPlayer, out playerIndex);
}
示例8: GetInput
public GetInput(PlayerIndex index)
{
playerIndex = index;
directionBoolArray = new bool[4] { upPressed, leftPressed, downPressed, rightPressed };
oldKeyState = Keyboard.GetState();
oldPadState = GamePad.GetState(playerIndex);
}
示例9: Evaluate
public bool Evaluate(InputState state, PlayerIndex? controllingPlayer, out PlayerIndex player)
{
ButtonPress buttonTest;
KeyPress keyTest;
if (newPressOnly)
{
buttonTest = state.IsNewButtonPress;
keyTest = state.IsNewKeyPress;
}
else
{
buttonTest = state.IsButtonPressed;
keyTest = state.IsKeyPressed;
}
foreach (Buttons button in buttons)
{
if (buttonTest(button, controllingPlayer, out player))
return true;
}
foreach (Keys key in keys)
{
if (keyTest(key, controllingPlayer, out player))
return true;
}
player = PlayerIndex.One;
return false;
}
示例10: OnCancel
/// <summary>
/// When the user cancels the main menu, ask if they want to exit the sample.
/// </summary>
protected override void OnCancel(PlayerIndex playerIndex)
{
const string message = "Are you sure you want to exit?";
var confirmExitMessageBox = new MessageBoxScreen(message);
confirmExitMessageBox.Accepted += ConfirmExitMessageBoxAccepted;
ScreenManager.AddScreen(confirmExitMessageBox, playerIndex);
}
示例11: PlayerKeyboard
public PlayerKeyboard(IInputDevice inputDevice, PlayerIndex playerIndex)
{
if (inputDevice == null) throw new ArgumentNullException("inputDevice");
InputDevice = inputDevice;
PlayerIndex = playerIndex;
}
示例12: InputManager
public InputManager(InputType type, PlayerIndex player)
{
this.inputType = type;
this.playerIndex = player;
// Populate Dictionary Entries
inputToKeys = new Dictionary<Inputs, Keys>();
inputToKeys.Add(Inputs.A, Keys.A);
inputToKeys.Add(Inputs.B, Keys.S);
inputToKeys.Add(Inputs.Back, Keys.Escape);
inputToKeys.Add(Inputs.Up, Keys.Up);
inputToKeys.Add(Inputs.Down, Keys.Down);
inputToKeys.Add(Inputs.Left, Keys.Left);
inputToKeys.Add(Inputs.Right, Keys.Right);
inputToKeys.Add(Inputs.Start, Keys.Enter);
inputToKeys.Add(Inputs.X, Keys.Z);
inputToKeys.Add(Inputs.Y, Keys.X);
inputToButtons = new Dictionary<Inputs, Buttons>();
inputToButtons.Add(Inputs.A, Buttons.A);
inputToButtons.Add(Inputs.B, Buttons.B);
inputToButtons.Add(Inputs.Back, Buttons.Back);
inputToButtons.Add(Inputs.Up, Buttons.DPadUp);
inputToButtons.Add(Inputs.Down, Buttons.DPadDown);
inputToButtons.Add(Inputs.Left, Buttons.DPadLeft);
inputToButtons.Add(Inputs.Right, Buttons.DPadRight);
inputToButtons.Add(Inputs.Start, Buttons.Start);
inputToButtons.Add(Inputs.X, Buttons.X);
inputToButtons.Add(Inputs.Y, Buttons.Y);
inputToMouse = new Dictionary<Inputs, MouseButton>();
inputToMouse.Add(Inputs.A, MouseButton.Left);
inputToMouse.Add(Inputs.B, MouseButton.Right);
inputToMouse.Add(Inputs.X, MouseButton.Middle);
}
示例13: GetMatchScore
public int this[PlayerIndex playerIndex]
{
get
{
return GetMatchScore(playerIndex);
}
}
示例14: EndScreen
public EndScreen(PlayerIndex playerIndex, Color color)
{
Sprite bg = new Sprite();
bg.LoadTexture(@"Assets/HeartBG");
bg.Scale /= Controller.CurrentDrawCamera.zoom;
this.AddChild(bg);
heart = new Sprite();
heart.LoadTexture(@"Assets/Heart");
heart.Scale /= (Controller.CurrentDrawCamera.zoom * 1.1f);
heart.Position.X += 110;
this.AddChild(heart);
slime = new Sprite();
slime.LoadTexture(@"Assets/HeartSlime");
slime.Scale /= (Controller.CurrentDrawCamera.zoom * 1.1f);
slime.Position.X += 110;
slime.Color = color;
this.AddChild(slime);
Label lbl = new Label("Player " + (float)(playerIndex + 1) + " has won!", Controller.FontController.GetFont("bigFont"));
lbl.Position.X = ((Controller.ScreenSize.X / Controller.CurrentDrawCamera.zoom) / 2) - (lbl.Width / 2);
AddChild(lbl);
Label lblAdvance = new Label("Press A to apply CPR", Controller.FontController.GetFont("bigFont"));
lblAdvance.Position.X = ((Controller.ScreenSize.X / Controller.CurrentDrawCamera.zoom) / 2) - (lblAdvance.Width / 2);
lblAdvance.Position.Y = 550;
AddChild(lblAdvance);
ECGsound = Controller.Content.Load<SoundEffect>("sounds/ecg");
}
示例15: UserControls
public UserControls(PlayerIndex playerIndex, float forceMag, float torqueMag, float forceShiftMag, float torqueShiftMag)
{
this.ForceMag = forceMag;
this.TorqueMag = torqueMag;
this.ForceShiftMag = forceShiftMag;
this.TorqueShiftMag = torqueShiftMag;
this.playerIndex = playerIndex;
//default mappings
KeyMappings[Keys.W] = UserControlKeys.MoveFoward;
KeyMappings[Keys.S] = UserControlKeys.MoveBackward;
KeyMappings[Keys.A] = UserControlKeys.MoveLeft;
KeyMappings[Keys.D] = UserControlKeys.MoveRight;
KeyMappings[Keys.Q] = UserControlKeys.TurnLeft;
KeyMappings[Keys.Left] = UserControlKeys.TurnLeft;
KeyMappings[Keys.E] = UserControlKeys.TurnRight;
KeyMappings[Keys.Right] = UserControlKeys.TurnRight;
KeyMappings[Keys.X] = UserControlKeys.MoveUp;
KeyMappings[Keys.Z] = UserControlKeys.MoveDown;
KeyMappings[Keys.Down] = UserControlKeys.LookUp;
KeyMappings[Keys.Up] = UserControlKeys.LookDown;
KeyMappings[Keys.T] = UserControlKeys.RollRight;
KeyMappings[Keys.G] = UserControlKeys.RollLeft;
KeyMappings[Keys.LeftShift] = UserControlKeys.Shifter;
KeyMappings[Keys.RightShift] = UserControlKeys.Shifter;
KeyMappings[Keys.LeftAlt] = UserControlKeys.PrimaryFire;
KeyMappings[Keys.RightAlt] = UserControlKeys.SecondaryFire;
}