Пример #1
0
    public void OnTriggerEnter(Collider other)
    {
        if (_Active == true)
        {
            // Check against the static collisions
            if (other.gameObject.tag == "Collision")
            {
                // Play impact effect
                ParticleSystem effect = Instantiate(WeaponManager._pInstance._FireballImpactEffect, gameObject.transform.position, Quaternion.identity);
                effect.gameObject.GetComponent <DestroyAfterTime>().enabled = true;

                // Destroy projectile
                FreeProjectile();
            }

            // Has the fireball collided with the minion's collision?
            if (other.gameObject.tag == "Enemy")
            {
                Char_Crystal crystal = other.gameObject.GetComponent <Char_Crystal>();

                // Damage minion
                crystal.Damage(_Owner.GetOwner(), _ImpactDamage);

                // Check if minion has been killed
                if (crystal.GetHealth() <= 0)
                {
                    // Add to instigator's kill count
                    _Owner.GetOwner()._Player.AddKillCount();
                }

                // Play impact effect
                ParticleSystem effect = Instantiate(WeaponManager._pInstance._FireballImpactEffect, gameObject.transform.position, Quaternion.identity);
                effect.gameObject.GetComponent <DestroyAfterTime>().enabled = true;

                // Destroy fireball
                FreeProjectile();

                // Play impact sound
                SoundManager._pInstance.PlayFireballImpact();
            }

            // Check against face tree
            if (other.gameObject.tag == "FaceTree")
            {
                FaceTree tree = other.gameObject.GetComponent <FaceTree>();
                tree.OnHit();

                // Play impact effect
                ParticleSystem effect = Instantiate(WeaponManager._pInstance._FireballImpactEffect, gameObject.transform.position, Quaternion.identity);
                effect.gameObject.GetComponent <DestroyAfterTime>().enabled = true;

                // Destroy fireball
                FreeProjectile();

                // Play impact sound
                SoundManager._pInstance.PlayFireballImpact();
            }
        }
    }
Пример #2
0
    public void CollisionChecks()
    {
        // Check against all alive minions
        foreach (var minion in AiManager._pInstance.GetActiveMinions())
        {
            Char_Crystal crystal = minion.GetComponent <Char_Crystal>();

            // Precaution
            if (crystal != null)
            {
                // If minion has valid collision reference set
                if (crystal.GetCollider() != null)
                {
                    // Has the fireball collided with the minion's collision?
                    if (_Collision.bounds.Intersects(crystal.GetCollider().bounds))
                    {
                        // Damage minion
                        crystal.Damage(_Owner.GetOwner(), _Damage);

                        // Play impact sound
                        SoundManager._pInstance.PlayFireballImpact();

                        // Check if minion has been killed
                        if (crystal.GetHealth() <= 0)
                        {
                            // Add to instigator's kill count
                            _Owner.GetOwner()._Player.AddKillCount();
                        }

                        // Destroy fireball
                        FreeProjectile();
                        break;
                    }
                }
            }
        }

        if (MatchManager._pInstance.GetGameState() == MatchManager.GameState.Phase2)
        {
            // Check against all alive players
            foreach (var necromancer in PlayerManager._pInstance.GetActiveNecromancers())
            {
                // If necromancer has valid collision reference set
                if (necromancer.GetCollider() != null)
                {
                    // If it isnt the instigator who is being tested against
                    if (necromancer != _Owner.GetOwner())
                    {
                        // Check against all meat shield minions associated to the player
                        foreach (GameObject meatMinion in necromancer.GetSpecialWeapon().GetComponent <Wep_Shield>().GetMeatMinionPool())
                        {
                            Proj_ShieldMinion minion = meatMinion.GetComponent <Proj_ShieldMinion>();

                            // Has the fireball collided with the minions's collision?
                            if (_Collision.bounds.Intersects(minion.GetCollision().bounds))
                            {
                                // Damage minion
                                minion.Damage(_Owner.GetOwner(), _Damage);

                                // Play impact sound
                                SoundManager._pInstance.PlayFireballImpact();

                                // Check if minion has been killed
                                if (minion.GetHealth() <= 0)
                                {
                                    // Add to instigator's kill count
                                    _Owner.GetOwner()._Player.AddKillCount();

                                    // Remove minion from the shield count (-1)
                                    ///meatMinion.GetOwner().GetOwner().GetComponentInChildren<Wep_Shield>().SetMinionCount(meatMinion.getowner)
                                    ///meatMinion.GetOwner().GetComponent<Wep_Shield>().SetMinionCount(meatMinion.GetOwner().GetComponent<Wep_Shield>().GetMinionCount() - 1);
                                }

                                // Destroy fireball
                                FreeProjectile();
                                _Active = false;
                                break;
                            }
                        }

                        // Has the fireball collided with the necromancer's collision?
                        if (_Collision.bounds.Intersects(necromancer.GetCollider().bounds) && _Active)
                        {
                            // Damage necromancer
                            necromancer.Damage(_Owner.GetOwner(), _Damage);

                            // Apply burn
                            necromancer.GetComponent <Char_Geomancer>().SetBurnState(true);

                            // Play impact sound
                            SoundManager._pInstance.PlayFireballImpact();

                            // Check if necromancer has been killed
                            if (necromancer.GetHealth() <= 0)
                            {
                                // Add to instigator's kill count
                                _Owner.GetOwner()._Player.AddKillCount();
                            }

                            // Destroy fireball
                            FreeProjectile();
                            break;
                        }
                    }
                }
            }
        }
    }