public void killPlayer() { KeyImputManager.LockPlayerMouvement(); animator.SetTrigger("dying"); resetPlayer(); Invoke("TeleportPlayer", 1f); }
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(); } } }
private void updatePushTimer() { pushThePlayerTimer -= Time.deltaTime; if (pushThePlayerTimer < 0f) { KeyImputManager.freePlayerMouvement(); pushThePlayer = false; pushThePlayerTimer = 1f; } }
private void pushPlayer() { if (pushThePlayer) { KeyImputManager.LockPlayerMouvement(); GameObject.FindGameObjectWithTag("Player").transform.SetPositionAndRotation(new Vector3(GameObject.FindGameObjectWithTag("Player").transform.position.x - .2f, GameObject.FindGameObjectWithTag("Player").transform.position.y + 0.2f, GameObject.FindGameObjectWithTag("Player").transform.position.z), GameObject.FindGameObjectWithTag("Player").transform.rotation); updatePushTimer(); } }
public void knight1Action() { if (Player_Info.ableToDash == true) { playerDash(); KeyImputManager.LockPlayerMouvement(); Invoke("unlockPlayerMovement", Player_Info.dashLenght); Player_Info.ableToDash = false; timeForNextDash = PlayerDashDelay; } }
void Awake() { KeyImputManager.freePlayerMouvement(); sprite = GetComponent <SpriteRenderer>(); animator = GetComponent <Animator>(); rigidbody = GetComponent <Rigidbody2D>(); timeForNextDash = PlayerDashDelay; timeForNextInvisiblity = PlayerInvisibleDelay; resetImmunity(); SetBackground(); }
public void changeMessageState() { if (errorMessage.enabled) { errorMessage.enabled = false; } else { errorMessage.enabled = true; } KeyImputManager.changeLockState(); }
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(); } } } }
public void knight2Action() { if (isShielded) { isShielded = false; increaseOpacity(); } else { cancelCurrentPlayerAction(); KeyImputManager.LockPlayerMouvement(); isShielded = true; decreaseOpacity(); } }
// 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(); } }
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; } } } } }
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; } } } } } }
public void onClick() { isWaitingForKey = true; KeyImputManager.SaveActualKeyMapping(); }
private void updateKeyBind() { KeyImputManager.SetKeyMap(EventSystem.current.currentSelectedGameObject.tag.ToString(), keyPressed); KeyImputManager.changeKeyMapHaveChange(); }
private void playerHurtAnimation() { animator.SetTrigger("hurt"); KeyImputManager.LockPlayerMouvement(); Invoke("unlockPlayerMovement", 0.1f); }
private void assignCanvasLetter() { GameObject.FindGameObjectWithTag("Text").GetComponent <Text>().text = KeyImputManager.GetKeyBind("interact"); }
private void showErrorMessage() { errorMessage.enabled = !errorMessage.enabled; KeyImputManager.changeLockState(); }
public void unlockPlayerMovement() { KeyImputManager.freePlayerMouvement(); rigidbody.velocity = Vector3.zero; }
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(); }
public void resetKeysBind() { KeyImputManager.resetKeyBind(); }
// Use this for initialization public void Start() { KeyImputManager.KeyInputManager(); }
private void ShowDialog() { marchandDialog.enabled = true; DialogIsShowen = true; KeyImputManager.LockPlayerMouvement(); }
public void closedShop() { KeyImputManager.freePlayerMouvement(); shopIsOpen = false; shop.enabled = false; }