private void SwitchPotion() //Detect input and switch Potion Mode { if (Input.GetKeyDown(KeyCode.Z) || Input.GetKeyDown(KeyCode.Alpha1)) { animator.SetBool("isFire", true); animator.SetBool("isIce", false); animator.SetBool("isSpace", false); potionMode = PotionMode.Fire; } if (Input.GetKeyDown(KeyCode.X) || Input.GetKeyDown(KeyCode.Alpha2)) { animator.SetBool("isIce", true); animator.SetBool("isFire", false); animator.SetBool("isSpace", false); potionMode = PotionMode.Ice; } if (Input.GetKeyDown(KeyCode.C) || Input.GetKeyDown(KeyCode.Alpha3)) { animator.SetBool("isSpace", true); animator.SetBool("isFire", false); animator.SetBool("isIce", false); potionMode = PotionMode.Space; } }
private void FixedUpdate() { if (isAlive) { if (potionMode != previousPotion) { AudioManagerController.instance.Play("SwitchPotion"); previousPotion = potionMode; } Move(MovementInput()); } }
// Start is called before the first frame update void Start() { if (instance == null) { instance = this; } AudioManagerController.instance.StartCoroutine("StartMainSceneBackgroundMusic"); potionMode = PotionMode.Fire; previousPotion = potionMode; aimTo = AimTo.Right; faceTo = FaceTo.Right; health = Mathf.Clamp(health, 0, health); rb2d = GetComponent <Rigidbody2D>(); animator = GetComponent <Animator>(); spriteRenderer = GetComponent <SpriteRenderer>(); shaderGUItext = Shader.Find("GUI/Text Shader"); shaderSpritesDefault = Shader.Find("Sprites/Default"); // or whatever sprite shader is being used isAlive = true; }