本文整理汇总了C#中InputManager类的典型用法代码示例。如果您正苦于以下问题:C# InputManager类的具体用法?C# InputManager怎么用?C# InputManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InputManager类属于命名空间,在下文中一共展示了InputManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Awake
void Awake()
{
if (sGame)
{
// NO DUPES ALLOWED (can happen if we reload the Scene with this on the side)
UnityEngine.Object.DestroyImmediate(gameObject);
return;
}
sGame = this;
mInputManager = new InputManager();
mInputManager.AddInputListener("flap", this);
mScreenListeners = new List<IScreenListener>();
mCachedScreenWidth = Screen.width;
mCachedScreenHeight = Screen.height;
mWorldStateListeners = new List<IWorldStateListener>();
mLevelManager = new LevelManager();
mLevelManager.TurretPrefab = TurretPrefab;
mBulletManager = new BulletManager();
// Sometimes the listeners add themselves, sometimes we add the listeners.
AddWorldStateListener(mLevelManager);
AddWorldStateListener(mBulletManager);
AddScreenListener(mBulletManager);
mLevelManager.AddSpeedListener(mBulletManager);
// mCachedResolution = Screen.currentResolution;
}
示例2: Init
static void Init()
{
EditorWindow.GetWindow(typeof(IM_Manager));
headTexture = Resources.Load<Texture>("EditorWindowTextures/headTexture");
skypeTexture = Resources.Load<Texture>("EditorWindowTextures/skype-icon");
emailTexture = Resources.Load<Texture>("EditorWindowTextures/email-icon");
folderIcon = Resources.Load<Texture>("EditorWindowTextures/folder-icon");
Object itemDatabase = Resources.Load("ItemDatabase");
if (itemDatabase == null)
inventoryItemList = CreateItemDatabase.createItemDatabase();
else
inventoryItemList = (ItemDataBaseList)Resources.Load("ItemDatabase");
Object attributeDatabase = Resources.Load("AttributeDatabase");
if (attributeDatabase == null)
itemAttributeList = CreateAttributeDatabase.createItemAttributeDatabase();
else
itemAttributeList = (ItemAttributeList)Resources.Load("AttributeDatabase");
Object inputManager = Resources.Load("InputManager");
if (inputManager == null)
inputManagerDatabase = CreateInputManager.createInputManager();
else
inputManagerDatabase = (InputManager)Resources.Load("InputManager");
}
示例3: GwenInput
public GwenInput(InputManager inputManager)
{
this.inputManager = inputManager;
canvas = null;
mouseX = 0;
mouseY = 0;
m_AltGr = false;
mouse = inputManager.Mouse;
if (mouse != null)
{
mouse.MouseMove += ProcessMouseMove;
mouse.MouseDrag += ProcessMouseDrag;
mouse.MouseButtonPress += ProcessMouseButtonPressed;
mouse.MouseButtonRelease += ProcessMouseButtonReleased;
mouse.MouseWheelMove += ProcessMouseWheel;
}
keyboard = inputManager.Keyboard;
if (keyboard != null)
{
keyboard.KeyPress += ProcessKeyDown;
keyboard.KeyRelease += ProcessKeyUp;
keyboard.KeyText += ProcessText;
}
}
示例4: Start
public void Start()
{
//Grab mainObject prefab to access managers effectively
mainObject = GameObject.FindGameObjectsWithTag("MainObject")[0];
if (GameObject.FindGameObjectsWithTag("MainObject").Length > 1)
{
GameObject[] mainObjectList = GameObject.FindGameObjectsWithTag("MainObject");
for (int i = 0; i < mainObjectList.Length; ++i)
{
if (mainObjectList[i].GetComponent<GameStateManager>().objectSaved)
mainObject = mainObjectList[i];
}
}
// Notice, these are attached to the MainObject
gameStateManagerRef = mainObject.GetComponent<GameStateManager>();
animationManagerRef = gameStateManagerRef.GetAnimationManager();
inputManagerRef = gameStateManagerRef.GetInputManager();
worldCollisionRef = gameStateManagerRef.GetWorldCollision();
// This script is attached to the player, so we use 'gameObject' here
controllerRef = gameObject.GetComponent<TWCharacterController>();
paperObject = GameObject.FindGameObjectWithTag("background");
}
示例5: Screen
public Screen(ScreenManager manager)
{
this.manager = manager;
this.loadComplete = false;
this.camera = new Camera2D(manager.ViewManager.Width, manager.ViewManager.Height);
this.inputManager = new InputManager();
}
示例6: Awake
void Awake()
{
input = GetComponent<InputManager>();
Cursor.visible = false;
paused = false;
}
示例7: OnBodiesSelected
public override void OnBodiesSelected(List<Body> bodies, InputManager.MouseButton button)
{
List<Body> treesPickedByMouse = ComponentManager.FilterComponentsWithTag("Vegetation", bodies);
foreach (Body tree in treesPickedByMouse)
{
if (!tree.IsVisible || tree.IsAboveCullPlane) continue;
Drawer3D.DrawBox(tree.BoundingBox, Color.LightGreen, 0.1f, false);
if (button == InputManager.MouseButton.Left)
{
if (!Player.Faction.ChopDesignations.Contains(tree))
{
Player.Faction.ChopDesignations.Add(tree);
foreach(CreatureAI creature in Player.Faction.SelectedMinions)
{
creature.Tasks.Add(new KillEntityTask(tree, KillEntityTask.KillType.Chop) { Priority = Task.PriorityType.Low});
}
}
}
else if (button == InputManager.MouseButton.Right)
{
if (Player.Faction.ChopDesignations.Contains(tree))
{
Player.Faction.ChopDesignations.Remove(tree);
}
}
}
}
示例8: LoadContent
public override void LoadContent(ContentManager Content, InputManager inputManager)
{
base.LoadContent(Content, inputManager);
if (font== null)
font = content.Load<SpriteFont>("Font1");
imageNumber = 0;
fileManager = new FileManager();
fade = new List<FadeAnimation>();
images = new List<Texture2D>();
fileManager.LoadContent("Load/Splash.cme", attributes, contents);
for (int i = 0; i < attributes.Count; i++)
{
for (int j = 0; j < attributes[i].Count; j++)
{
switch (attributes[i][j])
{
case "Image":
images.Add(content.Load<Texture2D>(contents[i][j]));
fade.Add(new FadeAnimation());
break;
}
}
}
for (int i = 0; i < fade.Count; i++)
{
fade[i].LoadContent(content, images[i], "", new Vector2(80,60));
fade[i].Scale = 1.25f;
fade[i].IsActive = true;
}
}
示例9: Start
void Start()
{
status = GetComponent<CharStatus> ();
jump = GetComponent<CharJump> ();
rigidBody2D = GetComponent<Rigidbody2D> ();
input = GameObject.Find ("InputManager").GetComponent<InputManager> ();
}
示例10: Awake
private PlayerAnimMachine aniMachine; //our animation controller helper
void Awake()
{
inputManage = GameObject.FindObjectOfType<InputManager>();
//check if one or more classes that we need exist. Case not tell us through an error.
if(inputManage == null)
{
throw new UnassignedReferenceException("inputManage as InputManager is null. "); //component has been not assigned at Inspector tab.
}
aniMachine = FindObjectOfType<PlayerAnimMachine>();
if(aniMachine == null)
{
throw new UnassignedReferenceException("aniMachine as PlayerAnimMachine is null."); //component has been not assigned at Inspector tab.
}
rigidBod2d = this.GetComponent<Rigidbody2D>();
// i prefer occupy memory instead cpu to not slow down using garbage collector.
//Look left and Look right are setter once to use less cpu.
lookLeft = new Vector3(-this.gameObject.transform.localScale.x
,this.gameObject.transform.localScale.y
,this.gameObject.transform.localScale.z);
lookRight = new Vector3(this.gameObject.transform.localScale.x
,this.gameObject.transform.localScale.y
,this.gameObject.transform.localScale.z);
}
示例11: Start
void Start(){
GameObject gm = GameObject.Find ("GameManager");
gameManager = gm.GetComponent<CandyWizardGameManager>();
input = gm.GetComponent<InputManager>();
spawnPosition = transform.position;
}
示例12: getRandomCombo
public List<Button> getRandomCombo(int comboLength, InputManager.Side side) {
List<Button> aList = new List<Button> ();
for (int i = 0; i < comboLength; i++) {
aList.Add (getRandomButton (side));
}
return aList;
}
示例13: BetaMouseMath
public BetaMouseMath()
{
this.varManager = VarManager.Instance;
this.inputManager = InputManager.Instance;
this.gamesManager = BetaGamesManager.Instance;
this.varManager.GetVar(VarManager.Names.Speed, out m_speed);
this.varManager.GetVar(VarManager.Names.Speed2, out m_speed2);
this.varManager.GetVar(VarManager.Names.Speed3, out m_speed3);
this.varManager.GetVar(VarManager.Names.Speed4, out m_speed4);
this.varManager.GetVar(VarManager.Names.Accel, out m_accel);
this.varManager.GetVar(VarManager.Names.Accel2, out m_accel2);
this.varManager.GetVar(VarManager.Names.Accel3, out m_accel3);
this.varManager.GetVar(VarManager.Names.Accel4, out m_accel4);
this.varManager.GetVar(VarManager.Names.Sensitivity1, out m_sensitivity1);
this.varManager.GetVar(VarManager.Names.Sensitivity2, out m_sensitivity2);
this.varManager.GetVar(VarManager.Names.AltSens, out m_altSens);
this.varManager.GetVar(VarManager.Names.AltSens2, out m_altSens2);
this.varManager.GetVar(VarManager.Names.AltSens3, out m_altSens3);
this.varManager.GetVar(VarManager.Names.Deadzone, out m_deadzone);
this.varManager.GetVar(VarManager.Names.YXRatio, out m_yxratio);
this.varManager.GetVar(VarManager.Names.TransExponent1, out m_transExp1);
this.varManager.GetVar(VarManager.Names.Smoothness, out m_smoothness);
this.varManager.GetVar(VarManager.Names.Rate, out m_rate);
this.varManager.GetVar(VarManager.Names.AutoAnalogDisconnect, out m_autoAnalogDisconnect);
this.varManager.GetVar(VarManager.Names.CircularDeadzone, out m_circularDeadzone);
this.varManager.GetVar(VarManager.Names.UseXimApiMouseMath, out m_useXimApiMouseMath);
this.varManager.GetVar(VarManager.Names.DiagonalDampen, out m_diagonalDampen);
this.varManager.GetVar(VarManager.Names.CurrentGame, out m_currentGame);
this.varManager.GetVar(VarManager.Names.MouseStickX, out m_mouseStickX);
this.varManager.GetVar(VarManager.Names.MouseStickY, out m_mouseStickY);
this.varManager.GetVar(VarManager.Names.InvertY, out m_inverty);
this.varManager.GetVar(VarManager.Names.MouseDPI, out m_mouseDpi);
}
示例14: getRandomButton
Button getRandomButton(InputManager.Side side) {
int a = Random.Range (0, 4);
if (a == 0) {
if (side == InputManager.Side.Left) {
return Button.upButton;
} else {
return Button.yellowButton;
}
} else if (a == 1) {
if (side == InputManager.Side.Left) {
return Button.leftButton;
} else {
return Button.redButton;
}
} else if (a == 2) {
if (side == InputManager.Side.Left) {
return Button.downButton;
} else {
return Button.blueButton;
}
} else {
if (side == InputManager.Side.Left) {
return Button.rightButton;
} else {
return Button.greenButton;
}
}
}
示例15: Update
// Update is called once per frame
void Update()
{
if(inpManRef == null) inpManRef = gameStateManagerRef.GetInputManager();
if(worldCollisionRef == null) worldCollisionRef = gameStateManagerRef.GetWorldCollision();
if(inpManRef.foldMode) gameObject.renderer.material.color = new Color(0.0f, 0.0f, 0.0f);
else gameObject.renderer.material.color = new Color(1.0f, 1.0f, 1.0f);
// if the finger is within the bounds of this object
#if UNITY_IPHONE
if(worldCollisionRef.PointInsideObject(gameObject,
gameStateManagerRef.GetTouchController().GetLastFingerPosition())
#endif
#if UNITY_ANDROID
if(worldCollisionRef.PointInsideObject(gameObject,
gameStateManagerRef.GetTouchController().GetLastFingerPosition())
#endif
#if UNITY_STANDALONE
if(Input.GetMouseButtonDown(0) && (worldCollisionRef.PointInsideObject(gameObject, Input.mousePosition))
#endif
&& !inpManRef.tearManagerRef.PlayerCurrentlyTearing &&
!inpManRef.foldRef.currentlyFolding) /*&&
// not performing a tear or a fold
!gameStateManagerRef.GetInputManager().GetFingerGesture().Equals(InputManager.FingerGesture.TEAR) &&
!gameStateManagerRef.GetInputManager().GetFingerGesture().Equals(InputManager.FingerGesture.FOLD)*/
{
inpManRef.moveMode = false;
inpManRef.foldMode = true;
inpManRef.tearMode = false;
gameObject.renderer.material.color = new Color(0.0f, 0.0f, 0.0f);
}
}