Exemple #1
0
    void OnAttackL()
    {
        //if (m_AttackType != AttackType.LightA)
        //{
        //	m_AttackType = AttackType.LightA;
        //	AudioSource.PlayClipAtPoint(m_AttackL1Sound, transform.position);
        //}
        //else
        //{
        //	m_AttackType = AttackType.LightB;
        //	AudioSource.PlayClipAtPoint(m_AttackL2Sound, transform.position);
        //}

        if (!m_ComboTracker.StackInput(CombatInput.AttackL))
        {
            m_AttackType = AttackType.LightA;
            AudioSource.PlayClipAtPoint(m_AttackL1Sound, transform.position);

            //if (m_AttackType == AttackType.LightA)
            TextManager.AddWorldText("L", transform.position + Vector3.up * 1.75f);
            //else
            //	TextManager.AddWorldText("Light B", transform.position + Vector3.up * 1.75f);

            m_Controller.AttackBoost(0.025f, 0.25f);

            Attack(m_AttackDamage.lightAttack, 0.05f);
        }
    }
Exemple #2
0
    public void Damage(int value)
    {
        if (!IsAlive())
        {
            return;
        }

        TextManager.AddWorldText("-" + Mathf.Min(value, currentHealth).ToString(), transform.position + Vector3.up, 1);

        int prevHealth = currentHealth;

        currentHealth = Mathf.Max(currentHealth - value, 0);

        if (!IsAlive() && prevHealth > 1 && dramatic)
        {
            currentHealth = 1;
        }

        OnDamage();
        if (OnHurt != null)
        {
            OnHurt(this);
        }
        if (currentHealth <= 0)
        {
            if (OnDeath != null)
            {
                OnDeath(this);
            }
            OnDie();

            if (deathSounds.Length > 0)
            {
                AudioSource.PlayClipAtPoint(deathSounds[Random.Range(0, deathSounds.Length)], transform.position);
            }
        }
        else
        {
            if (hitSounds.Length > 0)
            {
                AudioSource.PlayClipAtPoint(hitSounds[Random.Range(0, hitSounds.Length)], transform.position);
            }
        }
    }
Exemple #3
0
    void OnAttackH()
    {
        //m_AttackType = AttackType.HeavyA;
        //AudioSource.PlayClipAtPoint(m_AttackH1Sound, transform.position);

        if (!m_ComboTracker.StackInput(CombatInput.AttackH))
        {
            m_AttackType = AttackType.LightB;
            AudioSource.PlayClipAtPoint(m_AttackL2Sound, transform.position);

            //TextManager.AddWorldText("Heavy A", transform.position + Vector3.up * 1.75f);
            TextManager.AddWorldText("H", transform.position + Vector3.up * 1.75f);

            m_Controller.AttackBoost(0.025f, 0.25f);

            Attack(m_AttackDamage.lightAttack, 0.05f);
            //Attack(m_AttackDamage.heavyAttack, 0.3f);
        }
    }
Exemple #4
0
    private void ComboTracker_OnComboFinished(string name)
    {
        TextManager.AddWorldText(name, transform.position + Vector3.up * 1.75f);

        if (name == "L H L" || name == "L L H")
        {
            m_Controller.AttackBoost(0.025f, 0.25f);

            AudioSource.PlayClipAtPoint(m_AttackH1Sound, transform.position);
            m_AttackType = AttackType.HeavyA;

            Attack(m_AttackDamage.lightComboFinish, 0.3f);
        }
        else if (name == "Launcher")
        {
            //m_AttackType = AttackType.Launcher;

            m_Controller.AttackBoost(0.025f, 0.25f);

            AudioSource.PlayClipAtPoint(m_AttackH1Sound, transform.position);
            m_AttackType = AttackType.Launcher;

            AttackLaunch(m_AttackDamage.launcher, 0.3f, Vector3.up * m_Controller.jumpForce);
        }
        else if (name == "Slammer")
        {
            //m_AttackType = AttackType.Launcher;

            m_Controller.AttackBoost(0.025f, 0.25f);

            AudioSource.PlayClipAtPoint(m_AttackH1Sound, transform.position);
            m_AttackType = AttackType.HeavyA;

            AttackLaunch(m_AttackDamage.slammer, 0.3f, Vector3.down * 12);
        }
        else if (name == "Booster R" || name == "Booster L")
        {
            m_Controller.AttackBoost(0.75f, 0.2f);

            AudioSource.PlayClipAtPoint(m_AttackH1Sound, transform.position);
            m_AttackType = AttackType.Pusher;

            // Boost counts as air jump
            if (!m_Controller.IsGrounded())
            {
                m_Controller.hasDoubleJumped = true;
            }

            Attack(m_AttackDamage.booster, 0.3f);
        }
        else if (name == "Booster D")
        {
            // m_Controller.AttackBoost(0.75f, 0.2f); // TODO: Extend AttackBoost to accept a directional vector

            AudioSource.PlayClipAtPoint(m_AttackH1Sound, transform.position);
            m_AttackType = AttackType.HeavyA;

            Attack(m_AttackDamage.booster, 0.3f);
        }
        else if (name == "Pusher R" || name == "Pusher L")
        {
            m_Controller.AttackBoost(0.025f, 0.25f);

            AudioSource.PlayClipAtPoint(m_AttackH1Sound, transform.position);
            m_AttackType = AttackType.Pusher;

            if (name == "Pusher R")
            {
                AttackLaunch(m_AttackDamage.pusher, 0.3f, new Vector3(10, 5, 0));
            }
            else
            {
                AttackLaunch(m_AttackDamage.pusher, 0.3f, new Vector3(-10, 5, 0));
            }
        }
        else
        {
            Debug.LogError("Combo finished but was not handled: " + name);
        }
    }