예제 #1
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;
                        }
                    }
                }
            }
        }
    }
예제 #2
0
    public void GeomancerCollisionChecks()
    {
        // Check against enemy player character
        if (MatchManager._pInstance.GetGameState() == MatchManager.GameState.Phase2)
        {
            if (PlayerManager._pInstance.GetActiveNecromancers().Count > 0)
            {
                // 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(), _ImpactDamage);

                                    // 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();
                                    }

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

                                    // 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(), _ImpactDamage /*+ (_ImpactDamage * _DamageMultiplier)*/);

                                // 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();
                                }

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

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