Beispiel #1
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag("parableProjectile"))
        {
            print("Parried!");
            _feedback.GetComponent <Feedback>().CreateImage("ParryPass", other.gameObject.transform.position);
            _feedback.GetComponent <Feedback>().CreateAudio("Pass");

            //this.GetComponent<PlayerController>().mana += 10;
            gameObject.GetComponentInParent <PlayerController>().mana += 5;
            Debug.Log("Y IS THE HEALTH 85 IN THERE" + _bh.health);
            //_bh.health -= 3;

            print(_bh.health);
            PlayerPrefs.SetFloat("something", _bh.health);

            //_bh.health -= 3;

            //print(_bh.health);

            // Add base 300 score
            playerScore.AddScore(300.0f);

            // Per successful hit, increase multiplier
            // Like uhh, combo.. bonus?
            playerScore.AddMultiplier(0.1f);

            //other.gameObject.SetActive(false);
            if (other.transform.parent)
            {
                Destroy(other.gameObject.transform.parent.gameObject);
            }
            Destroy(other.gameObject);
        }
    }
Beispiel #2
0
    // Update is called once per frame
    void Update()
    {
        updateHealth();
        if (touchedGround)
        {
            doubleJump = false;
            animator.SetInteger("States", 3);
            currentPosition = transform.position;
        }
        if (invincible2 == true)
        {
            invinciblelifetime += Time.deltaTime;
        }
        if (invinciblelifetime >= 5.0f)
        {
            Debug.Log("INVINCIBILITY GONE");
            invincible2        = false;
            invinciblelifetime = 0;
        }

        // For Dictionary
        if (Input.GetKeyDown(KeyCode.Q))
        {
            _keys[1] = 3.0f;
        }

        if (Input.GetKeyDown(KeyCode.W))
        {
            _keys[2] = 3.0f;
        }

        if (Input.GetKeyDown(KeyCode.E))
        {
            _keys[3] = 3.0f;
        }

        if (Input.GetKeyDown(KeyCode.R))
        {
            _keys[4] = 3.0f;
        }

        //Crouch animation
        if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            //screenShake.ShakeCamera(1.0f, 0.3f, 0.95f);
            //screenShake.ShakeCamera();
            downbtn = true;
        }

        //Crouch animation
        if (Input.GetKey(KeyCode.DownArrow))
        {
            downbtn = true;
            if (downbtn)
            {
                animator.SetInteger("States", 5);
            }
        }
        else
        {
            downbtn = false;
            animator.SetInteger("States", 3);
        }

        //change animation to idle state
        if (Input.GetKeyUp(KeyCode.LeftArrow) || Input.GetKeyUp(KeyCode.RightArrow))
        {
            animator.SetInteger("States", 3);
        }

        manaBar.transform.localScale = new Vector3(mana / totalMana, 1, 1);
        Movement();
        Jump();
        ParryAttack();
        UpdateKeys();

        // MANA DRAIN
        if (!_crescendo)
        {
            if (mana > 0)
            {
                mana -= 0.01f;
            }
        }
        else
        {
            if (mana > 0)
            {
                mana -= 5.0f;
            }
            else
            {
                mana       = -50.0f;
                _crescendo = false;
            }
        }

        // cause like... its actually a sound/music bar thing
        // and uhh.. sound energy is lost to surrounding, amirite?
        // I'm not a scientist. This is a game.

        if (mana >= 100 && !_crescendo)
        {
            mana = totalMana;
            //mana = 0;
            _crescendo = true;

            // Add base 5000 score
            playerScore.AddScore(5000.0f);
            // Increase multiplier by 0.5f
            playerScore.AddMultiplier(0.5f);

            // True, trigger drop state, trigger QTE
            // Clear all projectiles on screen
        }

        if (dashCountdown == 0)
        {
            regainDash += Time.deltaTime;
            invincible  = false;
        }
        if (regainDash >= 2)
        {
            dashCountdown = 5;
            regainDash    = 0;
        }

        //Player Fall off screen,takes dmg, Reset back to previous position
        lastPosition = currentPosition;
        if (!touchedGround && transform.position.y <= -5)
        {
            transform.position = lastPosition;
            takeDamage(3);
        }

        removeAllProjectile();
        //blankText.text = " : " + currBlank + " / " + maxBlanks;

        //ForHighScoreTesting
        if (Input.GetKey(KeyCode.PageDown))
        {
            takeDamage(50);
        }
        //if (Input.GetKey(KeyCode.End))
        //    playerScore.ClearAllScores();
    }