void Awake() { previousInput = new PlayerInput(0, 0); // Get all input sources that are defined sources = Reflector.InstantiateAll<PlayerInputSource>(); }
// Use this for initialization void Start() { m_PlayerCombos = FindObjectsOfType<PlayerCombo>(); m_ComboPowerManager = FindObjectOfType<ComboPowerManager>(); m_Input = GetComponent<PlayerInput>(); }
void Update() { var input = PlayerInput.None; // Detect the current input of the Horizontal axis, then // broadcast a state update for the player as needed. // Do this on each frame to make sure the state is always // set properly based on the current user input. var horizontal = UnityEngine.Input.GetAxis("Horizontal"); if(Math.Abs(horizontal) > float.Epsilon) { input |= horizontal < 0 ? PlayerInput.Left : PlayerInput.Right; } var jump = UnityEngine.Input.GetButton("Jump"); if (jump) { input |= PlayerInput.Jump; } var fire = UnityEngine.Input.GetButton("Fire1"); if (fire) { input |= PlayerInput.Fire; } Input = input; }
// Use this for initialization void Start() { _ui = GameObject.Find("Keys"); _input = new PlayerInput(); _input.Reset (); _controller = this.GetComponent<PlayerPhysics>(); }
// Update is called once per frame void Update() { // Retrieve our current WASD or Arrow Key input // Using GetAxisRaw removes any kind of gravity or filtering being applied to the input // Ensuring that we are getting either -1, 0 or 1 Vector3 moveInput = new Vector3 (Input.GetAxisRaw ("Horizontal"), 0, Input.GetAxisRaw ("Vertical")); Vector2 mouseInput = new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y")); Vector2 rightStickInput = new Vector2 (Input.GetAxisRaw ("RightH"), Input.GetAxisRaw ("RightV")); // pass rightStick values in place of mouse when non-zero mouseInput.x = rightStickInput.x != 0 ? rightStickInput.x * RightStickMultiplier.x : mouseInput.x; mouseInput.y = rightStickInput.y != 0 ? rightStickInput.y * RightStickMultiplier.y : mouseInput.y; float zoomInput = Input.GetAxisRaw("Mouse ScrollWheel"); bool jumpInput = Input.GetButtonDown("Jump"); bool shootInput = Input.GetButtonDown ("Shoot"); Current = new PlayerInput() { MoveInput = moveInput, MouseInput = mouseInput, ZoomInput = zoomInput, JumpInput = jumpInput, ShootInput = shootInput }; }
void Awake() { capsule = GetComponent<CapsuleCollider>(); grabTriggerCol = GetComponent<BoxCollider>(); anim = GetComponent<Animator> (); _charStatus = GetComponent<CharacterStatus> (); _charAttacking = GetComponent<CharacterAttacking> (); _charAI = GetComponent<CharacterAI> (); if (!IsEnemy) { _playerInput = GetComponent<PlayerInput>(); //_playerInputMobile = GetComponent<PlayerInputMobile>(); } // I use these since when we have low health, we will move a bit slower. // When we get more than 25% health again, we will go back to our // default speeds for these. defaultAirSpeed = airSpeed; m_Loco_0Id = Animator.StringToHash ("Base Layer.Locomotion"); m_Loco_1Id = Animator.StringToHash ("LowHealth.Locomotion"); myRigidbody = GetComponent<Rigidbody> (); if (!grabTriggerCol) Debug.LogWarning("PLEASE ASSIGN YOUR Player's GRAB TRIGGER COLLIDER"); else grabTriggerCol.enabled = false; }
void Start() { m_Count = 0; board = GameObject.Find ("Board").GetComponent<Board> (); player = GameObject.Find ("PlayerInput").GetComponent<PlayerInput>(); gameInfo = GameObject.Find ("GameInfo").GetComponent<GameInfo>(); }
//constructor to initialize the class public InputSelectV2(Transform mountPoint, GameObject model, PlayerInput inputType) { m_MountPoint = mountPoint; m_OriginalMountPoint = mountPoint; m_Model = model; m_InputType = inputType; }
///onEnable looks for inputs for camera and button void OnEnable(){ enemy = GameObject.Find("Enemy").GetComponent<PlayerHealth> (); playerInput = GameObject.Find ("Main Camera").GetComponent<PlayerInput>(); trapAudio = GetComponent <AudioSource> (); StartCoroutine("TrapActivate"); }
// Use this for initialization protected virtual void Start() { centerOffset = transform.position - target.position; originalcenterOffset = centerOffset; playerActor = target.root.GetComponent<PlayerActor>(); playerInput = target.root.GetComponent<PlayerInput>(); }
void Awake() { //getting all the required components _rigidbody = GetComponent<Rigidbody2D>(); _touchDetector = GetComponent<TouchDetector2D>(); _playerInput = GetComponent<PlayerInput>(); }
public override bool CanEnterState() { float minDistance = m_AttackRange; m_TargettedPlayer = null; foreach(PlayerInput player in m_Players) { if(!LayerMask.LayerToName(player.gameObject.layer).Contains (NameConstants.DEAD_LAYER)) { Vector3 playerPosition = player.transform.position; playerPosition.y = transform.position.y; float distance = Vector3.Distance(playerPosition, transform.position); if(distance <= minDistance) { minDistance = distance; m_TargettedPlayer = player; } } } return m_TargettedPlayer != null; }
// Update is called once per frame void Update() { if ((Input.GetKey(KeyCode.P)) && (_actionsLaunched == false)) { Debug.Log("Make Action"); MakePlayerActions(); } if (_nbInputsToDo > 0) { _currentPlayerInput = _playerInputs[_currentInputToDo]; ++_currentInputToDo; --_nbInputsToDo; if (_currentPlayerInput != null) _moveScript.makeMove(_currentPlayerInput); if (_nbInputsToDo <= 0) { _currentInputToDo = 0; _actionsLaunched = false; _moveScript._playerMove = true; Debug.Log("----- End -----"); } } }
// ******************************************** START/ UPDATE ******************************************** void Awake() { // find components: tform = transform; compoMain = Camera.main.GetComponent<Main>(); compoInput = GetComponent<PlayerInput>(); }
public void MoveCarWithIA(PlayerInput playerInput) { if (playerInput._keyCodes.Contains(_inputBrakeCar)) { carRigid.velocity = carRigid.velocity * 0.9f; } else if (playerInput._keyCodes.Contains(_inputForwardCar)) { carRigid.AddForce(carTransform.forward * 18 * 1.5f, ForceMode.Acceleration); } if (carRigid.velocity.magnitude > _maxVelocity) { carRigid.velocity = carRigid.velocity.normalized * _maxVelocity; } if ( (playerInput._axeHorizontal <= 1.0f && playerInput._axeHorizontal > 0.40f) || (playerInput._axeHorizontal < -0.40f && playerInput._axeHorizontal >= -1.0f) ) // peut etre zone morte a ajouter entre 0.1 et -0.1 { carTransform.Rotate(new Vector3(0, playerInput._axeHorizontal * 2, 0)); if (carRigid.velocity.magnitude > _maxVelocity * 0.8f) { carRigid.velocity = carRigid.velocity * 0.95f; } } if (playerInput._keyCodes.Contains(_inputResetCar)) { Debug.Log("ResetCar"); carRigid.velocity = new Vector3(0, 0, 0); carTransform.position = new Vector3(aiScript._previousCheckPoint.transform.position.x, 0.3f, aiScript._previousCheckPoint.transform.position.z); carTransform.LookAt(aiScript._currentCheckPoint.transform); StartCoroutine(ResetCar()); } }
// Use this for initialization void Start () { player = gameObject.GetComponent<Player>(); input = InputManager.getCurrentInputManager() .playerControls[player.playerNumber]; }
void Awake() { _recipeManager = FindObjectOfType<RecipeManager>(); _musicManager = FindObjectOfType<MusicManager>(); _rigidbody = GetComponent<Rigidbody2D>(); _collider = GetComponent<Collider2D>(); _animator = GetComponent<Animator> (); _initPos = transform.position; if(GameManager.Instance.playerDevices.Count > playerNum - 1) { //Take the controller assigned on the menu _playerInput = new PlayerInput(true); _playerInput.Device = InputManager.Devices[GameManager.Instance.playerDevices[playerNum - 1]]; Debug.Log(playerNum + " " + _playerInput.Device.Name); } else { //Test only Debug.Log("Controllers " + InputManager.Devices.Count); if(InputManager.Devices.Count > playerNum - 1) { _playerInput = new PlayerInput(true); _playerInput.Device = InputManager.Devices[playerNum - 1]; } else if(playerNum == 4) _playerInput = new PlayerInput(false); Debug.LogWarning("No input for player " + playerNum); } FindObjectOfType<GameOverManager>().OnGameOver += HandleGameOver; }
public override void use(PlayerInput usedBy = PlayerInput.None) { GameData.Instance.Brightness = Mathf.Clamp(GameData.Instance.Brightness + m_Increment, Constants.BRIGHTNESS_MIN, Constants.BRIGHTNESS_MAX); i_Slider.Value = GameData.Instance.Brightness; }
private void Start() { target = GameObject.FindGameObjectWithTag("Player").transform; playerInput = target.gameObject.GetComponent<PlayerInput>(); m_LastTargetPosition = target.position; m_OffsetZ = (transform.position - target.position).z; transform.parent = null; }
void Start() { if (CopySettingFrom != null) { //copy the input ReadInputFrom = CopySettingFrom.ReadInputFrom; } }
// Use this for initialization void Start() { lastTimeSinceSwitch = TimeStartMoving; state = SwitchState.CountingDown; playerInput = GetComponent<PlayerInput>(); playerInput.enabled = false; }
void Awake() { DontDestroyOnLoad(gameObject); CurrentGranade = null; PlayerInputController = GetComponent<PlayerInput>(); SetInitialAttributes(); SetupWeapons(); }
// Use this for initialization void Start() { PMovement = GetComponent<PlayerMovement>(); PCamera = GetComponent<PlayerCamera>(); PInput = GetComponent<PlayerInput>(); PWeapon = GetComponent<PlayerWeapon>(); PData = GetComponent<PlayerData>(); }
void Awake(){ _playerInput = GetComponent<PlayerInput> (); disableShield (yellowShield); disableShield (redShield); disableShield (greenShield); disableShield (bluShield); }
protected override void Awake() { base.Awake(); input = GetComponent<PlayerInput>(); color = colors[colorIndex]; model = transform.GetChild(0); }
// Use this for initialization void Start() { m_HUD = FindObjectOfType<HUD>(); m_WaveManager = FindObjectOfType<WaveManager>(); m_WaveManager.gameObject.SetActive (false); m_Player = FindObjectOfType<PlayerInput>(); }
public void Action(PlayerInput playerInput) { // action when player has object and presses Action (depends on position) Player player = GameManager.singleton.player; player.StartCoroutine(player.animateAction(player.actionPlace, playerInput)); Destroy(this.gameObject); player.ritualObject = null; }
// Use this for initialization protected override void StartVirtual() { m_Input = GetComponent<PlayerInput>(); m_Agent = GetComponent<NavMeshAgent>(); m_Interaction = GetComponent<Interaction>(); m_Players = FindObjectsOfType<PlayerInput>(); }
// Use this for initialization void Start() { Collider = GetComponent<BoxCollider2D>(); playerInput = GetComponent<PlayerInput>(); CharSprite = GetComponent<SpriteRenderer>(); CalculateRaySpacing(); }
protected override void Awake() { base.Awake(); player = GetComponent<Player>(); input = GetComponent<PlayerInput>(); source = GetComponent<AudioSource>(); attackLayer = enemyLayer; }
// Start is called before the first frame update void Start() { playerInput = GetComponent <PlayerInput>(); actionMap = playerInput.currentActionMap; }
static void Main(string[] args) { // instantiate vending machines CandyVendingMachine CandyVM = new CandyVendingMachine(); ClothingVendingMachine ClothingVM = new ClothingVendingMachine(); CoffeeVendingMachine CoffeeVM = new CoffeeVendingMachine(); EnergyDrinkVendingMachine EnergyVM = new EnergyDrinkVendingMachine(); PreparedFoodVendingMachine PreparedFoodVM = new PreparedFoodVendingMachine(); SodaVendingMachine SodaVM = new SodaVendingMachine(); SundryVendingMachine SundryVM = new SundryVendingMachine(); // instantiate products // candy products Snickers snickers = new Snickers() { Name = "Snickers Bar", Price = 1.99 }; snickers.Ingredients = "chocolate and some other stuff"; snickers.Recyclable = false; // add product to specific vending machine CandyVM.AddProduct(snickers); // clothing items Shoes sandals = new Shoes() { Name = "Rainbow Flip-flops", Price = 80.00 }; sandals.LvlSpicy = 1; sandals.Organic = true; // add product to specific vending machine ClothingVM.AddProduct(sandals); // coffee products SpanishCoffee spanishCoffee = new SpanishCoffee() { Name = "Spanish Coffee Cocktail", Price = 10.00 }; spanishCoffee.LvlSpicy = 4; spanishCoffee.Organic = false; // add product to specific vending machine CoffeeVM.AddProduct(spanishCoffee); // energy drinks Toughman toughman = new Toughman() { Name = "Tougman", Price = 2.85 }; toughman.Colors = "yellow 2, red 4"; toughman.RfIdFrequency = "3.16MgHz"; // add product to specific vending machine EnergyVM.AddProduct(toughman); // prepared foods KrystalSlider sliders = new KrystalSlider() { Name = "Krystal Sliders", Price = 5.00 }; sliders.Ingredients = "who knows"; sliders.Recyclable = false; // add product to specific vending machine PreparedFoodVM.AddProduct(sliders); // soda drinks Coke coke = new Coke() { Name = "Coca Cola", Price = 1.99 }; coke.Ingredients = "water, sugar, brown"; coke.Recyclable = true; // add product to specific vending machine SodaVM.AddProduct(coke); /* * WELCOME TO VENIGO * - the vending game - * created by Sam Cronin */ PlayerInput intro = new PlayerInput(); PlayerInput vendingOption = new PlayerInput(); CountrySelect country = new CountrySelect(); VendingSelect vending = new VendingSelect(); Console.WriteLine($@" ------------------ WELCOME TO VENDIGO! ------------------ 1. Japan 2. Spain 3. United States 4. Display Reports 5. Exit Choose a country.."); // store the users input intro.StoreInputHere = Console.ReadLine().ToLower(); // if users input equals this do this if (intro.StoreInputHere == "japan") { country.Japan(); } if (intro.StoreInputHere == "spain") { country.Spain(); } if (intro.StoreInputHere == "united states") { country.America(); } vendingOption.StoreInputHere = Console.ReadLine().ToLower(); if (vendingOption.StoreInputHere == "soda") { vending.Soda(); } // if (vendingOption.StoreInputHere == "candy") // { // vending.Candy(); // } // if (vendingOption.StoreInputHere == "sundry") // { // vending.Sundry(); // } // if (vendingOption.StoreInputHere == "coffee") // { // vending.Coffee(); // } // if (vendingOption.StoreInputHere == "clothing") // { // vending.Clothing(); // } // if (vendingOption.StoreInputHere == "prepared foods") // { // vending.PreparedFood(); // } // if (vendingOption.StoreInputHere == "energy drinks") // { // vending.EnergyDrinks(); // } }
public override void ModifyInterfaceLayers(List <GameInterfaceLayer> layers) { PlayerInput.SetZoom_Unscaled(); PlayerInput.SetZoom_MouseInWorld(); Rectangle rectangle1 = new Rectangle((int)((double)Main.mouseX + (double)Main.screenPosition.X), (int)((double)Main.mouseY + (double)Main.screenPosition.Y), 1, 1); if ((double)Main.player[Main.myPlayer].gravDir == -1.0) { rectangle1.Y = (int)Main.screenPosition.Y + Main.screenHeight - Main.mouseY; } PlayerInput.SetZoom_UI(); IngameOptions.MouseOver(); IngameFancyUI.MouseOver(); for (int index1 = 0; index1 < 200; ++index1) { if (Main.npc[index1].active) { Rectangle rectangle2 = new Rectangle((int)Main.npc[index1].Bottom.X - Main.npc[index1].frame.Width / 2, (int)Main.npc[index1].Bottom.Y - Main.npc[index1].frame.Height, Main.npc[index1].frame.Width, Main.npc[index1].frame.Height); if (Main.npc[index1].type >= 87 && Main.npc[index1].type <= 92) { rectangle2 = new Rectangle((int)((double)Main.npc[index1].position.X + (double)Main.npc[index1].width * 0.5 - 32.0), (int)((double)Main.npc[index1].position.Y + (double)Main.npc[index1].height * 0.5 - 32.0), 64, 64); } bool flag1 = rectangle1.Intersects(rectangle2); bool flag2 = flag1 || Main.SmartInteractShowingGenuine && Main.SmartInteractNPC == index1; if (flag2 && ( Main.npc[index1].type != 85 && Main.npc[index1].type != 341 && Main.npc[index1].aiStyle != 87 || Main.npc[index1].ai[0] != 0.0) && Main.npc[index1].type != 488) { if (flag1) { float buffer = 4 * Main.UIScale; float prev = 0; Element Primary = new NPCWrapper(Main.npc[index1]).Primary; Element Secondary = new NPCWrapper(Main.npc[index1]).Secondary; Element Quatrinary = new NPCWrapper(Main.npc[index1]).Offensive; var icon1 = GetTexture("Types/" + Formal.Name[Primary]); var icon2 = GetTexture("Types/" + Formal.Name[Secondary]); var icon4 = GetTexture("Types/" + Formal.Name[Quatrinary]); int yOffset = 38; int xOffset = 12; Main.spriteBatch.Begin(); int x = (int)((Main.mouseX + xOffset) * Main.UIScale); int y = (int)((Main.mouseY + yOffset) * Main.UIScale); if (Primary != Element.none && Primary != Element.levitate) { Main.spriteBatch.Draw(icon1, new Vector2(x + prev, y), null, Color.White, 0, new Vector2(0, 0), Main.UIScale, SpriteEffects.None, 0); prev += icon1.Width * Main.UIScale + buffer; } if (Secondary != Element.none && Secondary != Element.levitate) { Main.spriteBatch.Draw(icon2, new Vector2(x + prev, y), null, Color.White, 0, new Vector2(0, 0), Main.UIScale, SpriteEffects.None, 0); } if (Quatrinary != Element.none && Quatrinary != Element.levitate) { Main.spriteBatch.Draw(icon4, new Vector2(x, y + icon1.Width * Main.UIScale + buffer), null, Color.White, 0, new Vector2(0, 0), Main.UIScale, SpriteEffects.None, 0); } Main.spriteBatch.End(); break; } break; } } } //PlayerInput.SetZoom_UI(); base.ModifyInterfaceLayers(layers); }
public PlayerConfiguration(PlayerInput pi) { PlayerIndex = pi.playerIndex; Input = pi; }
public PlayerData(InputDevice id, PlayerInput pi) { inputDevice = id; playerInput = pi; inputsHandler = pi.GetComponent <InputsHandler>(); }
void Start() { PlayerInput player = GetComponent <PlayerInput>(); color = TheGameManager.Instance.players[player.playerNumber].Color; }
static PlayerInputContext CreateInput(PlayerInput input) => new PlayerInputContext { Current = input };
private void Start() { _playerInput = GetComponent <PlayerInput>(); _plyGamepad = GetGamepadFromDevices(_playerInput.devices); }
private void Start() { _input = GetComponent <PlayerInput>(); _rb = GetComponent <Rigidbody2D>(); }
public void Draw() { int namePlateDistance = Main.teamNamePlateDistance; if (namePlateDistance <= 0) { return; } SpriteBatch spriteBatch = Main.spriteBatch; spriteBatch.End(); spriteBatch.Begin(SpriteSortMode.Immediate, (BlendState)null, (SamplerState)null, (DepthStencilState)null, (RasterizerState)null, (Effect)null, Main.UIScaleMatrix); PlayerInput.SetZoom_World(); int screenWidth = Main.screenWidth; int screenHeight = Main.screenHeight; Vector2 screenPosition1 = Main.screenPosition; PlayerInput.SetZoom_UI(); float uiScale = Main.UIScale; int num1 = namePlateDistance * 8; Player[] player1 = Main.player; int player2 = Main.myPlayer; SpriteViewMatrix gameViewMatrix = Main.GameViewMatrix; byte mouseTextColor = Main.mouseTextColor; Color[] teamColor = Main.teamColor; Camera camera = Main.Camera; IPlayerRenderer playerRenderer = Main.PlayerRenderer; Vector2 screenPosition2 = Main.screenPosition; for (int index = 0; index < (int)byte.MaxValue; ++index) { if (player1[index].active && player2 != index && (!player1[index].dead && player1[player2].team > 0) && player1[player2].team == player1[index].team) { string name = player1[index].name; Vector2 namePlatePos = FontAssets.MouseText.Value.MeasureString(name); float num2 = 0.0f; if (player1[index].chatOverhead.timeLeft > 0) { num2 = -namePlatePos.Y * uiScale; } else if (player1[index].emoteTime > 0) { num2 = -namePlatePos.Y * uiScale; } Vector2 vector2_1 = new Vector2((float)(screenWidth / 2) + screenPosition1.X, (float)(screenHeight / 2) + screenPosition1.Y); Vector2 position1 = player1[index].position; Vector2 vector2_2 = position1 + (position1 - vector2_1) * (gameViewMatrix.Zoom - Vector2.One); float num3 = 0.0f; float num4 = (float)mouseTextColor / (float)byte.MaxValue; Color namePlateColor = new Color((int)(byte)((double)teamColor[player1[index].team].R * (double)num4), (int)(byte)((double)teamColor[player1[index].team].G * (double)num4), (int)(byte)((double)teamColor[player1[index].team].B * (double)num4), (int)mouseTextColor); float num5 = vector2_2.X + (float)(player1[index].width / 2) - vector2_1.X; float num6 = (float)((double)vector2_2.Y - (double)namePlatePos.Y - 2.0) + num2 - vector2_1.Y; float num7 = (float)Math.Sqrt((double)num5 * (double)num5 + (double)num6 * (double)num6); int num8 = screenHeight; if (screenHeight > screenWidth) { num8 = screenWidth; } int num9 = num8 / 2 - 50; if (num9 < 100) { num9 = 100; } if ((double)num7 < (double)num9) { namePlatePos.X = (float)((double)vector2_2.X + (double)(player1[index].width / 2) - (double)namePlatePos.X / 2.0) - screenPosition1.X; namePlatePos.Y = (float)((double)vector2_2.Y - (double)namePlatePos.Y - 2.0) + num2 - screenPosition1.Y; } else { num3 = num7; float num10 = (float)num9 / num7; namePlatePos.X = (float)((double)(screenWidth / 2) + (double)num5 * (double)num10 - (double)namePlatePos.X / 2.0); namePlatePos.Y = (float)((double)(screenHeight / 2) + (double)num6 * (double)num10 + 40.0 * (double)uiScale); } Vector2 vector2_3 = FontAssets.MouseText.Value.MeasureString(name); namePlatePos += vector2_3 / 2f; namePlatePos *= 1f / uiScale; namePlatePos -= vector2_3 / 2f; if ((double)player1[player2].gravDir == -1.0) { namePlatePos.Y = (float)screenHeight - namePlatePos.Y; } if ((double)num3 > 0.0) { float num10 = 20f; float num11 = -27f - (float)(((double)vector2_3.X - 85.0) / 2.0); float num12 = player1[index].Center.X - player1[player2].Center.X; float num13 = player1[index].Center.Y - player1[player2].Center.Y; float num14 = (float)Math.Sqrt((double)num12 * (double)num12 + (double)num13 * (double)num13); if ((double)num14 <= (double)num1) { string textValue = Language.GetTextValue("GameUI.PlayerDistance", (object)(int)((double)num14 / 16.0 * 2.0)); Vector2 npDistPos = FontAssets.MouseText.Value.MeasureString(textValue); npDistPos.X = namePlatePos.X - num11; npDistPos.Y = (float)((double)namePlatePos.Y + (double)vector2_3.Y / 2.0 - (double)npDistPos.Y / 2.0) - num10; LegacyMultiplayerClosePlayersOverlay.DrawPlayerName2(spriteBatch, ref namePlateColor, textValue, ref npDistPos); Color headBordersColor = Main.GetPlayerHeadBordersColor(player1[index]); Vector2 position2 = new Vector2(namePlatePos.X, namePlatePos.Y - num10); position2.X -= 22f + num11; position2.Y += 8f; playerRenderer.DrawPlayerHead(camera, player1[index], position2, 1f, 0.8f, headBordersColor); Vector2 vector2_4 = npDistPos + screenPosition2 + new Vector2(26f, 20f); if (player1[index].statLife != player1[index].statLifeMax2) { Main.instance.DrawHealthBar(vector2_4.X, vector2_4.Y, player1[index].statLife, player1[index].statLifeMax2, 1f, 1.25f, true); } ChatManager.DrawColorCodedStringWithShadow(spriteBatch, FontAssets.MouseText.Value, name, namePlatePos + new Vector2(0.0f, -40f), namePlateColor, 0.0f, Vector2.Zero, Vector2.One, -1f, 2f); } } else { LegacyMultiplayerClosePlayersOverlay.DrawPlayerName(spriteBatch, name, ref namePlatePos, ref namePlateColor); } } } }
void Start() { inputScript = FindObjectOfType <PlayerInput>(); effector = GetComponent <PlatformEffector2D>(); saveWT = waitTime; }
public Player(int playerID, TeamEnum playerTeam, PlayerInput playerInput) { PlayerID = playerID; PlayerTeam = playerTeam; PlayerInput = playerInput; }
private void Awake() { input = GetComponent<PlayerInput>(); movement = GetComponent<PlayerMovement>(); }
void Start() { player = GetComponent <Player>(); playerInput = GetComponent <PlayerInput>(); PlayerControllerInit(); }
public override PlayerState HandleInput(PlayerController p, PlayerInput i) { return(fromState); }
// Use this for initialization void Start() { playerMovement = gameObject.GetComponentInParent<PlayerMovement>(); playerInput = gameObject.GetComponentInParent<PlayerInput>(); dataHandler = gameManager.GetComponent<DataHandler>(); }
private void Awake() { _playerInput = gameObject.GetComponent <PlayerInput>(); charController = GetComponent <UnityEngine.CharacterController>(); }
private void Start() { _Controller = GetComponent <CharacterController>(); _Input = GetComponent <PlayerInput>(); CanMove = true; }
public AttackingState(PlayerState fromState, PlayerInput i) { this.fromState = fromState; this.i = i; }
// Start is called before the first frame update private void Awake() { inputActions = new PlayerInput(); }
// Start is called before the first frame update void Start() { origRot = transform.rotation; input = PlayerInput.instance; }
private void Awake() { instance = this; }
public override PlayerState Update(PlayerController p, PlayerInput i) { return(fromState); }
private void Awake() { _animator = GetComponent <Animator>(); _playerInput = new PlayerInput(); }
private void Awake() { _rigidbody = GetComponent <Rigidbody>(); _playerInput = GetComponent <PlayerInput>(); }
internal Vector3 CalculateMovement(PlayerInput playerInput) { throw new NotImplementedException(); }
private void ClearInput(PlayerInput input) { input.X = 0; input.Fire = false; }
// Main game loop void Update() { if (paused && !Input.GetKeyDown(keyBinds[PlayerInput.PAUSE]) || gameOptionsMenu.active || controlsMenu.active) { return; } if (linesToClear.Count == 0 && !gameOver) { // Spawn and check GameOver if last piece landed if (activePiece == null) { if (lockDelay <= 0.1f) { if (fallTimer.time < fallDelay) { return; } } // Check GameOver gameOver = checkGameOver(); if (gameOver) { Debug.Log("Game Over"); StartCoroutine(gameOverRoutine()); return; } // Spawn next piece activePiece = spawner.nextTetromino(); if (!Settings.showGhost) { activePiece.setGhostVisible(false); } resetPiece(); } // Player input successfulMovement = false; input = getPlayerInput(); switch (input) { case PlayerInput.NONE: moveRepeatTimer.reset(); break; case PlayerInput.DROP: Vector3 prev = activePiece.centerPosition(); activePiece.moveToGhostPosition(); Vector3 cur = activePiece.centerPosition(); hardDrop = (uint)Mathf.Round(prev.y - cur.y); graphics.tetrominoBeam(prev, cur, activePiece); lastSuccessfulMove = PlayerInput.DROP; moveRepeatTimer.reset(); break; case PlayerInput.SWAP: activePiece = hold.swap(activePiece); if (activePiece == null) { return; } resetPiece(); moveRepeatTimer.reset(); BlockUpdater.updateSprites(); // Held ghost could have not been updated when there was a change break; default: if (moveRepeatTimer.time == 0) { // Just move, first press successfulMovement = handleMovement(input); if (successfulMovement) { lastSuccessfulMove = input; moveTimer.reset(); } moveRepeatTimer.update(); } else if (moveRepeatTimer.time >= Settings.moveDelay) { // Only move if delay has been passed and only every so often if (moveTimer.time > Settings.moveSpeed) { successfulMovement = handleMovement(input); if (successfulMovement) { lastSuccessfulMove = input; moveTimer.reset(); } } } else { moveRepeatTimer.update(); } break; } // Move piece down or decrement lock timer if (!pieceLanded()) { if (fallTimer.time > (softDropping ? Settings.moveSpeed / 4 : fallDelay)) { // Down activePiece.translateVertical(-1); lastSuccessfulMove = PlayerInput.NONE; fallTimer.reset(); softDrop = softDropping ? softDrop + 1 : 0; } else { softDrop = softDropping ? softDrop : 0; } } else { // Reset timers on successful move if appropriate if (successfulMovement) { if (lockResetCount < lockResetCap) { lockTimer.reset(); lockResetCount++; } else { lockTimer.update(); } } else { lockTimer.update(); } } // Lock piece, clear lines, update score if ((pieceLanded() && lockTimer.time > lockDelay) || input == PlayerInput.DROP) { // Note tSpin. Must be done here before piece container is destroyed. tspin = isTspin(lastSuccessfulMove); // Lock piece, release blocks, any held piece lockPiece(); hold.reset(); activePiece.pulseDetachMinosAndDestroy(); activePiece = null; // Clear lines checkLineClears(); // Update Score and Level bool levelUp = score.updateScore((uint)linesToClear.Count, softDrop, hardDrop, tspin); if (levelUp) { if (Settings.dynamicColor) { graphics.fadeToNextColorPallet(); } fallDelay = calculateFallRate(score.level); } if (linesToClear.Count > 0) { clearLines(); } } } }
void Awake() { c_controls = new PlayerInput(); c_controls.Ferret.Jump.performed += _ => Jump(); }
void Awake() { playerInput = GetComponent <PlayerInput>(); }