本文整理汇总了C#中ControlScheme类的典型用法代码示例。如果您正苦于以下问题:C# ControlScheme类的具体用法?C# ControlScheme怎么用?C# ControlScheme使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ControlScheme类属于命名空间,在下文中一共展示了ControlScheme类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Action
public List<ControlKey> Keys;// = new List<ControlKey>();
public Action(ControlScheme scheme, string name = "defaultAction")//:base(scheme, name)
{
Keys = new List<ControlKey>();
this.scheme = scheme;
this.Name = name;
}
示例2: Axis
public Axis(ControlScheme scheme, string name = "defaultAxis")
//: base(scheme, name)
{
AxisKeys = new List<AxisKey>();
this.scheme = scheme;
this.Name = name;
}
示例3: PlayerData
public PlayerData(int id, int carType, ControlScheme ctrlScheme, PlayerType playerType)
{
_carType = carType;
_ctrlScheme = ctrlScheme;
_playerType = playerType;
_lives = 10;
ID = id;
}
示例4: Start
// Use this for initialization
void Start()
{
controlScheme = ControlManager.Instance.ControlSchemes[0];
InstrumentInHand = ((GameObject)GameObject.Instantiate(InstrumentsInCollection.First().gameObject)).GetComponent<Instrument>();
InstrumentInHand.gameObject.SetActive(true);
InstrumentInHand.transform.position = transform.position;
InstrumentInHand.transform.parent = transform;
player = transform.parent.Find("PlayerCharacter");
}
示例5: Start
// Use this for initialization
void Start()
{
movPhysics = this.GetComponent<DirectMovementPhysics>();
spellController = this.GetComponent<SpellController>();
stats = this.GetComponent<Stats>();
controlScheme = ControlManager.GetControlScheme(1);
//Spells = new List<ISpellBase>();
//Actions = new List<Action>();
}
示例6: GetDirection
public static Vector2 GetDirection(ControlScheme controlScheme)
{
if (!controlsEnabled)
return Vector2.zero;
Vector2 direction = Vector2.zero;
switch (controlScheme)
{
case ControlScheme.KeyboardZQSD:
if (Input.GetKey(KeyCode.Z))
direction.y = 1;
else if (Input.GetKey(KeyCode.S))
direction.y = -1;
if (Input.GetKey(KeyCode.Q))
direction.x = -1;
else if (Input.GetKey(KeyCode.D))
direction.x = 1;
break;
case ControlScheme.KeyboardOKLM:
if (Input.GetKey(KeyCode.O))
direction.y = 1;
else if (Input.GetKey(KeyCode.L))
direction.y = -1;
if (Input.GetKey(KeyCode.K))
direction.x = -1;
else if (Input.GetKey(KeyCode.M))
direction.x = 1;
break;
case ControlScheme.Keyboard5123:
if (Input.GetKey(KeyCode.Keypad5))
direction.y = 1;
else if (Input.GetKey(KeyCode.Keypad2))
direction.y = -1;
if (Input.GetKey(KeyCode.Keypad1))
direction.x = -1;
else if (Input.GetKey(KeyCode.Keypad3))
direction.x = 1;
break;
case ControlScheme.Gamepad1:
direction = GetJoystickAxis(1);
break;
case ControlScheme.Gamepad2:
direction = GetJoystickAxis(2);
break;
case ControlScheme.Gamepad3:
direction = GetJoystickAxis(3);
break;
default:
break;
}
return direction;
}
示例7: changeControlScheme
//Cycle through control schemes.
public void changeControlScheme()
{
if ((int)controlScheme == 5)
{
controlScheme = ControlScheme.Unspecified;
}
else
{
controlScheme = (ControlScheme)((int)controlScheme + 1);
}
}
示例8: Update
public void Update(ControlScheme inputScheme = null)
{
if (scheme == null && inputScheme != null)
scheme = inputScheme;
foreach (ControlKey key in Keys)
{
key.LastState = key.CurState;
key.CurState = IsCKDown(key);
if(key.LastState && scheme != null)
scheme.InputType = key.Type;
}
}
示例9: Start
// Use this for initialization
void Start ()
{
cc = gameObject.GetComponent<Iso2DCharacterController>();
if (ControlScheme == null)
{
ControlScheme = ControlScheme.CreateScheme<PlayerActions>();
ControlScheme.Actions[(int)PlayerActions.PickPocket].Keys.Add(ControlKey.PCKey(KeyCode.Space));
ControlScheme.Actions[(int)PlayerActions.PickPocket].Keys.Add(ControlKey.XboxButton(XboxCtrlrInput.XboxButton.A));
ControlScheme.Actions[(int)PlayerActions.Dance].Keys.Add(ControlKey.PCKey(KeyCode.Q));
ControlScheme.Actions[(int)PlayerActions.Dance].Keys.Add(ControlKey.XboxButton(XboxCtrlrInput.XboxButton.B));
ScriptableObjectHelper.SaveAssetAutoNaming(ControlScheme);
//ControlScheme.hideFlags = HideFlags.DontSave;
}
}
示例10: CheckInPlayer
void CheckInPlayer(ControlScheme scheme)
{
var newPlayer = new Player() { id = players.Count + 1, controls = scheme };
players.Add(newPlayer);
bool isPad = scheme.ToString().StartsWith("Gamepad");
// show his key mapping :
schemeSelection[newPlayer.id - 1].GetComponent<Image>().overrideSprite =
buttonConfigs[(newPlayer.id - 1) * 4 + GetMappingIndex(scheme)];
//if (isPad)
// playerGamepadMappings[newPlayer.id - 1].gameObject.SetActive(true);
//else
// playerKeyMappings[newPlayer.id - 1].gameObject.SetActive(true);
playerOverlays[newPlayer.id - 1].gameObject.SetActive(true);
}
示例11: Start
// Use this for initialization
void Start ()
{
cc = gameObject.GetComponent<SimpleIsoCharacterController>();
pp = gameObject.GetComponent<PickPocket>();
anim = new AnimationSwapAnimatorWrapper(gameObject);
if(ControlScheme == null)
{
ControlScheme = ControlScheme.CreateScheme<PlayerActions>();
ControlScheme.Actions[(int)PlayerActions.PickPocket].Keys.Add(ControlKey.PCKey(KeyCode.Space));
ControlScheme.Actions[(int)PlayerActions.PickPocket].Keys.Add(ControlKey.XboxButton(XboxCtrlrInput.XboxButton.A));
ScriptableObjectHelper.SaveAssetAutoNaming(ControlScheme);
//ControlScheme.hideFlags = HideFlags.DontSave;
}
}
示例12: SelectControlsCoroutine
private IEnumerator SelectControlsCoroutine()
{
while (true)
{
if (Input.GetKeyDown(KeyCode.Space))
{
_selectedControl = ControlScheme.Keyboard;
StartCoroutine(FadeOutTitleCoroutine());
yield break;
}
if (STMReceiver.Instance.Buttons.BreakButtonDown)
{
_selectedControl = ControlScheme.Stm;
StartCoroutine(FadeOutTitleCoroutine());
yield break;
}
yield return null;
}
}
示例13: ChooseCharacter
void ChooseCharacter(ControlScheme scheme, float leftRight)
{
var player = players.First(p => p.controls == scheme);
var rect = playerOverlays[player.id - 1].gameObject.GetComponent<RectTransform>();
var currentPos = rect.anchorMax;
if (leftRight < 0)
{
//move left
_audioSource.PlayOneShot(moveSound);
currentPos.x = currentPos.x == 0f ? 1f : currentPos.x - 0.5f;
}
else
{
//move right
_audioSource.PlayOneShot(moveSound);
currentPos.x = currentPos.x == 1f ? 0f : currentPos.x + 0.5f;
}
rect.anchorMax = currentPos;
rect.anchorMin = currentPos;
}
示例14: UsePowerUp
public static bool UsePowerUp(ControlScheme controlScheme)
{
if (!controlsEnabled)
return false;
switch (controlScheme)
{
case ControlScheme.KeyboardZQSD:
return Input.GetKey(KeyCode.LeftShift);
case ControlScheme.KeyboardOKLM:
return Input.GetKey(KeyCode.Return);
case ControlScheme.Keyboard5123:
return Input.GetKey(KeyCode.KeypadEnter);
case ControlScheme.Gamepad1:
return GetJoystickButton(1);
case ControlScheme.Gamepad2:
return GetJoystickButton(2);
case ControlScheme.Gamepad3:
return GetJoystickButton(3);
}
return false;
}
示例15: Tank
public Tank(int playerIndex, Vector2 position, int team, ControlScheme controlScheme, Rectangle screenBounds)
: base("Sprites", position, Map.TileSize, Map.TileSize, true, SpriteHelper.GetDefaultDepth(SpriteHelper.SpriteDepth.Middle))
{
_playerIndex = playerIndex;
_team = team;
_screenBounds = screenBounds;
_usedControlScheme = controlScheme;
if ((int)_usedControlScheme > 2)
{
_gamePadIndex = (PlayerIndex)_usedControlScheme - 3;
}
//Cannon
SetOrigin(16, 16);
cannon = new Sprite("Sprites", position, 26, 16, false, SpriteHelper.GetDefaultDepth(SpriteHelper.SpriteDepth.Middle) + 0.1f);
cannon.SetTextureRectangle(new Rectangle(96 + (32 * _team), 64, 26, 16));
cannon.SetOrigin(8f, 8f);
cannon.position = position;
_spriteOverlays.Add(cannon);
//Animation
AddAnimationState(new SpriteState("MovingHorizontal", SpriteHelper.GetSpriteRectangleStrip(32, 32, 0, 3 + _team, 3 + _team, 0, 2), _animationSpeed));
_orientation = new Vector2(1, 0);
_currentAnimationState = "MovingHorizontal";
SetCurrentAnimationState(_currentAnimationState);
InitiateAnimationStates();
//Statbar
statsBarPosition = new Vector2(20 + (playerIndex * 290), 24);
if (playerIndex > 1)
{
statsBarPosition.X -= 90;
}
tankSprite = new Sprite("Sprites", (int)statsBarPosition.X, (int)statsBarPosition.Y, new Rectangle(96 + (32 * team), 112, 32, 32), 1);
_healthBar = new HealthBar((int)statsBarPosition.X + 42, (int)statsBarPosition.Y, 116, 30, Color.Green, Color.Red, Color.Black);
powerupRectangle = new Sprite("Sprites", _healthBar.x+100+32,21, 1);
powerupRectangle.SetTextureRectangle(new Rectangle(0, 176, 36, 36));
}