protected override void CreateVfx(
            Vector3 pos, bool autoDestroy = false, float duration = 3f, bool justPosition = false)
        {
            int playerPos = PlayerCallerOfAbility.IsLocalPlayer ? 1 : -1;

            switch (AbilityEffectType)
            {
            case Enumerators.AbilityEffectType.MASSIVE_WATER_WAVE:
                VfxObject = LoadObjectsManager.GetObjectByPath <GameObject>("Prefabs/VFX/Spells/ToxicMassiveAllVFX");
                break;

            case Enumerators.AbilityEffectType.MASSIVE_FIRE:
                VfxObject = LoadObjectsManager.GetObjectByPath <GameObject>(
                    "Prefabs/VFX/Spells/SpellMassiveFireVFX");
                break;

            case Enumerators.AbilityEffectType.MASSIVE_LIGHTNING:
                VfxObject = LoadObjectsManager.GetObjectByPath <GameObject>("Prefabs/VFX/Spells/LightningVFX");
                pos       = Vector3.up * 0.5f;
                break;

            case Enumerators.AbilityEffectType.MASSIVE_TOXIC_ALL:
                VfxObject = LoadObjectsManager.GetObjectByPath <GameObject>("Prefabs/VFX/Spells/ToxicMassiveAllVFX");
                pos       = Vector3.zero;
                break;
            }

            pos = Utilites.CastVfxPosition(pos * playerPos);

            ClearParticles();

            base.CreateVfx(pos, true, 5f);
        }
Esempio n. 2
0
        public void CreateVfx(GameObject prefab, object target, bool autoDestroy = true, float delay = 3f)
        {
            if (prefab == null)
            {
                return;
            }

            Vector3 position = Vector3.zero;

            switch (target)
            {
            case BoardUnit unit:
                position = unit.Transform.position;
                break;

            case Player player:
                position = player.AvatarObject.transform.position;
                break;

            case Transform transform:
                position = transform.transform.position;
                break;
            }

            GameObject particle = Object.Instantiate(prefab);

            particle.transform.position = Utilites.CastVfxPosition(position + Vector3.forward);
            _particlesController.RegisterParticleSystem(particle, autoDestroy, delay);
        }
Esempio n. 3
0
        private void CreateAndMoveParticle(Action callback, Vector3 targetPosition)
        {
            Vector3 startPosition = CardKind == Enumerators.CardKind.CREATURE ?
                                    AbilityUnitOwner.Transform.position :
                                    SelectedPlayer.Transform.position;

            if (AbilityCallType != Enumerators.AbilityCallType.ATTACK)
            {
                GameObject particleMain = Object.Instantiate(VfxObject);
                particleMain.transform.position = Utilites.CastVfxPosition(startPosition + Vector3.forward);
                particleMain.transform.DOMove(Utilites.CastVfxPosition(targetPosition), 0.5f).OnComplete(
                    () =>
                {
                    callback();
                    if (AbilityEffectType == Enumerators.AbilityEffectType.TARGET_ADJUSTMENTS_BOMB)
                    {
                        DestroyParticle(particleMain, true);
                        GameObject prefab =
                            LoadObjectsManager.GetObjectByPath <GameObject>("Prefabs/VFX/toxicDamageVFX");
                        GameObject particle         = Object.Instantiate(prefab);
                        particle.transform.position = Utilites.CastVfxPosition(targetPosition + Vector3.forward);
                        ParticlesController.RegisterParticleSystem(particle, true);

                        SoundManager.PlaySound(Enumerators.SoundType.SPELLS, "NailBomb",
                                               Constants.SpellAbilitySoundVolume, Enumerators.CardSoundType.NONE);
                    }
                    else if (AbilityEffectType == Enumerators.AbilityEffectType.TARGET_ADJUSTMENTS_AIR)
                    {
                        // one particle
                        ParticleSystem.MainModule main = VfxObject.GetComponent <ParticleSystem>().main;
                        main.loop = false;
                    }
                });
            }
            else
            {
                CreateVfx(Utilites.CastVfxPosition(TargetUnit.Transform.position));
                callback();
            }

            GameClient.Get <IGameplayManager>().RearrangeHands();
        }
Esempio n. 4
0
        public void CreateSkillVfx(GameObject prefab, Vector3 from, object target, Action <object> callbackComplete)
        {
            if (target == null)
            {
                return;
            }

            GameObject particleSystem = Object.Instantiate(prefab);

            particleSystem.transform.position = Utilites.CastVfxPosition(from + Vector3.forward);

            switch (target)
            {
            case Player player:
                particleSystem.transform
                .DOMove(Utilites.CastVfxPosition(player.AvatarObject.transform.position), .5f).OnComplete(
                    () =>
                {
                    callbackComplete(target);

                    if (particleSystem != null)
                    {
                        Object.Destroy(particleSystem);
                    }
                });
                break;

            case BoardUnit unit:
                particleSystem.transform.DOMove(Utilites.CastVfxPosition(unit.Transform.position), .5f).OnComplete(
                    () =>
                {
                    callbackComplete(target);

                    if (particleSystem != null)
                    {
                        Object.Destroy(particleSystem);
                    }
                });
                break;
            }
        }
        protected override void CreateVfx(
            Vector3 pos, bool autoDestroy = false, float duration = 3f, bool justPosition = false)
        {
            switch (AbilityEffectType)
            {
            case Enumerators.AbilityEffectType.TARGET_ROCK:
                VfxObject = LoadObjectsManager.GetObjectByPath <GameObject>(
                    "Prefabs/VFX/Spells/SpellTargetFireAttack");
                break;

            case Enumerators.AbilityEffectType.TARGET_FIRE:
                VfxObject = LoadObjectsManager.GetObjectByPath <GameObject>(
                    "Prefabs/VFX/Spells/SpellTargetFireAttack");
                break;

            case Enumerators.AbilityEffectType.TARGET_LIFE:
                VfxObject = LoadObjectsManager.GetObjectByPath <GameObject>(
                    "Prefabs/VFX/Spells/SpellTargetLifeAttack");
                break;

            case Enumerators.AbilityEffectType.TARGET_TOXIC:
                VfxObject = LoadObjectsManager.GetObjectByPath <GameObject>(
                    "Prefabs/VFX/Spells/SpellTargetToxicAttack");
                break;
            }

            Vector3 targetPosition = AffectObjectType == Enumerators.AffectObjectType.CHARACTER ?
                                     TargetUnit.Transform.position :
                                     TargetPlayer.AvatarObject.transform.position;

            VfxObject = Object.Instantiate(VfxObject);
            VfxObject.transform.position = Utilites.CastVfxPosition(AbilityUnitOwner.Transform.position);
            targetPosition = Utilites.CastVfxPosition(targetPosition);
            VfxObject.transform.DOMove(targetPosition, 0.5f).OnComplete(ActionCompleted);
            ulong id = ParticlesController.RegisterParticleSystem(VfxObject, autoDestroy, duration);

            if (!autoDestroy)
            {
                ParticleIds.Add(id);
            }
        }
Esempio n. 6
0
        public void PlayAttackVfx(Enumerators.CardType type, Vector3 target, int damage)
        {
            GameObject effect;
            GameObject vfxPrefab;

            target = Utilites.CastVfxPosition(target);
            Vector3 offset = Vector3.forward * 1;

            switch (type)
            {
            case Enumerators.CardType.FERAL:
            {
                vfxPrefab = _loadObjectsManager.GetObjectByPath <GameObject>("Prefabs/VFX/FeralAttackVFX");
                effect    = Object.Instantiate(vfxPrefab);
                effect.transform.position = target - offset;
                _soundManager.PlaySound(Enumerators.SoundType.FERAL_ATTACK, Constants.CreatureAttackSoundVolume,
                                        false, false, true);

                _particlesController.RegisterParticleSystem(effect, true, 5f);

                if (damage > 3 && damage < 7)
                {
                    _timerManager.AddTimer(
                        a =>
                        {
                            effect = Object.Instantiate(vfxPrefab);
                            effect.transform.position   = target - offset;
                            effect.transform.localScale = new Vector3(-1, 1, 1);
                            _particlesController.RegisterParticleSystem(effect, true, 5f);
                        },
                        null,
                        0.5f);
                }

                if (damage > 6)
                {
                    _timerManager.AddTimer(
                        a =>
                        {
                            effect = Object.Instantiate(vfxPrefab);
                            effect.transform.position    = target - Vector3.right - offset;
                            effect.transform.eulerAngles = Vector3.forward * 90;

                            _particlesController.RegisterParticleSystem(effect, true, 5f);
                        });
                }

                break;
            }

            case Enumerators.CardType.HEAVY:
            {
                Enumerators.SoundType soundType = Enumerators.SoundType.HEAVY_ATTACK_1;
                string prefabName = "Prefabs/VFX/HeavyAttackVFX";
                if (damage > 4)
                {
                    prefabName = "Prefabs/VFX/HeavyAttack2VFX";
                    soundType  = Enumerators.SoundType.HEAVY_ATTACK_2;
                }

                vfxPrefab = _loadObjectsManager.GetObjectByPath <GameObject>(prefabName);
                effect    = Object.Instantiate(vfxPrefab);
                effect.transform.position = target;

                _particlesController.RegisterParticleSystem(effect, true, 5f);

                _soundManager.PlaySound(soundType, Constants.CreatureAttackSoundVolume, false, false, true);
                break;
            }

            default:
            {
                vfxPrefab = _loadObjectsManager.GetObjectByPath <GameObject>("Prefabs/VFX/WalkerAttackVFX");
                effect    = Object.Instantiate(vfxPrefab);
                effect.transform.position = target - offset;

                _particlesController.RegisterParticleSystem(effect, true, 5f);

                if (damage > 4)
                {
                    _timerManager.AddTimer(
                        a =>
                        {
                            effect = Object.Instantiate(vfxPrefab);
                            effect.transform.position = target - offset;

                            effect.transform.localScale = new Vector3(-1, 1, 1);
                            _particlesController.RegisterParticleSystem(effect, true, 5f);
                        },
                        null,
                        0.5f);

                    _soundManager.PlaySound(Enumerators.SoundType.WALKER_ATTACK_2,
                                            Constants.CreatureAttackSoundVolume, false, false, true);
                }
                else
                {
                    _soundManager.PlaySound(Enumerators.SoundType.WALKER_ATTACK_1,
                                            Constants.CreatureAttackSoundVolume, false, false, true);
                }

                break;
            }
            }
        }