Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
334 views
in Technique[技术] by (71.8m points)

c# - 使Android手机振动100毫秒C#(Making an Android phone vibrate for 100ms C#)

I've been trying out a few games on my phone in the last week, and saw that some used vibration as a " feedback " for the player when something happened, like:

(上周,我一直在尝试在手机上玩几款游戏,发现当发生某些事情时,有些游戏将振动用作玩家的“ 反馈 ”,例如:)

  • The player crashed into a wall;

    (玩家撞到了墙上。)

  • The player did a perfect launch ;

    (玩家进行了完美的发射 ;)

  • The player received a big prize ...

    (玩家获得了大奖 ...)

and so on ...

(等等 ...)

I really love how giving a little vibration or small shake to the phone, can basically tell the player that something important (for the game) happened , through an output that isn't only on the screen or comes from the speaker .

(我真的很喜欢如何通过给手机一些振动或微小的震动,通过一个不仅在屏幕上还是从扬声器发出的输出,基本上告诉玩家(对于游戏而言) 重要的 事情发生了。)

I'm developing my game with Unity .

(我正在用Unity开发游戏。)

In my game, I would make the phone vibrate when the player crashes , and when he receives a big prize , like I've seen other beautiful games doing.

(在我的游戏中, 当玩家崩溃时以及当他获得丰厚的奖金时,我会让手机震动,就像我看到过其他精美的游戏一样。)

I've already tried using the default vibration: Handheld.Vibrate() , that worked, but it was lasting for too much time for my need and I wouldn't have been able to change anything in it.

(我已经尝试过使用默认的振动: Handheld.Vibrate() ,它可以工作,但是由于我的需要它持续了太多时间 ,因此我无法更改其中的任何内容。)

I've read that, to do this, I would need to write a separate plugin , or use one that already exists.

(我读过,要做到这一点,我需要编写一个单独的插件 ,或者使用已经存在的插件 。)

I have not found any working ones, and have no idea how to write one !

(我还没有找到任何可以使用的工具, 也不知道该怎么写 !)

I would only need to call something like vibrateFor(100) where 100 are the milliseconds .

(我只需要调用vibrateFor(100)类的东西,其中100毫秒 。)

Some games, like " Perfect Slices " seem to use this a lot.

(一些游戏,例如“ Perfect Slices ”,似乎经常使用它。)

So, can anyone make such a plugin for me or point out an existing one for Android?

(那么, 有人可以为我制作这样的插件,还是指出现有的Android插件?)

Thanks for your help in advance!

(谢谢您的帮助!)

Edit : Otherwise, could anyone explain to me in detail how to use this plugin that seems to have worked for other people?

(编辑 :否则,谁能向我详细解释如何使用这个似乎对其他人有用的插件?)

  ask by Enrico Cortinovis translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...