• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# PlayerInput类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: MoveCarWithIA

    public void MoveCarWithIA(PlayerInput playerInput)
    {
        if (playerInput._keyCodes.Contains(_inputBrakeCar))
            {
                carRigid.velocity = carRigid.velocity * 0.9f;
            }
            else if (playerInput._keyCodes.Contains(_inputForwardCar))
            {
                carRigid.AddForce(carTransform.forward * 18 * 1.5f, ForceMode.Acceleration);

            }

        if (carRigid.velocity.magnitude > _maxVelocity)
            {
                carRigid.velocity = carRigid.velocity.normalized * _maxVelocity;
            }

            if ( (playerInput._axeHorizontal <= 1.0f && playerInput._axeHorizontal > 0.40f) || (playerInput._axeHorizontal < -0.40f && playerInput._axeHorizontal >= -1.0f) ) // peut etre zone morte a ajouter entre 0.1 et -0.1
            {
                carTransform.Rotate(new Vector3(0, playerInput._axeHorizontal * 2, 0));
                if (carRigid.velocity.magnitude > _maxVelocity * 0.8f)
                {
                    carRigid.velocity = carRigid.velocity * 0.95f;
                }
        }

            if (playerInput._keyCodes.Contains(_inputResetCar))
            {
                Debug.Log("ResetCar");
            carRigid.velocity = new Vector3(0, 0, 0);
            carTransform.position = new Vector3(aiScript._previousCheckPoint.transform.position.x, 0.3f, aiScript._previousCheckPoint.transform.position.z);
            carTransform.LookAt(aiScript._currentCheckPoint.transform);
            StartCoroutine(ResetCar());
        }
    }
开发者ID:VisualPi,项目名称:LOQUET_TIXIER_WATHTHUHEWA_Projet_Annuel,代码行数:35,代码来源:CarControl.cs


示例2: Awake

	void Awake() 
	{
		_recipeManager 	= FindObjectOfType<RecipeManager>();
		_musicManager 	= FindObjectOfType<MusicManager>();
		_rigidbody 		= GetComponent<Rigidbody2D>();
		_collider 		= GetComponent<Collider2D>();
		_animator		= GetComponent<Animator> ();
		_initPos 		= transform.position;

 		if(GameManager.Instance.playerDevices.Count > playerNum - 1)
		{
			//Take the controller assigned on the menu
			_playerInput 		= new PlayerInput(true);
			_playerInput.Device = InputManager.Devices[GameManager.Instance.playerDevices[playerNum - 1]];
			Debug.Log(playerNum + " " + _playerInput.Device.Name);
		}
		else
		{
			//Test only
			Debug.Log("Controllers " + InputManager.Devices.Count);

			if(InputManager.Devices.Count > playerNum - 1)
			{
				_playerInput = new PlayerInput(true);
				_playerInput.Device = InputManager.Devices[playerNum - 1];
			}
			else if(playerNum == 4)
				_playerInput = new PlayerInput(false);
			
			Debug.LogWarning("No input for player " + playerNum);
		}

		FindObjectOfType<GameOverManager>().OnGameOver += HandleGameOver;
	}
开发者ID:Elendow,项目名称:GGJ2016,代码行数:34,代码来源:Player.cs


示例3: Start

 void Start()
 {
     m_Count = 0;
     board = GameObject.Find ("Board").GetComponent<Board> ();
     player = GameObject.Find ("PlayerInput").GetComponent<PlayerInput>();
     gameInfo = GameObject.Find ("GameInfo").GetComponent<GameInfo>();
 }
开发者ID:marv-Shimazug,项目名称:Othello,代码行数:7,代码来源:Undo.cs


示例4: Awake

 // ******************************************** START/ UPDATE ********************************************
 void Awake()
 {
     // find components:
     tform = transform;
     compoMain = Camera.main.GetComponent<Main>();
     compoInput = GetComponent<PlayerInput>();
 }
开发者ID:sma-7,项目名称:circularSpaceGame,代码行数:8,代码来源:ShipMovement.cs


示例5: Awake

    void Awake()
    {
        previousInput = new PlayerInput(0, 0);

        // Get all input sources that are defined
        sources = Reflector.InstantiateAll<PlayerInputSource>();
    }
开发者ID:slap-happy,项目名称:falling-down,代码行数:7,代码来源:PlayerInputController.cs


示例6: Update

    // Update is called once per frame
    void Update()
    {
        // Retrieve our current WASD or Arrow Key input
        // Using GetAxisRaw removes any kind of gravity or filtering being applied to the input
        // Ensuring that we are getting either -1, 0 or 1

        Vector3 moveInput = new Vector3 (Input.GetAxisRaw ("Horizontal"), 0, Input.GetAxisRaw ("Vertical"));

        Vector2 mouseInput = new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y"));

        Vector2 rightStickInput = new Vector2 (Input.GetAxisRaw ("RightH"), Input.GetAxisRaw ("RightV"));

        // pass rightStick values in place of mouse when non-zero
        mouseInput.x = rightStickInput.x != 0 ? rightStickInput.x * RightStickMultiplier.x : mouseInput.x;
        mouseInput.y = rightStickInput.y != 0 ? rightStickInput.y * RightStickMultiplier.y : mouseInput.y;

        float zoomInput = Input.GetAxisRaw("Mouse ScrollWheel");

        bool jumpInput = Input.GetButtonDown("Jump");

        bool shootInput = Input.GetButtonDown ("Shoot");

        Current = new PlayerInput()
        {
            MoveInput = moveInput,
            MouseInput = mouseInput,
            ZoomInput = zoomInput,
            JumpInput = jumpInput,
            ShootInput = shootInput
        };
    }
开发者ID:Metamate,项目名称:ProjectLostWoods,代码行数:32,代码来源:PlayerInputController.cs


示例7: use

 public override void use(PlayerInput usedBy = PlayerInput.None)
 {
     GameData.Instance.Brightness = Mathf.Clamp(GameData.Instance.Brightness + m_Increment,
                                                Constants.BRIGHTNESS_MIN,
                                                Constants.BRIGHTNESS_MAX);
     i_Slider.Value = GameData.Instance.Brightness;
 }
开发者ID:ZaikMD,项目名称:ImagineNation,代码行数:7,代码来源:ButtonV2+Brightness.cs


示例8: OnEnable

	///onEnable looks for inputs for camera and button
	void OnEnable(){
		enemy = GameObject.Find("Enemy").GetComponent<PlayerHealth> ();
		playerInput = GameObject.Find ("Main Camera").GetComponent<PlayerInput>();
		trapAudio = GetComponent <AudioSource> ();
		StartCoroutine("TrapActivate");

	}
开发者ID:swindeler,项目名称:MethodsGame,代码行数:8,代码来源:Traps.cs


示例9: InputSelectV2

 //constructor to initialize the class
 public InputSelectV2(Transform mountPoint, GameObject model, PlayerInput inputType)
 {
     m_MountPoint = mountPoint;
     m_OriginalMountPoint = mountPoint;
     m_Model = model;
     m_InputType = inputType;
 }
开发者ID:ZaikMD,项目名称:ImagineNation,代码行数:8,代码来源:InputSelectV2.cs


示例10: Start

 // Use this for initialization
 void Start()
 {
     _ui = GameObject.Find("Keys");
     _input = new PlayerInput();
     _input.Reset ();
     _controller = this.GetComponent<PlayerPhysics>();
 }
开发者ID:,项目名称:,代码行数:8,代码来源:


示例11: Update

    // Update is called once per frame
    void Update()
    {
        if ((Input.GetKey(KeyCode.P)) && (_actionsLaunched == false))
        {
            Debug.Log("Make Action");

            MakePlayerActions();
        }

        if (_nbInputsToDo > 0)
        {
            _currentPlayerInput = _playerInputs[_currentInputToDo];

            ++_currentInputToDo;
            --_nbInputsToDo;

            if (_currentPlayerInput != null)
                _moveScript.makeMove(_currentPlayerInput);

            if (_nbInputsToDo <= 0)
            {
                _currentInputToDo = 0;

                _actionsLaunched = false;

                _moveScript._playerMove = true;

                Debug.Log("----- End -----");
            }
        }
    }
开发者ID:VisualPi,项目名称:LOQUET_TIXIER_WATHTHUHEWA_Projet_Annuel,代码行数:32,代码来源:MakeActionsScript.cs


示例12: Awake

	void Awake()
	{
		capsule = GetComponent<CapsuleCollider>();
		grabTriggerCol = GetComponent<BoxCollider>();
		anim = GetComponent<Animator> ();
		_charStatus = GetComponent<CharacterStatus> ();
		_charAttacking = GetComponent<CharacterAttacking> ();
		_charAI = GetComponent<CharacterAI> ();
        if (!IsEnemy)
        {
            _playerInput = GetComponent<PlayerInput>();
            //_playerInputMobile = GetComponent<PlayerInputMobile>();
        }
		// I use these since when we have low health, we will move a bit slower.
		// When we get more than 25% health again, we will go back to our
		// default speeds for these.
		defaultAirSpeed = airSpeed;
		m_Loco_0Id = Animator.StringToHash ("Base Layer.Locomotion");
		m_Loco_1Id = Animator.StringToHash ("LowHealth.Locomotion");
		myRigidbody = GetComponent<Rigidbody> ();
		if (!grabTriggerCol)
			Debug.LogWarning("PLEASE ASSIGN YOUR Player's GRAB TRIGGER COLLIDER");
		else
			grabTriggerCol.enabled = false;
	}
开发者ID:MMEstrada,项目名称:GoGoGrandmas,代码行数:25,代码来源:CharacterMotor.cs


示例13: CanEnterState

    public override bool CanEnterState()
    {
        float minDistance = m_AttackRange;

        m_TargettedPlayer = null;

        foreach(PlayerInput player in m_Players)
        {
            if(!LayerMask.LayerToName(player.gameObject.layer).Contains (NameConstants.DEAD_LAYER))
            {
                Vector3 playerPosition = player.transform.position;
                playerPosition.y = transform.position.y;

                float distance = Vector3.Distance(playerPosition, transform.position);

                if(distance <= minDistance)
                {
                    minDistance = distance;

                    m_TargettedPlayer = player;
                }
            }
        }

        return m_TargettedPlayer != null;
    }
开发者ID:Meetic666,项目名称:TillDeathDoUsPart,代码行数:26,代码来源:AttackState.cs


示例14: Awake

 void Awake()
 {
     //getting all the required components
     _rigidbody = GetComponent<Rigidbody2D>();
     _touchDetector = GetComponent<TouchDetector2D>();
     _playerInput = GetComponent<PlayerInput>();
 }
开发者ID:mennolp098,项目名称:Boom-Boom-Boomerang,代码行数:7,代码来源:Movement.cs


示例15: Start

 // Use this for initialization
 protected virtual void Start()
 {
     centerOffset = transform.position - target.position;
     originalcenterOffset = centerOffset;
     playerActor = target.root.GetComponent<PlayerActor>();
     playerInput = target.root.GetComponent<PlayerInput>();
 }
开发者ID:HyagoOliveira,项目名称:NewAmaru,代码行数:8,代码来源:FollowCamera.cs


示例16: Start

    // Use this for initialization
    void Start()
    {
        m_PlayerCombos = FindObjectsOfType<PlayerCombo>();
        m_ComboPowerManager = FindObjectOfType<ComboPowerManager>();

        m_Input = GetComponent<PlayerInput>();
    }
开发者ID:Meetic666,项目名称:TillDeathDoUsPart,代码行数:8,代码来源:PlayerCombo.cs


示例17: Update

        void Update()
        {
            var input = PlayerInput.None;

            // Detect the current input of the Horizontal axis, then
            // broadcast a state update for the player as needed.
            // Do this on each frame to make sure the state is always
            // set properly based on the current user input.
            var horizontal = UnityEngine.Input.GetAxis("Horizontal");
            if(Math.Abs(horizontal) > float.Epsilon)
            {
                input |= horizontal < 0 ? PlayerInput.Left : PlayerInput.Right;
            }

            var jump = UnityEngine.Input.GetButton("Jump");
            if (jump)
            {
                input |= PlayerInput.Jump;
            }

            var fire = UnityEngine.Input.GetButton("Fire1");
            if (fire)
            {
                input |= PlayerInput.Fire;
            }

            Input = input;
        }
开发者ID:hasaki,项目名称:ragetanks,代码行数:28,代码来源:InputController.cs


示例18: Start

 // Use this for initialization
 void Start()
 {
     PMovement = GetComponent<PlayerMovement>();
     PCamera = GetComponent<PlayerCamera>();
     PInput = GetComponent<PlayerInput>();
     PWeapon = GetComponent<PlayerWeapon>();
     PData = GetComponent<PlayerData>();
 }
开发者ID:KevinBreurken,项目名称:GameLab,代码行数:9,代码来源:PlayerBehaviour.cs


示例19: Awake

 void Awake()
 {
     DontDestroyOnLoad(gameObject);
     CurrentGranade = null;
     PlayerInputController = GetComponent<PlayerInput>();
     SetInitialAttributes();
     SetupWeapons();
 }
开发者ID:GroupByStudios,项目名称:TDS_Gauss,代码行数:8,代码来源:Player.cs


示例20: Awake

    protected override void Awake()
    {
        base.Awake();

        input = GetComponent<PlayerInput>();
        color = colors[colorIndex];
        model = transform.GetChild(0);
    }
开发者ID:diego-ruiz,项目名称:gamejam16,代码行数:8,代码来源:Player.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# PlayerIssueOrderEventArgs类代码示例发布时间:2022-05-24
下一篇:
C# PlayerInfo类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap