当前位置: 首页>>代码示例>>C#>>正文


C# InputDevice类代码示例

本文整理汇总了C#中InputDevice的典型用法代码示例。如果您正苦于以下问题:C# InputDevice类的具体用法?C# InputDevice怎么用?C# InputDevice使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


InputDevice类属于命名空间,在下文中一共展示了InputDevice类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetInput

 // Update is called once per frame
 void GetInput(InputDevice inputDevice)
 {
     if(inputDevice.MenuWasPressed)
     {
         Application.LoadLevel(1);
     }
 }
开发者ID:paulkelly,项目名称:gamecraft5,代码行数:8,代码来源:WinnerScript.cs

示例2: Editor

        public Editor(InputDevice input)
        {
            this.input = input;

            player = new Player(input);
            player.position.Y = 0.0f;
            player.position.Z = 15.0f;

            camera = new FirstPersonCamera(player);
            camera.width = Application.WIDTH;
            camera.height = Application.HEIGHT;
            camera.near = 0.1f;
            camera.far = 500;
            camera.fov = 1.1f;

            depth_values = new float[]{ 0, -150, -400};
            curr_depth_index = 0;

            cursor = new Cursor(6);
            cursor.color = Color.Gray;

            level = new Level();

            asset_list = new List<object>();
            asset_list.Add(Resources.box_model);
            asset_list.Add(Resources.rock_model);
            asset_list.Add(Resources.seaurchin_model);
            asset_list.Add(Resources.ray_texture);
            asset_list.Add(Resources.starfish_model);

            instance = this;
        }
开发者ID:zfedoran,项目名称:bubblebound,代码行数:32,代码来源:editor.cs

示例3: GetAxisRawForPlayer

 public static float GetAxisRawForPlayer(string axisName, int playerIndex, InputDevice device)
 {
     //        return Input.GetAxisRaw (ConcatPlayerIndex(axisName, playerIndex, device));
     float xbox = Input.GetAxisRaw (ConcatPlayerIndex (axisName, playerIndex, InputDevices.GetAllInputDevices () [(int)InputDevices.ControllerTypes.XBox]));
     float keyboard = Input.GetAxisRaw (ConcatPlayerIndex (axisName, playerIndex, InputDevices.GetAllInputDevices () [(int)InputDevices.ControllerTypes.Keyboard]));
     return xbox + keyboard;
 }
开发者ID:redbluegames,项目名称:gladiators,代码行数:7,代码来源:RBInput.cs

示例4: MonkActions

	public MonkActions(InputDevice device)
	{
		spawn0 = CreatePlayerAction ("Spawn0");
		spawn1 = CreatePlayerAction ("Spawn1");
		spawn2 = CreatePlayerAction ("Spawn2");
		spawn3 = CreatePlayerAction ("Spawn3");
		fireTurret = CreatePlayerAction ("FireTurret");
		moveUnitLeft = CreatePlayerAction ("MoveUnitLeft");
		moveUnitRight = CreatePlayerAction ("MoveUnitRight");
		moveHorizontal = CreateOneAxisPlayerAction (moveUnitLeft, moveUnitRight);

		moveUnitUp = CreatePlayerAction ("MoveUnitUp");
		moveUnitDown = CreatePlayerAction ("MoveUnitDown");
		moveVertical = CreateOneAxisPlayerAction (moveUnitDown,moveUnitUp);

		Device = device;

		spawn0.AddDefaultBinding (InputControlType.Action1);
		spawn1.AddDefaultBinding (InputControlType.Action2);
		spawn2.AddDefaultBinding (InputControlType.Action3);
		spawn3.AddDefaultBinding (InputControlType.Action4);
		fireTurret.AddDefaultBinding (InputControlType.RightTrigger);

		moveUnitLeft.AddDefaultBinding (InputControlType.LeftStickLeft);
		moveUnitRight.AddDefaultBinding (InputControlType.LeftStickRight);
		moveUnitUp.AddDefaultBinding (InputControlType.LeftStickUp);
		moveUnitDown.AddDefaultBinding (InputControlType.LeftStickDown);

	}
开发者ID:mirrorfishmedia,项目名称:GGJ2016,代码行数:29,代码来源:MonkActions.cs

示例5: UpdateCubeWithInputDevice

	void UpdateCubeWithInputDevice( InputDevice inputDevice )
	{
		// Set object material color based on which action is pressed.
		if (inputDevice.Action1)
		{
			cubeRenderer.material.color = Color.green;
		}
		else
			if (inputDevice.Action2)
		{
			cubeRenderer.material.color = Color.red;
		}
		else
			if (inputDevice.Action3)
		{
			cubeRenderer.material.color = Color.blue;
		}
		else
			if (inputDevice.Action4)
		{
			cubeRenderer.material.color = Color.yellow;
		}
		else
		{
			cubeRenderer.material.color = Color.white;
		}
		
		// Rotate target object with both sticks and d-pad.
		transform.Rotate( Vector3.down, 500.0f * Time.deltaTime * inputDevice.Direction.X, Space.World );
		transform.Rotate( Vector3.right, 500.0f * Time.deltaTime * inputDevice.Direction.Y, Space.World );
		transform.Rotate( Vector3.down, 500.0f * Time.deltaTime * inputDevice.RightStickX, Space.World );
		transform.Rotate( Vector3.right, 500.0f * Time.deltaTime * inputDevice.RightStickY, Space.World );
	}
开发者ID:AcessDeniedAD,项目名称:bbqgj2015,代码行数:33,代码来源:InputM.cs

示例6: GetButtonUpForPlayer

 public static bool GetButtonUpForPlayer(string buttonName, int playerIndex, InputDevice device)
 {
     //        return Input.GetButtonUp (ConcatPlayerIndex (buttonName, playerIndex, device));
     bool xbox = Input.GetButtonUp (ConcatPlayerIndex (buttonName, playerIndex, InputDevices.GetAllInputDevices () [(int)InputDevices.ControllerTypes.XBox]));
     bool keyboard = Input.GetButtonUp (ConcatPlayerIndex (buttonName, playerIndex, InputDevices.GetAllInputDevices () [(int)InputDevices.ControllerTypes.Keyboard]));
     return xbox || keyboard;
 }
开发者ID:redbluegames,项目名称:gladiators,代码行数:7,代码来源:RBInput.cs

示例7: CreateButton

    Cursor CreateButton( InputDevice inputDevice )
    {
        if (colorSelectionManagers.Count < maxColorSelectors)
            {
                // Pop a position off the list. We'll add it back if the player is removed.
                //var playerPosition = spawnPoints[0];
                //spawnPoints.RemoveAt( 0 );

                var gameObject = (GameObject) Instantiate( colorSelectionManagerPrefab, new Vector3(0,0,0), Quaternion.identity );
                gameObject.transform.SetParent(GameObject.Find("ColorInputManager").transform);
                gameObject.transform.localPosition = new Vector3(0,0,0);
                gameObject.transform.localScale = new Vector3(1,1,1);
                var buttonManager = gameObject.GetComponent<Cursor>();
                buttonManager.device = inputDevice;
                buttonManager.liaison = layla;
                //scale.c1 = Color.cyan;
                //colorSelectionManagers.Add( buttonManager );

        //				Debug.Log("Adding a new player with device: " + inputDevice);
                layla.GetComponent<GameControlLiaison>().CreatePlayer(inputDevice);
                return buttonManager;
            }

            return null;
    }
开发者ID:SuperActionSports,项目名称:maingame,代码行数:25,代码来源:ColorSelectionCursor.cs

示例8: OnActive

        public override void OnActive(double elapsed, InputDevice input)
        {
            editor.Update(elapsed);

            if (input.IsPressed(Buttons.Start))
                screenmanager.FadeIn(menu_screen);
        }
开发者ID:zfedoran,项目名称:bubblebound,代码行数:7,代码来源:editorscreen.cs

示例9: checkInputPlayer

    //mouvement du player sur les axes x et z
    public void checkInputPlayer(InputDevice inputDevice)
    {
        inputDevice = (InputManager.Devices.Count > playerNum) ? InputManager.Devices[playerNum] : null;

        if(inputDevice!=null)
        updateWithInControle (inputDevice);
    }
开发者ID:jo541,项目名称:pagaille,代码行数:8,代码来源:PlayerMain.cs

示例10: changePlayer

    public void changePlayer(InputDevice inputDevice)
    {
        if (inputDevice.Action4.WasPressed  )
        {

        }
    }
开发者ID:jo541,项目名称:pagaille,代码行数:7,代码来源:PlayerMain.cs

示例11: GetInput

    // Update is called once per frame
    void GetInput(InputDevice inputDevice)
    {
        if(inputDevice.MenuWasPressed)
        {
            Join ();
        }

        if (playerJoined)
        {
            if(!playerReady)
            {
                if(inputDevice.Action1)
                {
                    Ready ();
                }
                if(inputDevice.Action2.WasPressed)
                {
                    Leave ();
                }
            } else
            {
                if(inputDevice.Action2.WasPressed)
                {
                    Unready ();
                }
            }
        }
    }
开发者ID:paulkelly,项目名称:gamecraft5,代码行数:29,代码来源:PlayerMenu.cs

示例12: SpaceShip

        public SpaceShip(PlayerIndex playerNumber, Vector2 position, float rotation, SpriteSheet spriteSheet, ProjectileSystem projectileSystem, GameSettings settings, ContentManager content)
        {
            // instantiate the player's number with a player index
            m_playerNumber = playerNumber;
                 if(m_playerNumber == PlayerIndex.One)   { m_colour = SpaceShipColour.Red; }
            else if(m_playerNumber == PlayerIndex.Two)   { m_colour = SpaceShipColour.Blue; }
            else if(m_playerNumber == PlayerIndex.Three) { m_colour = SpaceShipColour.Green; }
            else if(m_playerNumber == PlayerIndex.Four)  { m_colour = SpaceShipColour.Yellow; }

            // instantiate the player's input device type
            m_inputDevice = settings.getInputDevice(playerNumber);
                 if(m_inputDevice == InputDevice.Controller1) { m_controllerNumber = PlayerIndex.One; }
            else if(m_inputDevice == InputDevice.Controller2) { m_controllerNumber = PlayerIndex.Two; }
            else if(m_inputDevice == InputDevice.Controller3) { m_controllerNumber = PlayerIndex.Three; }
            else if(m_inputDevice == InputDevice.Controller4) { m_controllerNumber = PlayerIndex.Four; }
            else											  { m_controllerNumber = PlayerIndex.One; }

            // instantiate local variables
            this.position = position;
            this.rotation = rotation;
            m_scale = new Vector2(1, 1);

            m_maximumVelocity = 5.8f;
            m_acceleration = 0.048f;
            m_rotationSpeed = 3.1f;

            m_settings = settings;
            m_spriteSheet = spriteSheet;
            m_projectileSystem = projectileSystem;

            if(m_spriteSheet == null) { return; }

            // initialize sprite / sprite animation arrays
            m_idleSprite = new Sprite[3];
            m_movingAnimation = new SpriteAnimation[3];

            // set the space ship sprite sheet offset based on the space ship colour
            int spriteOffset = 0;
                 if(m_colour == SpaceShipColour.Red)    { spriteOffset = 0; }
            else if(m_colour == SpaceShipColour.Blue)   { spriteOffset = 18; }
            else if(m_colour == SpaceShipColour.Green)  { spriteOffset = 3; }
            else if(m_colour == SpaceShipColour.Yellow) { spriteOffset = 21; }

            // load the idle sprites for each colour
            for(int i=0;i<3;i++) {
                m_idleSprite[i] = m_spriteSheet.getSprite(i + spriteOffset);
            }
            // create and store the movement animations for each colour
            for(int i=0;i<3;i++) {
                m_movingAnimation[i] = new SpriteAnimation(0.16f, SpriteAnimationType.Loop);
                m_movingAnimation[i].addSprite(m_spriteSheet.getSprite(i + spriteOffset + 6));
                m_movingAnimation[i].addSprite(m_spriteSheet.getSprite(i + spriteOffset + 12));
            }

            m_offset = new Vector2(m_idleSprite[1].xOffset * 0.9f, m_idleSprite[1].yOffset * 0.9f);
            m_size = new Vector2(m_offset.X * 2.0f, m_offset.Y * 2.0f);

            updateInitialValues();
        }
开发者ID:nitro404,项目名称:Asteroids,代码行数:59,代码来源:SpaceShip.cs

示例13: BindPlayer

    public void BindPlayer(int index, InputDevice device)
    {
        isPlayerBound = true;

        PlayerIndex = index;
        playerDevice = device;
        fighter.SetHuman (true);
    }
开发者ID:redbluegames,项目名称:ness,代码行数:8,代码来源:PlayerController.cs

示例14: Player

 public Player(int index, int playerInputLayer, InputDevice inputDevice)
 {
     m_playerIndex = index;
     m_playerInputLayer = playerInputLayer;
     m_money = 500;
     m_health = 3;
     m_device = inputDevice;
 }
开发者ID:jds0102,项目名称:GGJ2014,代码行数:8,代码来源:Player.cs

示例15: Player

 public Player(int num, InputDevice d)
 {
     playerNum = num;
     device = d;
     ResetElementStats(Element.EARTH);
     ResetElementStats(Element.FIRE);
     ResetElementStats(Element.WATER);
 }
开发者ID:matiasfr,项目名称:Hattrick,代码行数:8,代码来源:PlayersManager.cs


注:本文中的InputDevice类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。