private void OnTriggerStay2D(Collider2D collision) { KeyCode keyUp = KeyCode.None; foreach (KeyCode vKey in System.Enum.GetValues(typeof(KeyCode))) { if (Input.GetKeyUp(vKey)) { keyUp = vKey; if (keyUp.ToString() == KeyImputManager.GetKeyBind("interact")) { if (collision.gameObject.tag == "Player") { podiumReset(); podiumSwordChangeSprite(); Instantiate(knight_3); knight_3.transform.position = gameObject.transform.position; Player_Info.setPlayerGameObject(knight_3); Player_Info.CharacterName = knight_3.name; HitTracker.HaveHit = false; destroyPlayer(); } } } } }
private void OnTriggerStay2D(Collider2D collision) { if (collision.tag == "Player") { if (Player_Info.CharacterName != "knight_base") { foreach (KeyCode vKey in System.Enum.GetValues(typeof(KeyCode))) { if (Input.GetKeyUp(vKey)) { KeyCode keyPressed = vKey; if (keyPressed.ToString() == KeyImputManager.GetKeyBind("interact")) { tag = gameObject.tag; enterTeleporter(); } } } } else { showErrorMessage(); } } }
public static void PlaySound(string clip) { //sourceAudio.PlayOneShot(Swoosh); foreach (KeyCode vKey in System.Enum.GetValues(typeof(KeyCode))) { if (Input.GetKey(vKey)) { keyPressed = vKey; if (keyPressed.ToString() == KeyImputManager.GetKeyBind("Attack")) { sourceAudio.Play(); } } } }
private void Update() { if (messagehaveBeenShowen) { foreach (KeyCode vKey in System.Enum.GetValues(typeof(KeyCode))) { if (Input.GetKeyUp(vKey)) { if (vKey.ToString() == KeyImputManager.GetKeyBind("interact").ToString()) { unlockMessage.enabled = false; } } } } }
// Update is called once per frame void Update() { if (KeyImputManager.getKeyMapHasChange()) { Left.text = KeyImputManager.GetKeyBind("Left"); Right.text = KeyImputManager.GetKeyBind("Right"); DashLeft.text = KeyImputManager.GetKeyBind("DashLeft"); DashRight.text = KeyImputManager.GetKeyBind("DashRight"); Jump.text = KeyImputManager.GetKeyBind("Jump"); interact.text = KeyImputManager.GetKeyBind("interact"); Attack.text = KeyImputManager.GetKeyBind("Attack"); Defence.text = KeyImputManager.GetKeyBind("Defence"); Pause.text = KeyImputManager.GetKeyBind("Pause"); KeyImputManager.changeKeyMapHaveChange(); } }
public void checkIfDefenceIsReleased() { foreach (KeyCode vKey in System.Enum.GetValues(typeof(KeyCode))) { if (Input.GetKeyUp(vKey)) { keyPressed = vKey; if (keyPressed.ToString() == KeyImputManager.GetKeyBind("Defence") && gameObject.name.Contains("knight_2")) { isShielded = false; increaseOpacity(); unlockPlayerMovement(); } } } }
// Use this for initialization void Start() { if (!KeyImputManager.getIsInitialize()) { KeyImputManager.KeyInputManager(); } Left.text = KeyImputManager.GetKeyBind("Left"); Right.text = KeyImputManager.GetKeyBind("Right"); DashLeft.text = KeyImputManager.GetKeyBind("DashLeft"); DashRight.text = KeyImputManager.GetKeyBind("DashRight"); Jump.text = KeyImputManager.GetKeyBind("Jump"); interact.text = KeyImputManager.GetKeyBind("interact"); Attack.text = KeyImputManager.GetKeyBind("Attack"); Defence.text = KeyImputManager.GetKeyBind("Defence"); Pause.text = KeyImputManager.GetKeyBind("Pause"); }
private void OnTriggerStay2D(Collider2D collision) { if (collision.tag == "Player") { foreach (KeyCode vKey in System.Enum.GetValues(typeof(KeyCode))) { if (Input.GetKeyUp(vKey)) { KeyCode keyPressed = vKey; if (keyPressed.ToString() == KeyImputManager.GetKeyBind("interact")) { tptag = gameObject.tag; enterTeleporter(); } } } } }
private void OnTriggerStay2D(Collider2D collision) { if (!DialogIsShowen && !shopIsOpen) { if (collision.tag == "Player") { foreach (KeyCode vKey in System.Enum.GetValues(typeof(KeyCode))) { if (Input.GetKeyUp(vKey)) { KeyCode keyPressed = vKey; if (keyPressed.ToString() == KeyImputManager.GetKeyBind("interact")) { ShowDialog(); wait = true; } } } } } }
private void checkMarchandDialog() { foreach (KeyCode keyPress in System.Enum.GetValues(typeof(KeyCode))) { if (Input.GetKeyUp(keyPress)) { KeyCode keyPressed = keyPress; if (keyPressed.ToString() == KeyImputManager.GetKeyBind("interact")) { if (wait) { wait = false; } else { openShop(); } } } } }
void Update() { Player_Info.timeForNextAttack -= Time.deltaTime; if (Player_Info.timeForNextAttack <= 0f) { Player_Info.ableToHit = true; } foreach (KeyCode vKey in System.Enum.GetValues(typeof(KeyCode))) { if (Input.GetKey(vKey)) { keyPressed = vKey; if (keyPressed.ToString() == KeyImputManager.GetKeyBind("Attack")) { gameObject.GetComponent <Collider2D>().enabled = true; Invoke("enableColliderWeapon", 0.5f); } } } }
private void OnTriggerStay2D(Collider2D collision) { if (collision.tag == "Player") { foreach (KeyCode vKey in System.Enum.GetValues(typeof(KeyCode))) { if (Input.GetKeyUp(vKey)) { KeyCode keyPressed = vKey; if (keyPressed.ToString() == KeyImputManager.GetKeyBind("interact")) { if (gameObject.tag == "OutsideDoor") { gameObject.GetComponent <SpriteRenderer>().sprite = outside; } else if (gameObject.tag == "hellDoor") { gameObject.GetComponent <SpriteRenderer>().sprite = hell; } } } } } }
private void assignCanvasLetter() { GameObject.FindGameObjectWithTag("Text").GetComponent <Text>().text = KeyImputManager.GetKeyBind("interact"); }
protected override void ComputeVelocity() { immunityTimeLeft -= Time.deltaTime; timeForNextDash -= Time.deltaTime; timeForNextInvisiblity -= Time.deltaTime; if (timeForNextDash <= 0f) { Player_Info.ableToDash = true; } if (timeForNextInvisiblity <= 0f) { Player_Info.ableToInvisibility = true; } if (immunityTimeLeft <= 0f) { immunity = false; } Vector2 move = Vector2.zero; if (!KeyImputManager.getMouvementLock()) { foreach (KeyCode vKey in System.Enum.GetValues(typeof(KeyCode))) { if (Input.GetKey(vKey)) { keyPressed = vKey; if (keyPressed.ToString() == KeyImputManager.GetKeyBind("Left")) { move.x = -1.0f; } else if (keyPressed.ToString() == KeyImputManager.GetKeyBind("Right")) { move.x = 1.0f; } if (keyPressed.ToString() == KeyImputManager.GetKeyBind("Jump") && grounded) { velocity.y = jumpTakeOffSpeed; } else if (Input.GetKeyUp(KeyImputManager.GetKeyBind("Jump").ToLower())) { if (velocity.y > 0) { velocity.y = velocity.y * 0.5f; } } if (keyPressed.ToString() == KeyImputManager.GetKeyBind("Defence")) { if (gameObject.name.Contains("knight_1")) { knight1Action(); } if (gameObject.name.Contains("knight_2")) { knight2Action(); } if (gameObject.name.Contains("knight_3")) { if (Player_Info.ableToInvisibility) { Player_Info.ableToInvisibility = false; decreaseOpacity(); isInvisible = true; Invoke("cancelInvisibility", Player_Info.invisibilityLenght); } } } if (keyPressed.ToString() == KeyImputManager.GetKeyBind("Left")) { if (isGauche == false) { collider = GameObject.FindGameObjectWithTag("SwordCollider").GetComponent <Collider2D>(); sprite.flipX = !sprite.flipX; collider.offset *= -1; } isGauche = true; } else if (keyPressed.ToString() == KeyImputManager.GetKeyBind("Right")) { if (isGauche == true) { collider = GameObject.FindGameObjectWithTag("SwordCollider").GetComponent <Collider2D>(); sprite.flipX = !sprite.flipX; collider.offset *= -1; } isGauche = false; } if (keyPressed.ToString() == KeyImputManager.GetKeyBind("Attack")) { attack(); } targetVelocity = move * maxSpeed; } } animator.SetFloat("speed", Mathf.Abs(velocity.x) / maxSpeed); animator.SetBool("grounded", grounded); } checkIfDefenceIsReleased(); }