Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        if (TutorialManager.Instance().GetStep() == 1)
        {
            if (inputMade.TrueForAll(x => x == 1))
            {
                TutorialManager.Instance().NextStep();
            }

            if (Input.GetKeyDown(GameInputManager.GetKeyMapOn("Forward")))
            {
                inputMade[0] = 1;
            }

            if (Input.GetKeyDown(GameInputManager.GetKeyMapOn("Backward")))
            {
                inputMade[1] = 1;
            }

            if (Input.GetKeyDown(GameInputManager.GetKeyMapOn("Left")))
            {
                inputMade[2] = 1;
            }

            if (Input.GetKeyDown(GameInputManager.GetKeyMapOn("Right")))
            {
                inputMade[3] = 1;
            }
        }
    }
    private void PlayerMovement()
    {
        float horizInput = GameInputManager.getAxis(GameInputManager.Axis.Horizontal) * playerSpeed;
        float vertInput  = GameInputManager.getAxis(GameInputManager.Axis.Vertical) * playerSpeed;

        Vector3 fowardMovement;
        Vector3 rightMovement;

        if (!isSprinting)
        {
            fowardMovement = transform.forward * vertInput;
            rightMovement  = transform.right * horizInput;
        }
        else
        {
            fowardMovement = transform.forward * vertInput * sprintMultiplier;
            rightMovement  = transform.right * horizInput * sprintMultiplier;
        }

        if (vertInput != 0 || horizInput != 0)
        {
            isMoving = true;
        }
        else
        {
            isMoving = false;
        }

        charController.SimpleMove(fowardMovement + rightMovement);

        JumpInput();
        SprintInput();
        setAudio();
    }
Beispiel #3
0
 // Changes the Binding of Serving by converting certain aspects so it will be compatible with each other and eventually changing the KeyMap
 public void ChangeBindServe()
 {
     PlayerPrefs.SetString("Serve", Serve.text.ToUpper());
     DefaultServeBind.text = PlayerPrefs.GetString("Serve", "Z");
     KCS = (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Serve", "Z"));
     GameInputManager.SetKeyMap("Serve", KCS);
 }
Beispiel #4
0
    void moveCampQuitUI()
    {
        bool bMove = false;

        if (GameCampQuitUI.instance.IsShow)
        {
            if (GameInputManager.getKeyDown(GameInputCode.Up))
            {
                bMove = true;
            }
            if (GameInputManager.getKeyDown(GameInputCode.Down))
            {
                bMove = true;
            }
            if (GameInputManager.getKeyDown(GameInputCode.Left))
            {
                bMove = true;
            }
            if (GameInputManager.getKeyDown(GameInputCode.Right))
            {
                bMove = true;
            }

            if (!bMove)
            {
                return;
            }

            GameCampQuitUI.instance.showAskUI(!GameCampQuitUI.instance.IsOKAskUI);

            return;
        }
    }
Beispiel #5
0
 public AimingInteractiveObjectActionStateBehaviorInputDataSystem(GameInputManager gameInputManager, InteractiveObjectActionPlayerSystem interactiveObjectActionPlayerSystem,
                                                                  InteractiveObjectActionInherentData firingInteractiveObjectActionInherentData)
 {
     GameInputManager = gameInputManager;
     InteractiveObjectActionPlayerSystem            = interactiveObjectActionPlayerSystem;
     this.firingInteractiveObjectActionInherentData = firingInteractiveObjectActionInherentData;
 }
Beispiel #6
0
 // Changes the Binding of Pouring by converting certain aspects so it will be compatible with each other and eventually changing the KeyMap
 public void ChangeBindPour()
 {
     PlayerPrefs.SetString("Pour", Pour.text.ToUpper());
     DefaultPourBind.text = PlayerPrefs.GetString("Pour", "X");
     KCP = (KeyCode)System.Enum.Parse(typeof(KeyCode), PlayerPrefs.GetString("Pour", "X"));
     GameInputManager.SetKeyMap("Pour", KCP);
 }
Beispiel #7
0
        protected void OnAwake(LevelType levelType)
        {
            new GameLogHandler();

            this.levelType = levelType;
            this._simulatePhysicsTimeSteps = new SimulatePhysicsTimeSteps(this.ManuallyUpdatePhysicsWorld);

            PersistanceManager.Get().Init();
            StartLevelManager.Get().Init();
            if (levelType == LevelType.STARTMENU)
            {
                GameInputManager.Get().Init(CursorLockMode.Confined);
                Cursor.visible = true;
            }
            else
            {
                GameInputManager.Get().Init(CursorLockMode.Locked);
                Cursor.visible = false;
            }

            LevelAvailabilityManager.Get().Init();
            LevelAvailabilityTimelineManager.Get().Init();
            LevelManager.Get().Init(levelType);

            if (this.levelType != LevelType.STARTMENU)
            {
                LevelChunkFXTransitionManager.Get().Init();
                CoreGameSingletonInstances.Coroutiner.StartCoroutine(InitializeTimelinesAtEndOfFrame());
            }
        }
Beispiel #8
0
 public PlayerInputMoveManager(float SpeedMultiplicationFactor, Transform cameraPivotPoint, GameInputManager gameInputManager, Rigidbody playerRigidBody)
     : base(SpeedMultiplicationFactor, playerRigidBody)
 {
     CameraPivotPoint = cameraPivotPoint;
     GameInputManager = gameInputManager;
     this.playerSpeedProcessingInput = ComputePlayerSpeedProcessingInput();
 }
Beispiel #9
0
    void moveUnitUI()
    {
        bool bMove = false;

        bool b = false;

        if (GameInputManager.getKeyDown(GameInputCode.Up))
        {
            bMove = true;
        }

        if (GameInputManager.getKeyDown(GameInputCode.Down))
        {
            b     = true;
            bMove = true;
        }

        if (GameInputManager.getKeyDown(GameInputCode.Left))
        {
            bMove = true;
        }

        if (GameInputManager.getKeyDown(GameInputCode.Right))
        {
            b     = true;
            bMove = true;
        }

        if (!bMove)
        {
            return;
        }

        GameUnitUI.instance.showNextUser(b);
    }
Beispiel #10
0
 void Start()
 {
     instance   = this;
     fullScreen = Screen.fullScreen;
     if (!mainMenu)
     {
         currentUI = GameObject.Find("UIholder");
         currentUI.GetComponent <CanvasScaler>().referenceResolution =
             new Vector2(Camera.main.pixelWidth, Camera.main.pixelHeight);
         paused         = false;
         Time.timeScale = 1.0f;
         pauseMenu.SetActive(paused);
     }
     else
     {
         currentUI = GameObject.Find("MainMenu");
         currentUI.GetComponent <CanvasScaler>().referenceResolution =
             new Vector2(Camera.main.pixelWidth, Camera.main.pixelHeight);
         paused = true;
     }
     if (controlPanel != null)
     {
         controlPanel.SetActive(false);
     }
     if (endGame != null)
     {
         endGame.SetActive(false);
     }
     end = false;
     gameInputManager = GameInputManager.instance;
 }
 void Update()
 {
     if (PlayerButtonTriggerer.CurrentlyInView == this.gameObject && GameInputManager.getKeyDown(GameInputManager.InputType.Interact))
     {
         externalAction();
     }
 }
Beispiel #12
0
 public PlayerSelectionWheelManager(PlayerInteractiveObject PlayerInteractiveObject, GameInputManager gameInputManager,
                                    PlayerActionEntryPoint playerActionEntryPoint)
 {
     GameInputManager                = gameInputManager;
     this.PlayerActionEntryPoint     = playerActionEntryPoint;
     this.PlayerInteractiveObjectRef = PlayerInteractiveObject;
 }
Beispiel #13
0
        public override void Init()
        {
            this.InteractiveGameObject.CreateLogicCollider(InteractiveObjectLogicCollider);
            interactiveObjectTag = new InteractiveObjectTag {
                IsPlayer = true
            };

            PlayerInteractiveObjectInitializerData = PlayerConfigurationGameObject.Get().PlayerGlobalConfiguration.PlayerInteractiveObjectInitializerData;

            #region External Dependencies

            var gameInputManager = GameInputManager.Get();

            #endregion


            var cameraPivotPoint = GameObject.FindGameObjectWithTag(TagConstants.CAMERA_PIVOT_POINT_TAG);

            PlayerInputMoveManager       = new PlayerInputMoveManager(PlayerInteractiveObjectInitializerData.SpeedMultiplicationFactor, cameraPivotPoint.transform, gameInputManager, this.InteractiveGameObject.PhysicsRigidbody);
            PlayerBodyPhysicsEnvironment = new PlayerBodyPhysicsEnvironment(this.InteractiveGameObject.PhysicsRigidbody, this.InteractiveGameObject.PhysicsCollider, PlayerInteractiveObjectInitializerData.MinimumDistanceToStick);
            PlayerSelectionWheelManager  = new PlayerSelectionWheelManager(this, gameInputManager,
                                                                           PlayerActionEntryPoint.Get());

            //Getting persisted position
            PlayerPositionPersistenceManager.Get().Init(this);
            this.InteractiveGameObject.InteractiveGameObjectParent.transform.position = PlayerPositionPersistenceManager.Get().PlayerPositionBeforeLevelLoad.GetPosition();
            this.InteractiveGameObject.InteractiveGameObjectParent.transform.rotation = PlayerPositionPersistenceManager.Get().PlayerPositionBeforeLevelLoad.GetQuaternion();

            this._baseObjectAnimatorPlayableSystem = new BaseObjectAnimatorPlayableSystem(this.AnimatorPlayable, LocomotionAnimationDefinition);
        }
 public void ChangeMappingKey(string keyMap)
 {
     //KeyCode newKeyCode = (KeyCode) System.Enum.Parse(typeof(KeyCode), keyCode) ;
     changingBinding = false;
     GameInputManager.SetKeyMap(keyMap, inputKey);
     panelBinding.SetActive(false);
 }
Beispiel #15
0
 void CheckTools()
 {
     if (GameInputManager.GetKey("SoftRepairTool"))
     {
         List <Collider2D> targets = attackBox.Collisions();
         foreach (Collider2D coll in targets)
         {
             if (coll.GetComponent <Interactable>() != null)
             {
                 coll.GetComponent <Interactable>().OnSoftRepair();
             }
         }
     }
     if (GameInputManager.GetKey("HardRepairTool"))
     {
         List <Collider2D> targets = attackBox.Collisions();
         foreach (Collider2D coll in targets)
         {
             if (coll.GetComponent <Interactable>() != null)
             {
                 coll.GetComponent <Interactable>().OnHardRepair();
             }
         }
     }
 }
Beispiel #16
0
    void CheckBomb()
    {
        if (GameInputManager.GetKeyDown("Bomb"))
        {
            if (bombCooldown < 1)
            {
                Bomb    boom   = Instantiate(bomb).GetComponent <Bomb>();
                Vector3 offset = Vector3.zero;
                switch (GetFacingDirection())
                {
                case 0:
                    offset = Vector3.up;
                    break;

                case 1:
                    offset = Vector3.right;
                    break;

                case 2:
                    offset = Vector3.down;
                    break;

                case 3:
                    offset = Vector3.left;
                    break;
                }
                boom.Move(offset + transform.position + new Vector3(0, -0.5f, 0));
                bombCooldown = 100;
            }
        }
    }
Beispiel #17
0
 void CheckBow()
 {
     if (GameInputManager.GetKeyDown("Bow"))
     {
         if (bowCounter < 1)
         {
             Projectile shot = Instantiate(projectile).GetComponent <Projectile>();
             shot.Move(transform.position);
             if (playerFacing.y > 0)
             {
                 shot.direction     = "Up";
                 transform.position = transform.position + new Vector3(0, -bowKnockback, 0);
             }
             else if (playerFacing.x > 0)
             {
                 shot.direction     = "Right";
                 transform.position = transform.position + new Vector3(-bowKnockback, 0, 0);
             }
             else if (playerFacing.y < 0)
             {
                 shot.direction     = "Down";
                 transform.position = transform.position + new Vector3(0, bowKnockback, 0);
             }
             else if (playerFacing.x < 0)
             {
                 shot.direction     = "Left";
                 transform.position = transform.position + new Vector3(bowKnockback, 0, 0);
             }
             bowCounter = 60;
         }
     }
 }
Beispiel #18
0
 void OnDisable()
 {
     if (instance != null)
     {
         instance = null;
     }
 }
Beispiel #19
0
    protected void Awake()
    {
        singleton = this;

        //---------//
        // Associating each button string with respective InputController event.
        singleton.observedButtons.Add("MapInput", InputController.MapInput);
        singleton.observedButtons.Add("InteractInput", InputController.InteractInput);
        singleton.observedButtons.Add("TabletInput", InputController.TabletInput);
        singleton.observedButtons.Add("ReturnInput", InputController.ReturnInput);
        singleton.observedButtons.Add("PauseInput", InputController.PauseInput);

        singleton.observedAxes.Add("Horizontal", InputController.Horizontal);
        singleton.observedAxes.Add("Vertical", InputController.Vertical);
        singleton.observedAxes.Add("CameraHorizontal", InputController.CameraHorizontal);
        singleton.observedAxes.Add("CameraVertical", InputController.CameraVertical);
        //---------//

        // Associating each button and axis to a new Notifier instance
        foreach (string k in singleton.observedButtons.Keys)
        {
            singleton.inputTable.Add(k, new InputNotifier <string, bool>());
        }
        foreach (string k in singleton.observedAxes.Keys)
        {
            singleton.inputTable.Add(k, new InputNotifier <string, float>());
        }
    }
Beispiel #20
0
        /// <summary>
        /// Carrega conteúdo inicial, comum a todas as cenas de jogo, e registra serviços
        /// úteis capaz de serem utilizados pelos GameObjects
        /// </summary>
        /// <param name="content"></param>
        /// <param name="services"></param>
        public static void LoadContent()
        {
            if (state != GameStates.Unloaded)
            {
                return;
            }

            spriteBatch = new SpriteBatch(GraphicsDevice);

            MainCamera = new DefaultGameCamera(game.GraphicsDevice);
            MainCamera.Initialize();

            Input = new GameInputManager(game, NoActionGameController.Instance);
            Input.Initialize();

            Sound = new SoundManager();

            scenes = new GameScene[]
            {
                new TitleScreenScene(),
                new MapBasedGameScene(5, "maps/lab_map_005", Color.Black),
                new MapBasedGameScene(4, "maps/lab_map_004", Color.Black),
                new CreditsScene()
            };

            PAUSE_PANEL = new SemiTransparentDarkPanel();
            PAUSE_PANEL.LoadContent();

            currentSceneIndex = DEFAULT_FIRST_SCENE;
            state             = GameStates.Ready;
        }
Beispiel #21
0
        protected void OnAwake(LevelType levelType)
        {
            new GameLogHandler();

            this.levelType = levelType;

            PersistanceManager.Get().Init();
            StartLevelManager.Get().Init();
            if (levelType == LevelType.STARTMENU)
            {
                GameInputManager.Get().Init(CursorLockMode.Confined);
            }
            else
            {
                GameInputManager.Get().Init(CursorLockMode.Locked);
            }

            LevelAvailabilityManager.Get().Init();
            LevelAvailabilityTimelineManager.Get().Init();
            LevelManager.Get().Init(levelType);

            if (this.levelType != LevelType.STARTMENU)
            {
                LevelChunkFXTransitionManager.Get().Init();
                CoreGameSingletonInstances.Coroutiner.StartCoroutine(InitializeTimelinesAtEndOfFrame());
            }
        }
Beispiel #22
0
    void moveRPG()
    {
        bool bMove = false;
        bool up    = false;
        bool down  = false;
        bool left  = false;
        bool right = false;

        if (GameInputManager.getKey(GameInputCode.Up))
        {
            bMove = true;
            up    = true;
        }

        if (GameInputManager.getKey(GameInputCode.Down))
        {
            bMove = true;
            down  = true;
        }

        if (GameInputManager.getKey(GameInputCode.Left))
        {
            bMove = true;
            left  = true;
        }

        if (GameInputManager.getKey(GameInputCode.Right))
        {
            bMove = true;
            right = true;
        }

        GameRPGManager.instance.moveTo(bMove);
        GameRPGManager.instance.moveUpdate();

        if (GameBlackUI.instance.IsShow)
        {
            return;
        }

        if (up)
        {
            GameRPGManager.instance.moveTo(GameAnimationDirection.North);
        }

        if (down)
        {
            GameRPGManager.instance.moveTo(GameAnimationDirection.South);
        }

        if (left)
        {
            GameRPGManager.instance.moveTo(GameAnimationDirection.West);
        }

        if (right)
        {
            GameRPGManager.instance.moveTo(GameAnimationDirection.East);
        }
    }
Beispiel #23
0
 void IncreaseStamina()
 {
     if (!PlayerStates.Singleton.IsSprinting && !GameInputManager.GetKey("Sprint") && !GameInputManager.GetKey("Jump") && !PlayerStates.Singleton.IsDead)
     {
         PlayerStates.Singleton.Stamina += PlayerStates.Singleton.StaminaStep;
     }
 }
Beispiel #24
0
    void moveMsgBoxChooseUI()
    {
        bool bMove = false;

        if (GameInputManager.getKeyDown(GameInputCode.Up))
        {
            bMove = true;
        }

        if (GameInputManager.getKeyDown(GameInputCode.Down))
        {
            bMove = true;
        }

        if (GameInputManager.getKeyDown(GameInputCode.Left))
        {
            bMove = true;
        }

        if (GameInputManager.getKeyDown(GameInputCode.Right))
        {
            bMove = true;
        }

        if (!bMove)
        {
            return;
        }

        GameMsgBoxChooseUI.instance.select(!GameMsgBoxChooseUI.instance.IsOK);
    }
Beispiel #25
0
 // Use this for initialization
 void Start()
 {
     gameInputScript = gameObject.GetComponent<GameInputManager>();
     //this.GetComponent<Light> ().intensity = 0;
     gloveActive = false;
     cooldown = 0;
 }
Beispiel #26
0
    // Use this for initialization
    void Start()
    {
        RB = gameObject.transform.GetChild(1).gameObject;
        LB = gameObject.transform.GetChild(2).gameObject;
        LT = gameObject.transform.GetChild(3).gameObject;
        RT = gameObject.transform.GetChild(4).gameObject;

        body = gameObject.transform.GetComponent <Rigidbody>();
        body.maxAngularVelocity = MaxAngularVelocity;

        joints  = GetComponents(typeof(ConfigurableJoint));
        RBjoint = (ConfigurableJoint)joints[0];
        LBjoint = (ConfigurableJoint)joints[1];
        LTjoint = (ConfigurableJoint)joints[2];
        RTjoint = (ConfigurableJoint)joints[3];

        RBobj = RB.GetComponent <playerChildren>();
        LBobj = LB.GetComponent <playerChildren>();
        RTobj = RT.GetComponent <playerChildren>();
        LTobj = LT.GetComponent <playerChildren>();

        RBgrabbing = false;
        LBgrabbing = false;
        RTgrabbing = false;
        LTgrabbing = false;

        buttons          = buttonsTrans.GetComponent <buttonController>();
        gameInputManager = GameInputManager.instance;
    }
Beispiel #27
0
        /// <summary>
        /// /!\ This method must be called before EVERYTHING else in the LateTick update.
        /// </summary>
        protected void BeforeLateTickGameLogic(out float d, out float unscaled)
        {
            GameInputManager.Get().LateTick();
            TimeManagementManager.Get().LateTick();

            d        = TimeManagementManager.Get().GetCurrentDeltaTime();
            unscaled = TimeManagementManager.Get().GetCurrentDeltaTimeUnscaled();
        }
Beispiel #28
0
 void Awake()
 {
     _gameManager           = GetComponent <GameManager>();
     _gameSceneUIManager    = GetComponent <GameSceneUIManager>();
     _gameInputManager      = GetComponent <GameInputManager>();
     _gameSceneScoreManager = GetComponent <GameSceneScoreManager>();
     _gameSceneSpawnManager = GetComponent <GameSceneSpawnManager>();
 }
 protected void OnDisable()
 {
     GameInputManager.Unregister(OnInputEvent);
     if (!IsApplicationQuitting)
     {
         Toolbar.Instance.OnSelectedSlotItemChanged -= CheckCarrying;
     }
 }
    protected void OnEnable()
    {
        GameInputManager.ObserveAxis("Horizontal");
        GameInputManager.ObserveAxis("Vertical");

        GameInputManager.Register(OnInputEvent);
        Toolbar.Instance.OnSelectedSlotItemChanged += CheckCarrying;
    }
Beispiel #31
0
 private void JumpInput()
 {
     if (GameInputManager.getKeyDown(GameInputManager.InputType.Jump) && isJumping != true)
     {
         isJumping = true;
         StartCoroutine(JumpEvent());
     }
 }
Beispiel #32
0
	// Use this for initialization
	void Start () {
		if (!isLocalPlayer)
			return;
		inputManager = FindObjectOfType<GameInputManager> ();
		isHost = inputManager.isHost;
		//Reset ();

		CmdAdd (isHost);
		UpdateInput ();
	}