本文整理汇总了C#中PlayerIndex类的典型用法代码示例。如果您正苦于以下问题:C# PlayerIndex类的具体用法?C# PlayerIndex怎么用?C# PlayerIndex使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PlayerIndex类属于命名空间,在下文中一共展示了PlayerIndex类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:funkjunky,项目名称:Revenge-of-the-Morito-2-,代码行数:25,代码来源:InputState.cs
示例2: Ship
public Ship(PlayerIndex playerIndex, Texture2D txShipTexture,Texture2D txBulletTexture,WeaponTypes WeaponType)
{
this.player = playerIndex;
this._weaponType = WeaponType;
this.ShipTexture = txShipTexture;
this._txBulletTexture = txBulletTexture;
}
开发者ID:funkjunky,项目名称:Revenge-of-the-Morito-2-,代码行数:7,代码来源:Ship.cs
示例3: PlayerInput
internal PlayerInput(PlayerIndex playerIndex)
{
PlayerIndex = playerIndex;
Index = (int)playerIndex;
Keyboard = new Keyboard();
Gamepad = new Gamepad(PlayerIndex);
}
开发者ID:Jemeyr,项目名称:Halloween,代码行数:7,代码来源:PlayerInput.cs
示例4: FlxGamepad
public FlxGamepad(PlayerIndex IndexOfPlayer)
{
index = IndexOfPlayer;
leftVibe = 0;
rightVibe = 0;
vibeDuration = 0;
}
开发者ID:IndrekV,项目名称:MonoFlixel,代码行数:7,代码来源:FlxGamepad.cs
示例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");
}
开发者ID:regenvanwalbeek,项目名称:BattleFury,代码行数:7,代码来源:FireProjectileComponent.cs
示例6: KeyboardHelper
public KeyboardHelper( Game game, PlayerIndex index )
: base(game)
{
PressCount = new Dictionary<MeanOfKey, int>();
Config = new Dictionary<Keys, MeanOfKey>();
this.playerIndex = index;
}
开发者ID:NumAniCloud,项目名称:MaterGame,代码行数:7,代码来源:KeyboardHelper.cs
示例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);
}
开发者ID:Nesokas,项目名称:hs,代码行数:7,代码来源:InputState.cs
示例8: GetInput
public GetInput(PlayerIndex index)
{
playerIndex = index;
directionBoolArray = new bool[4] { upPressed, leftPressed, downPressed, rightPressed };
oldKeyState = Keyboard.GetState();
oldPadState = GamePad.GetState(playerIndex);
}
开发者ID:nuts4nuts4nuts,项目名称:graphics,代码行数:7,代码来源:GetInput.cs
示例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;
}
开发者ID:Nesokas,项目名称:hs,代码行数:31,代码来源:InputAction.cs
示例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);
}
开发者ID:kavengagne,项目名称:TetrisGame,代码行数:10,代码来源:MainMenuScreen.cs
示例11: PlayerKeyboard
public PlayerKeyboard(IInputDevice inputDevice, PlayerIndex playerIndex)
{
if (inputDevice == null) throw new ArgumentNullException("inputDevice");
InputDevice = inputDevice;
PlayerIndex = playerIndex;
}
开发者ID:willcraftia,项目名称:WindowsGame,代码行数:7,代码来源:PlayerKeyboard.cs
示例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);
}
开发者ID:colincapurso,项目名称:EngineMVC,代码行数:35,代码来源:InputManager.cs
示例13: GetMatchScore
public int this[PlayerIndex playerIndex]
{
get
{
return GetMatchScore(playerIndex);
}
}
开发者ID:jhauberg-archived,项目名称:LD10,代码行数:7,代码来源:ScoreCount.cs
示例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");
}
开发者ID:broding,项目名称:cholesteral-damage,代码行数:31,代码来源:EndScreen.cs
示例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;
}
开发者ID:DigitalLibrarian,项目名称:xna-forever,代码行数:32,代码来源:UserControls.cs
示例16: HandleInput
/// <summary>
/// Lets the game respond to player input. Unlike the Update method,
/// this will only be called when the gameplay screen is active.
/// </summary>
public override void HandleInput(InputState input)
{
if (input == null)
throw new ArgumentNullException("input");
PlayerIndex[] ControllingPlayers = new PlayerIndex[] { PlayerIndex.One, PlayerIndex.Two, PlayerIndex.Three, PlayerIndex.Four };
// Look up inputs for the active player profile.
//int playerIndex = (int)ControllingPlayer.Value;
for (int playerIndex = 1; playerIndex <= totalPlayers; playerIndex++)
{
KeyboardState keyboardState = input.CurrentKeyboardStates[playerIndex];
GamePadState gamePadState = input.CurrentGamePadStates[playerIndex];
// The game pauses either if the user presses the pause button, or if
// they unplug the active gamepad. This requires us to keep track of
// whether a gamepad was ever plugged in, because we don't want to pause
// on PC if they are playing with a keyboard and have no gamepad at all!
bool gamePadDisconnected = !gamePadState.IsConnected &&
input.GamePadWasConnected[playerIndex];
if (input.IsPauseGame(ControllingPlayers[playerIndex-1]) || gamePadDisconnected)
{
ScreenManager.AddScreen(new PauseMenuScreen(), ControllingPlayers[playerIndex - 1]);
}
}
}
开发者ID:thestonefox,项目名称:Project-Xna,代码行数:32,代码来源:GameplayScreen.cs
示例17: GetKeyboardInputDirection
public static Vector2 GetKeyboardInputDirection(PlayerIndex playerIndex)
{
Vector2 direction = Vector2.Zero;
KeyboardState keyboardState = Keyboard.GetState(playerIndex);
if (playerIndex == PlayerIndex.One)
{
if (keyboardState.IsKeyDown(Keys.W))
{
direction.Y += -1;
}
if (keyboardState.IsKeyDown(Keys.S))
{
direction.Y += 1;
}
}
if (playerIndex == PlayerIndex.Two)
{
if (keyboardState.IsKeyDown(Keys.Up))
direction.Y += -1;
if (keyboardState.IsKeyDown(Keys.Down))
direction.Y += 1;
}
return direction;
}
开发者ID:Die-No,项目名称:RetroSeriesTennis,代码行数:26,代码来源:Input.cs
示例18: BaseGameState
public BaseGameState(Game game, GameStateManager manager)
: base(game, manager)
{
GameRef = (Game1)game;
playerIndexInControl = PlayerIndex.One;
}
开发者ID:brollins90,项目名称:eotd,代码行数:7,代码来源:BaseGameState.cs
示例19: TheWaterArcanian
public TheWaterArcanian(Vector2 position, PlayerIndex thePlayerIndex)
: base(position, thePlayerIndex)
{
// Initialize texture
texArcanianRight = "Arcanian/waterTurtleRight";
texArcanianLeft = "Arcanian/waterTurtleLeft";
texDyingRight = "Arcanian/waterTurtleDead_right";
texDyingLeft = "Arcanian/waterTurtleDead_left";
texShield = "Arcanian/watershieldsprite";
Texture = texArcanianRight;
// Initialize name
mName = "Water Arcanian";
// Initialize shield
mShieldArt.SetTextureSpriteSheet(texShield, 4, 1, 0);
mShieldArt.UseSpriteSheet = true;
// Initliaze water skills
SingleStream waterStream = new SingleStream();
DoubleWaterStream doubleWaterStream = new DoubleWaterStream();
UltimateWaterStream ultimateWaterStream = new UltimateWaterStream();
// Initialize skill set with water skills
mSkillSet = new SkillSet(waterStream, doubleWaterStream, ultimateWaterStream, null);
// Add skills to global list of skills
//G.ListOfSkills.Add(waterStream);
//G.ListOfSkills.Add(doubleWaterStream);
//G.ListOfSkills.Add(ultimateWaterStream);
// Initialize HP Regen
mHPRegenTimer = 0;
}
开发者ID:howardkhl,项目名称:Arc,代码行数:34,代码来源:TheWaterArcanian.cs
示例20: OnCancel
protected override void OnCancel(PlayerIndex playerIndex)
{
MessageBoxScreen confirmExitMessageBox =
new MessageBoxScreen(Mario.Resource.ConfirmExitSample);
confirmExitMessageBox.Accepted += ConfirmExitMessageBoxAccepted;
ScreenManager.AddScreen(confirmExitMessageBox, playerIndex);
}
开发者ID:JKord,项目名称:MarioRevolution,代码行数:7,代码来源:MainMenuScreen.cs
注:本文中的PlayerIndex类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论