/////////////////////////////////////////////////////////////////////////////// // Function /////////////////////////////////////////////////////////////////////////////// new void Awake() { base.Awake(); levelName = GameLevel.Battle.ToString(); instance = this; input = GetComponent<GameInput>(); input.enabled = false; }
private void button1_Click(object sender, EventArgs e) { if (waitLabel != null) return; upkeylabel.Text = "Waiting..."; waitKey = GameInput.Up; waitLabel = upkeylabel; }
private void button3_Click(object sender, EventArgs e) { if (waitLabel != null) return; selectkeylabel.Text = "Waiting..."; waitKey = GameInput.Select; waitLabel = selectkeylabel; }
public Grabber(Player player, GameInput gameInput) : base(player,gameInput) { createArcModel(); createMuzzleModel(); icon.setMaterial("hud\\grabber_icon.xmf"); }
public TerrainGun(Player player, GameInput gameInput) : base(player, gameInput) { icon.setMaterial("hud\\terrain_icon.xmf"); ensureType(); generateGhost(); }
public GameMenu(Player parent, GameInput input) : base(parent, input) { weaponModel.isVisible = false; icon.isVisible = false; MenuUi = new Menu(this); MenuUi.isVisible = false; Scene.guis.Add(MenuUi); }
void Awake() { if(instance != null){ Destroy(this.gameObject); return; } instance = this; DontDestroyOnLoad(gameObject); }
public Spawner(Player player, GameInput gameInput) : base(player, gameInput) { template = gameWindow.templateLoader.getTemplate(tempId); generateGhost(); generateGrid(); icon.setMaterial("hud\\spawner_icon.xmf"); }
public void Setup(GameInput.GameButton button) { this.labelName.Text = button.Name; this.keyOne.Text = button.bindingOne.ToString(); this.keyTwo.Text = button.bindingTwo.ToString(); if (this.keyOne.Text == "None") { this.keyOne.Text = " "; } if (this.keyTwo.Text == "None") { this.keyTwo.Text = " "; } }
// LoadContent protected override void LoadContent() { // create the GameInput - UI depends on this GameInput = new GameInput( (int)E_UiButton.Count, (int)E_UiAxis.Count ); // setup the UI's input mappings _UI.SetupControls( GameInput ); // setup the UI with default settings _UI.Startup( this, GameInput ); // add the initial UI screen _UI.Screen.AddScreen( new UI.ScreenTest() ); base.LoadContent(); }
public Player(Scene parent, Vector3 spawnPos, Vector3 viewDir, GameInput gameInput) { Parent = parent; this.gameInput = gameInput; //create hud renderer hud = new Hud(this); parent.guis.Add(hud); Position = spawnPos; PointingDirection = viewDir; upVector = new Vector3(0, 1, 0); zNear = 0.1f; zFar = 100; Shape boxShape = new BoxShape(new JVector(0.5f, 2, 0.5f)); Body = new RigidBody(boxShape); Body.Position = new JVector(Position.X, Position.Y, Position.Z); Body.AllowDeactivation = false; JMatrix mMatrix = JMatrix.Identity; //mBody.SetMassProperties(mMatrix, 2,false); Jitter.Dynamics.Constraints.SingleBody.FixedAngle mConstraint = new Jitter.Dynamics.Constraints.SingleBody.FixedAngle(Body); parent.world.AddConstraint(mConstraint); parent.world.AddBody(Body); viewInfo = new ViewInfo(this); viewInfo.aspect = (float)gameWindow.Width / (float)gameWindow.Height; viewInfo.updateProjectionMatrix(); tools.Add(new GameMenu(this, gameInput)); tools.Add(new Spawner(this, gameInput)); tools.Add(new Grabber(this, gameInput)); tools.Add(new Remover(this, gameInput)); tools.Add(new TerrainGun(this, gameInput)); tool = tools[1]; }
//Vector3 rawRotation;//, rotation; public Tool(Player parent, GameInput gameInput) { Parent = parent; this.gameInput = gameInput; raycastCallback = new RaycastCallback(mRaycastCallback); slot = getSlot(); icon = new GuiElement(this.parent.hud); icon.setSizeRel(new Vector2(256, 128)); iconPos = new Vector2(-0.8f, 0.8f - slot * iconDist); smoothIconPos = iconPos; icon.Position = smoothIconPos; icon.setMaterial("hud\\blank_icon.xmf"); createWeaponModel(); }
// Update is called once per frame void Update() { horizontal = GameInput.GetAxisRaw(GameInput.AxisType.HORIZONTAL); vertical = GameInput.GetAxisRaw(GameInput.AxisType.VERTICAL); if ((horizontal > 0 || vertical > 0) && GetComponent <PlayerInventory>().isPicking) { walkTimer -= Time.deltaTime; if (walkTimer < 0f) { SoundManager.Instance.PlaySound(SoundManager.SoundList.PAS); walkTimer = walkInterval; } if (surBuisson) { surBuissonTimer -= Time.deltaTime; if (surBuissonTimer < 0f) { SoundManager.Instance.PlaySound(SoundManager.SoundList.BUISSON); surBuissonTimer = surBuissonInterval; } } if (surFeuillage) { surFeuillageTimer -= Time.deltaTime; if (surFeuillageTimer < 0f) { SoundManager.Instance.PlaySound(SoundManager.SoundList.FEUILLAGE); surFeuillageTimer = surFeuillageInterval; } } } Vector3 dir = Vector3.Normalize(new Vector3(horizontal, vertical, 0)) * speed; horizontal = dir.x; vertical = dir.y; }
private void applySaveGame(SaveGame save) { Game.knowledge = save.Knowledge; // Models gameInput = new GameInput(); gameDialogue = new DialogueModel(); levelModel = new LevelModel(LevelLoader.Load(save.LevelName, ll)); characterModel = new CharacterModel(levelModel.Avatar); characterModel.character.X = save.X; characterModel.character.Y = save.Y; // Controllers gameInputController = new GameInputController(); gameInputController.SetModel(gameInput); characterController = new CharacterController(); characterController.SetModel(characterModel); characterController.setInput(gameInput); characterController.SetLevel(levelModel); dialogueController = new DialogueController(); dialogueController.setInput(gameInput); dialogueController.SetModel(gameDialogue); dialogueController.SetLevel(levelModel); levelController = new LevelController(); levelController.SetModel(levelModel); levelController.SetInput(gameInput); levelController.SetDialogue(gameDialogue); buffers = new BooleanCanvas[] { new BooleanCanvas(GetWidth(), GetHeight()), new BooleanCanvas(GetWidth(), GetHeight()) }; bufferIndex = 0; }
protected override void OnUpdate() { var posArray = group.ToComponentArray <Transform>(); Entities.ForEach((Entity entity, ref TargetPosition targetPos, ref MoveSpeed moveSpeed, ref LocomotionState curLocoStateObj, ref PosSynchInfo synchInfo) => { if (curLocoStateObj.LocoState == LocomotionState.State.BeHit || curLocoStateObj.LocoState == LocomotionState.State.Dead) { return; } var input = GameInput.GetInstance().JoystickDir; // Debug.Log("input.sqrMagnitude:"+input.sqrMagnitude); if (input.sqrMagnitude > 0) { var forward = SceneMgr.Instance.MainCameraTrans.TransformDirection(Vector3.forward); forward.y = 0; var right = SceneMgr.Instance.MainCameraTrans.TransformDirection(Vector3.right); float3 targetDirection = input.x * right + input.y * forward; targetDirection.y = 0; targetDirection = Vector3.Normalize(targetDirection); float3 curPos = posArray[0].localPosition; var speed = moveSpeed.Value; float3 newTargetPos; if (speed > 0) { newTargetPos = curPos + targetDirection * (speed / GameConst.SpeedFactor * 0.10f);//延着方向前进0.10秒为目标坐标 } else { newTargetPos = curPos; } newTargetPos.y = targetPos.Value.y; targetPos.Value = newTargetPos; // Debug.Log("targetDirection : "+newTargetPos.x+" "+newTargetPos.y+" "+newTargetPos.z); } else { targetPos.Value = posArray[0].localPosition; } }); }
protected override void OnUpdate() { float dt = Time.deltaTime; var targetPosArray = group.GetComponentDataArray <TargetPosition>(); var posArray = group.GetComponentArray <Transform>(); var moveSpeedArray = group.GetComponentDataArray <MoveSpeed>(); var input = GameInput.GetInstance().JoystickDir; if (input.sqrMagnitude > 0) { var forward = SceneMgr.Instance.MainCameraTrans.TransformDirection(Vector3.forward); forward.y = 0; var right = SceneMgr.Instance.MainCameraTrans.TransformDirection(Vector3.right); float3 targetDirection = input.x * right + input.y * forward; targetDirection.y = 0; targetDirection = Vector3.Normalize(targetDirection); float3 curPos = posArray[0].localPosition; var speed = moveSpeedArray[0].Value; var newTargetPos = new TargetPosition(); if (speed > 0) { newTargetPos.Value = curPos + targetDirection * (speed / GameConst.SpeedFactor * 0.10f);//延着方向前进0.10秒为目标坐标 } else { newTargetPos.Value = curPos; } newTargetPos.Value.y = targetPosArray[0].Value.y; // Debug.Log("targetDirection : "+newTargetPos.Value.x+" "+newTargetPos.Value.y+" "+newTargetPos.Value.z); targetPosArray[0] = newTargetPos; } else { var newTargetPos = new TargetPosition { Value = posArray[0].localPosition }; targetPosArray[0] = newTargetPos; } }
private void Update() { if (this.isActive) { if (GameInput.GetButtonDown(GameInput.Button.PDA) && !Player.main.GetPDA().isOpen&& !Builder.isPlacing) { if (energyMixin.charge > 0f) { Player.main.GetPDA().Close(); uGUI_BuilderMenu.Show(); handleInputFrame = Time.frameCount; } } if (Builder.isPlacing) { if (Player.main.GetLeftHandDown()) { UWE.Utils.lockCursor = true; } if (UWE.Utils.lockCursor && GameInput.GetButtonDown(GameInput.Button.AltTool)) { if (Builder.TryPlace()) { Builder.End(); } } else if (this.handleInputFrame != Time.frameCount && GameInput.GetButtonDown(GameInput.Button.Deconstruct)) { Builder.End(); } FPSInputModule.current.EscapeMenu(); Builder.Update(); } if (!uGUI_BuilderMenu.IsOpen() && !Builder.isPlacing) { this.UpdateText(); this.HandleInput(); } } }
public void Update() { if (laserCannonEnabled) { if (energyMixin.charge < energyMixin.capacity * 0.1f) { if (idleTimer > 0f) { toggle = false; shoot = false; repeat = false; idleTimer = Mathf.Max(0f, idleTimer - Time.deltaTime); HandReticle.main.SetInteractText("Warning!\nLow Power!", "Laser Cannon Disabled!", false, false, HandReticle.Hand.None); Modules.SetInteractColor(Modules.Colors.Red); } else { idleTimer = 3; seamoth.SlotKeyDown(slotID); } } if (toggle) { if (GameInput.GetButtonDown(GameInput.Button.LeftHand)) { shoot = true; } if (GameInput.GetButtonUp(GameInput.Button.LeftHand)) { shoot = false; laserBeam.SetActive(false); } if (shoot) { RepeatCycle(Time.time, 0.4f); } } } }
void Update() { if (this.rigidbody.position.z > 1.4f && this.rigidbody.position.z < 1.90f) { Properties.S_CantakeInputs = true; if (GameInput.Get() != null) { GameInput.Get().m_LineCrossed = false; } // Debug.Log("I am checking for puck position here" + this.rigidbody.position.z); } else { // Debug.Log("Stopping the inputs since puck is not in the input zone" + this.rigidbody.position.z); Properties.S_CantakeInputs = false; if (GameInput.Get() != null) { GameInput.Get().m_LineCrossed = true; } } }
void RotateEnemy(RotateType rotateType, float dRotate, float velocityX) { float dirX = 0; switch (rotateType) { case RotateType.Player: { dirX = GameManager.player.transform.position.x - transform.position.x; } break; case RotateType.MoveDir: { dirX = velocityX; } break; case RotateType.Mouse: { Vector2 difference = GameInput.GetDirToMouse(transform.position); float rotZ = difference == Vector2.zero ? 0 : Mathf.Atan2(difference.y, difference.x) * Mathf.Rad2Deg; transform.localRotation = Quaternion.Euler(0f, 0f, (difference.x >= 0 ? rotZ : 180f - rotZ) * transform.up.y); } break; case RotateType.MouseX: { dirX = GameInput.GetDirToMouse(transform.position).x; } break; case RotateType.Linear: { transform.Rotate(0, 0, dRotate * Time.deltaTime); } break; } if (dirX != 0 && Mathf.Sign(dirX) != Mathf.Sign(transform.right.x)) { transform.Rotate(0, 180, 0); } }
public async Task UpdateAsync(int id, GameInput gameInput) { try { ValidateGameInput(gameInput); var game = await repository.FindAsync(id); if (game == null) { throw new NotFoundException(String.Format(GameNotFoundMessage, id)); } game.Title = gameInput.Title; game.IsBorrowed = gameInput.IsBorrowed; await repository.UpdateAsync(id, game); } catch (Exception exception) { throw new GameUsecaseException(FailureUpdatingGameDataMessage, exception); } }
public async Task <GameOutput> CreateAsync(GameInput gameInput) { try { ValidateGameInput(gameInput); var game = new Game { Title = gameInput.Title, IsBorrowed = gameInput.IsBorrowed }; await repository.CreateAsync(game); var gameOutput = presenter.ToOutput(game); return(gameOutput); } catch (Exception exception) { throw new GameUsecaseException(FailureCreatingGameDataMessage, exception); } }
public void AttemptBlink(Shark shark) { if (!shark.energyInterface.hasCharge && GameModeUtils.RequiresPower()) { return; } Vector3 targetPos = Vector3.zero; if (GameInput.GetMoveDirection().magnitude > 0f) { targetPos = shark.transform.position + shark.useRigidbody.velocity.normalized * 25f; } else { targetPos = shark.transform.position + shark.transform.forward * 25f; } targetPos.y = Mathf.Clamp(targetPos.y, Ocean.main.GetOceanLevel() - 3000f, Ocean.main.GetOceanLevel()); var hits = Physics.RaycastAll(shark.transform.position, shark.useRigidbody.velocity.normalized, 30f); foreach (RaycastHit hit in hits) { if (hit.transform.GetComponentInParent <Shark>()) { continue; } targetPos = hit.point + hit.normal.normalized * 5f; break; } shark.transform.position = targetPos; shark.fxControl.blinkFX.Play(true); Utils.PlayFMODAsset(blinkSound, transform); }
public IActionResult Put(string id, [FromBody] GameInput model) { _logger.LogDebug($"Updating a game with id {id}"); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var game = _gamesRepository.GetById(id); if (game == null) { return(NotFound()); } model.MapToGame(game); _gamesRepository.Update(game); return(Ok(game.WrapData())); }
private void UpdateNew() { if (!GameState.IsTransitionInProgress) { this.UpdateTimeScale(); } if (GameUtilities.Instance.UIHelper_KeyInputAvailable) { if (GameInput.GetControlDown(MappedControl.RESTORE_SPEED, true)) { this.TimeScale = this.NormalTime; } else if (GameInput.GetControlDown(MappedControl.SLOW_TOGGLE, true)) { this.ToggleSlow(); } else if (GameInput.GetControlDown(MappedControl.FAST_TOGGLE, true)) { this.ToggleFast(); } } }
private static void Init() { if (gameInput == null) { gameInput = new GameInput(); //Console gameInput.Console.ToggleConsole.performed += OnToggleConsole; gameInput.Console.AutoComplete.performed += OnAutoComplete; gameInput.Console.HistoryUp.performed += OnHistoryUp; gameInput.Console.HistoryDown.performed += OnHistoryDown; gameInput.Console.SubmitInput.performed += OnSubmitInput; //MenuController gameInput.MenuController.Close.performed += OnMenuClose; //StartVideo gameInput.StartVideo.Skip.performed += OnStartVideoSkip; //Debug menu gameInput.DebugMenu.ToggleMenu.performed += OnDebugMenuToggle; //Player gameInput.Player.ScoreBoard.performed += OnPlayerScoreBoard; gameInput.Player.Suicide.performed += OnPlayerSuicide; gameInput.Player.Jump.performed += OnPlayerJump; gameInput.Player.Pause.performed += OnPlayerPause; gameInput.Player.WeaponSelection.performed += OnPlayerWeaponSelection; gameInput.Player.ShootWeapon.performed += OnPlayerWeaponShoot; gameInput.Player.ReloadWeapon.performed += OnPlayerReloadWeapon; //Chat gameInput.Chat.SubmitChat.performed += OnChatSubmit; gameInput.Chat.ToggleChat.performed += OnChatToggle; Application.quitting += ShutdownInput; } }
public void Update() { if (!canUpdate) { return; } GameInput.Update(); // Move the cursor if (GameInput.GetScrollUpButtonDown(playerNumber)) { tower.MoveUp(); } else if (GameInput.GetScrollDownButtonDown(playerNumber)) { tower.MoveDown(); } if (GameInput.GetScrollLeftButtonDown(playerNumber)) { tower.MoveLeft(); } else if (GameInput.GetScrollRightButtonDown(playerNumber)) { tower.MoveRight(); } // Check for actions for (int i = 0; i < tribes.Length; ++i) { if (GameInput.GetTribeButtonDown(i, playerNumber)) { tower.PerformAction(tribes[i]); } } CheckTribeUnitLimits(); }
void GetDirectionFromInput() { float inputValX = GameInput.GetHorizontal(pCode); float inputValY = GameInput.GetVertical(pCode); if (inputValX < 0) { idleX = -1; directionX = -1; } else if (inputValX > 0) { idleX = 1; directionX = 1; } if (inputValY < 0) { directionY = -1; if (inputValX == 0) { directionX = 0; } } else if (inputValY > 0) { directionY = 1; if (inputValX == 0) { directionX = 0; } } else { directionY = 0; directionX = idleX; } }
// Token: 0x06002B9E RID: 11166 RVA: 0x001043C0 File Offset: 0x001025C0 public static void ShowRotationControlsHint() { GameInput.Device primaryDevice = GameInput.GetPrimaryDevice(); int numBindingSets = GameInput.GetNumBindingSets(); string text = string.Empty; string text2 = string.Empty; for (int i = 0; i < numBindingSets; i++) { string binding = GameInput.GetBinding(primaryDevice, MultiplayerBuilder.buttonRotateCW, (GameInput.BindingSet)i); if (!string.IsNullOrEmpty(binding)) { if (text.Length > 0) { text += ", "; } text += Language.main.Get(binding); } string binding2 = GameInput.GetBinding(primaryDevice, MultiplayerBuilder.buttonRotateCCW, (GameInput.BindingSet)i); if (!string.IsNullOrEmpty(binding2)) { if (text2.Length > 0) { text2 += ", "; } text2 += Language.main.Get(binding2); } } if (text.Length > 0 || text2.Length > 0) { string format = Language.main.GetFormat("GhostRotateInputHint", new object[] { text, text2 }); Console.WriteLine(format, default(Vector3)); } }
public Hit RegisterHit(InputType inputType, GameInput gameInput) { var time = clock.CurrentTime; // Update currently held inputs switch (inputType) { case InputType.Pressed: if (downSince.ContainsKey(gameInput) && !double.IsNaN(downSince[gameInput])) { Logger.Log($"{gameInput} is already down!", level: LogLevel.Debug); } downSince[gameInput] = time; break; case InputType.Released: if (downSince.ContainsKey(gameInput) && double.IsNaN(downSince[gameInput])) { Logger.Log($"{gameInput} is already up!", level: LogLevel.Debug); } downSince[gameInput] = double.NaN; break; default: throw new ArgumentOutOfRangeException(nameof(inputType), inputType, null); } var pressType = getPressType(gameInput, time); Logger.Log($"{gameInput} {inputType} @ {time}, {pressType}"); return(new Hit { Judgement = Judgement.CoolPlus, OffsetMilliseconds = TimingWindows.CoolPlus, CorrectButton = true, }); }
public static void ToggleWalkMode() { if (UIWindowManager.KeyInputAvailable) { if (GameInput.GetControlUp(MappedControl.Deprecated_CHANT_EDITOR)) { WalkMode = !WalkMode; string msg; Color color; if (WalkMode) { msg = "It is a nice day for a walk"; color = Color.green; } else { msg = "Time to move. We can sight see later!"; color = Color.red; } Console.AddMessage(msg, color); } } }
private static void RegisterNewButton(string name, string key, Button button, Device device) { var bind = new Tuple <Device, Button, string>(device, button, key); if (RegisteredButtons.Contains(bind)) { return; } RegisteredButtons.Add(bind); LanguageHandler.SetLanguageLine($"Option{name}", name); Language.main.LoadLanguageFile(Language.main.GetCurrentLanguage()); GameInput.AddKeyInput(name, KeyCodeUtils.StringToKeyCode(key), device); GameInput.instance.Initialize(); for (int i = 0; i < GameInput.numDevices; i++) { GameInput.SetupDefaultBindings((GameInput.Device)i); } foreach (Tuple <Device, Button, string> binding in RegisteredButtons) { GameInput.SafeSetBinding(binding.Item1, binding.Item2, BindingSet.Primary, binding.Item3); } }
void Start() { if (!gameInput) { gameInput = GetComponent <GameInput>(); } if (!ledgeCol) { ledgeCol = GetComponent <LedgeColliding>(); } if (!jump) { jump = GetComponent <Jump>(); } if (!gravity) { gravity = GetComponent <Gravity>(); } if (!rigidbody) { rigidbody = GetComponent <Rigidbody>(); } }
static bool Prefix(uGUI_OptionsPanel __instance) { __instance.AddGeneralTab(); __instance.AddGraphicsTab(); if (GameInput.IsKeyboardAvailable()) { __instance.AddKeyboardTab(); } if (GameInput.IsControllerAvailable()) { __instance.AddControllerTab(); } __instance.AddAccessibilityTab(); if (!PlatformUtils.isConsolePlatform) { __instance.AddTroubleshootingTab(); } if (__instance != null) { AddJukeBoxTab(__instance); } return(false); }
public virtual void CheckShooting() { if (GameInput.GetPlayerShooting(character.charact) /*&& gun == 1*/) { if (timer >= timeBetweenBullet) { GameObject baladisparada = (GameObject)Instantiate(bala, bala.transform.position, bala.transform.rotation); baladisparada.transform.RotateAround(baladisparada.transform.position, Vector3.forward, Random.Range(-dispersion, dispersion)); baladisparada.SetActive(true); if (character.charact == Personaje.Pjs.PJ1) { baladisparada.layer = LayerMask.NameToLayer("ShotsPlayer1"); } else { baladisparada.layer = LayerMask.NameToLayer("ShotsPlayer2"); } character.SetRecoil(recoil, recoilMagnitude); timer = 0; CheckAmmo(); } } }
public void ExecuteFunction() { if (Taiyou.TaiyouGlobal.PlayerObj.PlayerIsDead) { return; } if (CallEventWhenColide) { if (!TileColisionActionToggle && !TileScriptActionKey) { TileColisionActionToggle = true; Taiyou.Event.TriggerEvent(EventToCallWhenColide); } if (TileScriptActionKey) { if (GameInput.GetInputState("ACTION_KEY", ShowInViewer: true)) { Taiyou.Event.TriggerEvent(EventToCallWhenColide); } } } }
void Start() { if (!ledgeCol) { ledgeCol = GetComponent <LedgeColliding>(); } if (!jump) { jump = GetComponent <Jump>(); } if (!gameInput) { gameInput = GetComponent <GameInput>(); } if (!rigidbody) { rigidbody = GetComponent <Rigidbody>(); } if (!cameraMovement) { cameraMovement = GetComponent <CameraMovement>(); } }
void Fire() { if (IsFireable() && GameInput.GetMissle(pCode)) { if (missileFireSFX != null && sfx != null && lockedEnemies.Count > 0) { sfx.PlayOneShot(missileFireSFX); } foreach (GameObject target in lockedEnemies) { GameObject missile = Instantiate(missilePrefab, this.transform); PlayerMissile pm = missile.transform.GetComponent <PlayerMissile>(); ProjectileWhoShoot who = missile.transform.GetComponent <ProjectileWhoShoot>(); pm.SetTarget(target); who.who = transform.gameObject; missile.transform.SetParent(null); } lockedEnemies.Clear(); } }
private void Update() { if (MainCamera.ScreenPointRaycast(GameInput.position, out hitInfo, 1 << layer)) { if (GameInput.BeginTouch()) { Draggable drag = hitInfo.collider.GetComponent <Draggable>(); if (drag) { dragStart = hitInfo.point; joint = gameObject.AddComponent <ConfigurableJoint>(); joint.xMotion = ConfigurableJointMotion.Locked; joint.yMotion = ConfigurableJointMotion.Locked; joint.zMotion = ConfigurableJointMotion.Locked; joint.connectedBody = drag.rigid; } } } if (GameInput.EndTouch()) { Destroy(joint); } }
internal static void InitSLOTKEYS() { SLOTKEYS.Clear(); SLOTKEYSLIST.Clear(); SLOTKEYS.Add("Slot1", GameInput.GetBindingName(GameInput.Button.Slot1, GameInput.BindingSet.Primary)); SLOTKEYS.Add("Slot2", GameInput.GetBindingName(GameInput.Button.Slot2, GameInput.BindingSet.Primary)); SLOTKEYS.Add("Slot3", GameInput.GetBindingName(GameInput.Button.Slot3, GameInput.BindingSet.Primary)); SLOTKEYS.Add("Slot4", GameInput.GetBindingName(GameInput.Button.Slot4, GameInput.BindingSet.Primary)); SLOTKEYS.Add("Slot5", GameInput.GetBindingName(GameInput.Button.Slot5, GameInput.BindingSet.Primary)); SLOTKEYS.Add("Slot6", InputHelper.GetKeyCodeAsInputName(KEYBINDINGS[SECTION_HOTKEYS[2]])); SLOTKEYS.Add("Slot7", InputHelper.GetKeyCodeAsInputName(KEYBINDINGS[SECTION_HOTKEYS[3]])); SLOTKEYS.Add("Slot8", InputHelper.GetKeyCodeAsInputName(KEYBINDINGS[SECTION_HOTKEYS[4]])); SLOTKEYS.Add("Slot9", InputHelper.GetKeyCodeAsInputName(KEYBINDINGS[SECTION_HOTKEYS[5]])); SLOTKEYS.Add("Slot10", InputHelper.GetKeyCodeAsInputName(KEYBINDINGS[SECTION_HOTKEYS[6]])); SLOTKEYS.Add("Slot11", InputHelper.GetKeyCodeAsInputName(KEYBINDINGS[SECTION_HOTKEYS[7]])); SLOTKEYS.Add("Slot12", InputHelper.GetKeyCodeAsInputName(KEYBINDINGS[SECTION_HOTKEYS[8]])); foreach (KeyValuePair <string, string> kvp in SLOTKEYS) { SLOTKEYSLIST.Add(kvp.Value); } }
private static bool IsLaunchReadyStandalone(GameInput inputHandler) { if (Input.GetMouseButtonDown(LeftMouseButtonKey)) { inputHandler.ResetInput(); inputHandler.isLaunching = true; } else if (inputHandler.IsInputTimerOver || Input.GetMouseButtonUp(LeftMouseButtonKey)) { return(inputHandler.isLaunching); } else { Vector3 NewInputPosition = Input.mousePosition; float Delta = (NewInputPosition.y - inputHandler.lastInputPosition.y) * inputHandler.launchData.ForceMultiplier; inputHandler.accumulatedForce += Mathf.Max(Delta, 0.0f); inputHandler.lastInputPosition = NewInputPosition; } return(false); }
public static GameInput getInstance() { if(GameInput.instance == null) { GameInput.instance = GameObject.Find("GameRoot").GetComponent<GameInput>(); } return(GameInput.instance); }
private bool KeyVal(GameInput key) { return (!Paused && activeKeys.ContainsKey(key))? activeKeys[key] : false; }
private void HandleOnSwipe( GameInput.Direction direction ) { if( mGameStatus == State.Game ) { switch( direction ) { case GameInput.Direction.Left: mPlayerCharacter.MoveLeft(); break; case GameInput.Direction.Right: mPlayerCharacter.MoveRight(); break; } } }
protected override void OnLoad(System.EventArgs e) { //generate stopwatch sw = new Stopwatch(); //set size of the render virtual_size = new Vector2(1920, 1080); state = new GameState(); string versionOpenGL = GL.GetString(StringName.Version); log(versionOpenGL); // make the Coursor disapear Cursor.Hide(); // center it on the window Cursor.Position = new Point( (Bounds.Left + Bounds.Right) / 2, (Bounds.Top + Bounds.Bottom) / 2); // other state GL.ClearColor(System.Drawing.Color.Black); VSync = VSyncMode.On; screenSize = new Vector2(Width, Height); // create instances of necessary objects textureLoader = new TextureLoader(this); framebufferCreator = new FramebufferCreator(this); meshLoader = new MeshLoader(this); shaderLoader = new ShaderLoader(this); materialLoader = new MaterialLoader(this); templateLoader = new TemplateLoader(this); mScene = new Scene(this); // create gameInput gameInput = new GameInput(mScene, Keyboard, Mouse); // set files for displaying loading screen shaderLoader.fromXmlFile("shaders\\composite.xsp"); shaderLoader.fromTextFile("shaders\\composite.vs", "shaders\\splash_shader.fs"); meshLoader.fromObj("models\\sprite_plane.obj"); textureLoader.fromFile("materials\\ultra_engine_back.png",true); textureLoader.fromFile("materials\\ultra_engine_back_h.png",true); materialLoader.fromXmlFile("materials\\composite.xmf"); //loading noise manualy so we can disable multisampling textureLoader.fromFile("materials\\noise_pixel.png", false); // load files for loading screen textureLoader.LoadTextures(); meshLoader.loadMeshes(); shaderLoader.loadShaders(); materialLoader.loadMaterials(); // setup 2d filter (loading screen) splashFilter2d = new Quad2d(this); // set time to zero spawnTime = get_time(); }
/** Reset the ball position and start again */ public void NewGame() { PlayerPaddle = new Paddle(this); AiPaddle = new Paddle(this); Ball = new Ball(this); Field = new Field(this, Camera()); Sparkle = new Sparkle(this); RainbowTrail = new RainbowTrail(this); Flare = new Ps.Model.Object.Flare(this); Collectables = new Collectables(this); /* actions */ SetupActions(); _input = new GameInput(this); Game.SoundReset(); // reload /* Set initial paddle positions */ PlayerPaddle.Position[0] = 0f; PlayerPaddle.Position[1] = Field.Bounds[1] + nLayout.DistanceInWorld(14f, nAxis.Y, _camera);; AiPaddle.Position[0] = 0f; AiPaddle.Position[1] = Field.Bounds[3] - AiPaddle.Size[1] - nLayout.DistanceInWorld(7f, nAxis.Y, _camera); var direction = new nGLine() { P1 = new float[2] { 0, 0 }, P2 = new float[2] { nRand.Float(0f, 1f), nRand.Float(1f, 0.3f) } }; var unit = direction.Unit; Ball.Position[0] = 0; Ball.Position[1] = 0; Ball.Velocity[0] = unit[0] * 35f; Ball.Velocity[1] = unit[1] * 35f; /* reset paddles */ AiPaddle.Ai = new EasyAiProfile(); AiPaddle.Speed = AiPaddle.Ai.Speed; PlayerPaddle.Speed = Config.PlayerSpeed; AiPaddle.Position[0] = 0; PlayerPaddle.Position[0] = 0; /* ai */ Activated = false; Camera().Pipe.Drawables.Clear(); Camera().Pipe.Render(); }
// SetupControls public static void SetupControls( GameInput gameInput ) { for ( int i = 0; i < GameInput.NumPads; ++i ) SetupControls( gameInput.GetInput( i ) ); }
public Remover(Player parent, GameInput input) : base(parent, input) { icon.setMaterial("hud\\remover_icon.xmf"); createMuzzleModel(); }
public GameInputEventArgs(GameInput input, bool pressed) { Input = input; Pressed = pressed; }
private void Awake() { _instance = this; }
public Game(DrawDeck drawDeck, GameInput input, IEndCondition endCondition) { DrawDeck = drawDeck; Input = input; _endCondition = endCondition; }
protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); background = Content.Load<Texture2D>("background"); projectileTexture = Content.Load<Texture2D>("projectile"); cylonTexture = Content.Load<Texture2D>("CylonRaider"); ship = new Entity(new Vector2(400.0f, 300.0f), Content.Load<Texture2D>("ViperMK2.1s"), 0.0f, 0.0f); input = new WASDKeyboardInputController(); input += new CursorKeyboardInputController (); int mul = 0; for (int j = 0; j < 3; j++) { for (int i = 0; i < 15; i++) { cylonRaiders.Add(new Entity(new Vector2(350.0f * mul, 400.0f * mul), cylonTexture, 0.0f, 10.0f)); } mul += 100; } currentWeapon = new Blaster(projectileTexture); }
public static void Startup( Game game, GameInput gameInput, UI.Settings settings ) { _UI.Settings = settings; _UI.Game = game; _UI.Content = new ContentManager( game.Services, "Content" ); _UI.PrimaryPad = -1; _UI.GameInput = gameInput; _UI.Texture = new UI.TextureManager(); _UI.Effect = new UI.EffectManager(); _UI.Sprite = new UI.SpriteManager(); _UI.Font = new UI.FontManager(); _UI.Screen = new UI.ScreenManager(); _UI.Store_Color = new UI.Store< UI.SpriteColors >( Color.Magenta ); _UI.Store_Timeline = new UI.Store< UI.Timeline >(); _UI.Store_Texture = new UI.Store< UI.SpriteTexture >( new UI.SpriteTexture( "null", 0.0f, 0.0f, 1.0f, 1.0f ) ); _UI.Store_FontStyle = new UI.Store< UI.FontStyle >(); _UI.Store_FontEffect = new UI.Store< UI.FontEffect >(); _UI.Store_FontIcon = new UI.Store_FontIcon(); _UI.Store_Widget = new UI.Store< UI.WidgetBase >(); _UI.Store_RenderState = new UI.Store< UI.RenderState >( new UI.RenderState( (int)UI.E_Effect.MultiTexture1, UI.E_BlendState.AlphaBlend ) ); _UI.Store_BlendState = new UI.Store< BlendState >(); _UI.Store_DepthStencilState = new UI.Store< DepthStencilState >(); _UI.Store_RasterizerState = new UI.Store< RasterizerState >(); _UI.Camera2D = new UI.CameraSettings2D(); _UI.Camera3D = new UI.CameraSettings3D(); PresentationParameters pp = game.GraphicsDevice.PresentationParameters; _UI.SX = pp.BackBufferWidth; _UI.SY = pp.BackBufferHeight; _UI.YT = 0.0f; _UI.YM = _UI.YT + ( _UI.SY * 0.5f ); _UI.YB = _UI.YT + _UI.SY; _UI.XL = 0.0f; _UI.XM = _UI.XL + ( _UI.SX * 0.5f ); _UI.XR = _UI.XL + _UI.SX; float safeArea = settings.Screen_SafeAreaSize; float offsetHalf = ( 1.0f - safeArea ) * 0.5f; _UI.SSY = _UI.SY * safeArea; _UI.SSX = _UI.SX * safeArea; _UI.SYT = _UI.SY * offsetHalf; _UI.SYM = _UI.SYT + ( _UI.SSY * 0.5f ); _UI.SYB = _UI.SYT + _UI.SSY; _UI.SXL = _UI.SX * offsetHalf; _UI.SXM = _UI.SXL + ( _UI.SSX * 0.5f ); _UI.SXR = _UI.SXL + _UI.SSX; _UI.AutoRepeatDelay = 0.5f; _UI.AutoRepeatRepeat = 0.25f; }
// Startup public static void Startup( Game game, GameInput gameInput ) { Startup( game, gameInput, new UI.Settings() ); // default settings }
private void button8_Click(object sender, EventArgs e) { if (waitLabel != null) return; leftkeylabel.Text = "Waiting..."; waitKey = GameInput.Left; waitLabel = leftkeylabel; }
public void setTrigger(string type, string name, List<string> parameterList) { this.name = name; // converts firstl etter to Upper character ( because the classes are named with Upper at start ) // check if its input or timer, those are protected calsses so our classes are different than the users classes conversion takes place type = char.ToUpper(type[0]) + type.Substring(1); if( type == "Input") { type = "GameInput"; } else if ( type == "Timer") { type = "GameTimer"; } // check if type of trigger exists if (Enum.IsDefined(typeof(TriggerTypes), type)) { // adds the current type of the trigger to the wanted type ( for easy acces ) triggerType = (TriggerTypes)Enum.Parse(typeof(TriggerTypes), type); switch(triggerType) { case TriggerTypes.GameInput: // checks if key is valid, if not return null and if count is 2. if (parameterList.Count == 2 ) { GameInput gameInput = new GameInput(parameterList[1]); gameInput.name = name; trigger = (object)gameInput; } else { CodeInputHandler.abortPlay("type failed ! check your gameinput keyname -49 trigger.cs"); } break; case TriggerTypes.Loop: if (parameterList.Count == 2) { Loop loop = new Loop(parameterList[1]); loop.name = name; trigger = (object)loop; } else { CodeInputHandler.abortPlay("type failed ! check your gameinput keyname -49 trigger.cs"); } break; case TriggerTypes.Collision: Debug.Log ("does get called 77 @ trigger "); Collision collision = new Collision(); collision.name = name; // set the variables from parameters trigger = (object)collision; break; case TriggerTypes.Timer: GameTimer timer = new GameTimer(); // set the variables from parameters trigger = (object)timer; break; default : CodeInputHandler.abortPlay("type failed !check your enum cases - 70 trigger.cs"); return; } TriggerHandler.triggerDictionary.Add(name,trigger); } else { // type is not one we know. CodeInputHandler.abortPlay("type failed ! check your trigger type - 82 trigger.cs "); } }
private void button5_Click(object sender, EventArgs e) { if (waitLabel != null) return; rightkeylabel.Text = "Waiting..."; waitKey = GameInput.Right; waitLabel = rightkeylabel; }
public void setInput(GameInput gameInput) { /* tool.gameInput = gameInput; foreach (var curTool in tools) { curTool.gameInput = gameInput; } */ this.gameInput = gameInput; }
Matrix world, view, projection; // Our projection matrix #endregion Fields #region Constructors public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; // Lists cubeMaps = new List<TextureCube>(); balls = new List<ball>(); holes = new List<hole>(); m_players = new List<Player>(); // Matrices & vectors world = Matrix.Identity; projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45f), (float)iWindowWidth / (float)iWindowHeight, 0.001f, 100); viewPos = new float[2]; viewTarget = new Vector3(); viewVector = new Vector3(); // Utility classes gi = new GameInput(ref graphics, ref balls, ref m_players); gr = new GameRules(ref gi, ref balls, ref m_players); gl = new GameLogic(ref holes, ref balls, ref m_players, ref gr); menuRotater = 0f; }