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


C# InputManager类代码示例

本文整理汇总了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;
    }
开发者ID:silvioterra,项目名称:TappyFlappy,代码行数:32,代码来源:Game.cs

示例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");
    }
开发者ID:tiagomms,项目名称:Unity_Rush01,代码行数:26,代码来源:IM_Manager.cs

示例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;
            }
        }
开发者ID:FloodProject,项目名称:flood,代码行数:27,代码来源:GUIRenderer.cs

示例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");
    }
开发者ID:dindras234,项目名称:TearableWorld10-19-2015,代码行数:25,代码来源:PlayerCollisions.cs

示例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();
 }
开发者ID:zanagi,项目名称:MelSpaceHunter,代码行数:7,代码来源:Screen.cs

示例6: Awake

    void Awake()
    {
        input = GetComponent<InputManager>();

        Cursor.visible = false;
        paused = false;
    }
开发者ID:JonathanGorr,项目名称:Cursor,代码行数:7,代码来源:Manager.cs

示例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);
                    }
                }
            }
        }
开发者ID:scorvi,项目名称:dwarfcorp,代码行数:30,代码来源:ChopTool.cs

示例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;
            }
        }
开发者ID:Nerminkrus,项目名称:Spel,代码行数:33,代码来源:SplashScreen.cs

示例9: Start

 void Start()
 {
     status = GetComponent<CharStatus> ();
     jump = GetComponent<CharJump> ();
     rigidBody2D = GetComponent<Rigidbody2D> ();
     input = GameObject.Find ("InputManager").GetComponent<InputManager> ();
 }
开发者ID:FelixEder,项目名称:RetroFutureGame,代码行数:7,代码来源:WallJump.cs

示例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);
	}
开发者ID:Avatarchik,项目名称:UnityZombieCross,代码行数:35,代码来源:PlayerController.cs

示例11: Start

	void Start(){
		GameObject gm = GameObject.Find ("GameManager");
		gameManager = gm.GetComponent<CandyWizardGameManager>();
		input = gm.GetComponent<InputManager>();
		
		spawnPosition = transform.position;
	}
开发者ID:maximzavadskiy,项目名称:code-samples,代码行数:7,代码来源:Candy.cs

示例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;
	}
开发者ID:Tb95,项目名称:GGJ2016,代码行数:7,代码来源:ButtonsManager.cs

示例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);
        }
开发者ID:InfInt,项目名称:ximtranslator,代码行数:34,代码来源:BetaMouseMath.cs

示例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;
			}
		}
	}
开发者ID:Tb95,项目名称:GGJ2016,代码行数:28,代码来源:ButtonsManager.cs

示例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);
     }
 }
开发者ID:dindras234,项目名称:TearableWorld10-19-2015,代码行数:31,代码来源:FoldButtonScript.cs


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