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

C# InputManager类代码示例

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

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



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


示例16: CharacterController

 public CharacterController(DefaultCamera camera, InputManager inputManager, float mass)
     : base(mass, PhysicsWorld.PhysicsShape.ConvexMesh)
 {
     this.camera = camera;
     this.inputManager = inputManager;
     camera.KeysEnabled = false;
 }
开发者ID:ajmd17,项目名称:apexengine-sharp,代码行数:7,代码来源:CharacterController.cs


示例17: Start

 // Use this for initialization
 void Start()
 {
     audioSource = GetComponent<AudioSource>();
     audioSource.clip = audioClip;
     flag = true;
     inputManager = FindObjectOfType<InputManager>();
 }
开发者ID:AtsushiUemura,项目名称:SCCP,代码行数:8,代码来源:PlayerStatus.cs


示例18: Personnage

        public Personnage(Rectangle winsize, Vector2 position)
            : base(winsize, position, 140, 190, @"game\perso", 15, 4)
        {
            _graphicalBounds = new GraphicalBounds<CharacterActions>(new Dictionary<CharacterActions, Rectangle>());
            _graphicalBounds.set(CharacterActions.WalkRight, 3, 6, 15);
            _graphicalBounds.set(CharacterActions.WalkLeft, 18, 21, 30);
            _graphicalBounds.set(CharacterActions.StandRight, 1, 1, 2, 4);
            _graphicalBounds.set(CharacterActions.StandLeft, 16, 16, 17, 4);
            _graphicalBounds.set(CharacterActions.JumpRight, 31, 31, 35);
            _graphicalBounds.set(CharacterActions.JumpLeft, 36, 36, 40);
            _graphicalBounds.set(CharacterActions.Attack1Right, 41, 41, 49, 35);
            _graphicalBounds.set(CharacterActions.Attack1Left, 50, 50, 58, 35);
            _graphicalBounds.set(CharacterActions.AttackStunRight, 1, 1, 2, 4);
            _graphicalBounds.set(CharacterActions.AttackStunLeft, 16, 16, 17, 4);
            _graphicalBounds.set(CharacterActions.ReceiveAttackRight, 60, 60, 60);
            _graphicalBounds.set(CharacterActions.ReceiveAttackLeft, 59, 59, 59);
            Action = CharacterActions.StandRight;
            _physics.MaxHeight = 400;
            _physics.TimeOnFlat = 500;
            _inputManager = new InputManager<KeysActions, Keys>();
            Weapon = new Weapon(winsize, @"game/weapon", _sprite.Lignes, _sprite.Colonnes, _sprite.Position.Width, _sprite.Position.Height);
            InitKeys();
            actualizeSpriteGraphicalBounds();
            actualizeSpritePosition();
            Jump();
            Mana = 1;
            _experience = new ExperienceCounter(ExperienceCounter.Growth.Cuadratic);

            AddAttack(CharacterActions.AttackStunLeft, new Attack(_windowSize, new AnimatedSprite(new Rectangle(0, 0, 400, 400), _windowSize, "sprites/expl_spread_6x6", 6, 6, 30, 1, 32, 1, true), 1500, 0.001f, 3000, 1000, 0.3f));
            AddAttack(CharacterActions.AttackStunRight, new Attack(_windowSize, new AnimatedSprite(new Rectangle(0, 0, 400, 400), _windowSize, "sprites/expl_spread_6x6", 6, 6, 30, 1, 32, 1, true), 1500, 0.001f, 3000, 1000, 0.3f));
            AddAttack(CharacterActions.Attack1Right, new Attack(_windowSize, new AnimatedSprite(new Rectangle(0, 0, 10, 10), _windowSize, "general/vide"), 50, 0.1f, 500, 400, 0.1f));
            AddAttack(CharacterActions.Attack1Left, new Attack(_windowSize, new AnimatedSprite(new Rectangle(0, 0, 10, 10), _windowSize, "general/vide"), 50, 0.1f, 500, 400, 0.1f));
        }
开发者ID:Nicomplex,项目名称:The-Revenge-Of-the-Dark-Side,代码行数:33,代码来源:Personnage.cs


示例19: HeroState

 public HeroState(FSM fsm)
     : base(fsm)
 {
     Hero = (HeroMotion)fsm;
     animator = gameObject.GetComponent<Animator>();
     InputManager = gameObject.GetComponent<InputManager>();
 }
开发者ID:ZeroXFive7,项目名称:NextGenPlatformer,代码行数:7,代码来源:HeroState.cs


示例20: Start

    void Start()
    {
        if (gManager == this)
        {
            isPaused = false;
            iManager = new InputManager(0.1f, 0.2f); // It could be helpful, I guess.
            tagged_objects = GameObject.FindGameObjectsWithTag("Scene_Object");
            scene_objects = new ISceneObject[tagged_objects.Length];
            iManager.Initialize();
            // Initialize the list of scene objects, all of which have ONE ISceneObject component.
            for (int i = 0; i < tagged_objects.Length; i++)
            {
                scene_objects[i] = tagged_objects[i].GetComponent<ISceneObject>(); // Grab all of those scene objects!
            }

            // Initialize all scene objects.
            for (int j = 0; j < scene_objects.Length; j++)
            {
                scene_objects[j].Initialize();
            }
            levelDictionary = new Dictionary<GameState, string>() { { GameState.TLEVELONE, "GMLevel1" },
                                                                    { GameState.TLEVELTWO, "GMLevel2" },
                {GameState.LEVELONE, "Level1" },
                {GameState.LEVELTWO, "Level2" },
                { GameState.LEVELTHREE, "Level3"},
                {GameState.LEVELFOUR, "Level4" } };
            // This will break on regular levels, handle regular levels separately.
            GameManager.gState = levelDictionary.FirstOrDefault(x => x.Value == _testLevelPrefix + SceneManager.GetActiveScene().name).Key;
            if(GameManager.m_Camera != null)
            {
                transform.Find("PauseScreen").gameObject.GetComponent<Canvas>().worldCamera = GameManager.m_Camera;
            }
        }
    }
开发者ID:new-00-0ne,项目名称:System-Purge,代码行数:34,代码来源:GameManager.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# InputMode类代码示例发布时间:2022-05-24
下一篇:
C# InputLayout类代码示例发布时间: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