示例#1
0
        public AbilityBase(Enumerators.CardKind cardKind, AbilityData ability)
        {
            LoadObjectsManager = GameClient.Get <ILoadObjectsManager>();
            GameplayManager    = GameClient.Get <IGameplayManager>();
            DataManager        = GameClient.Get <IDataManager>();
            TimerManager       = GameClient.Get <ITimerManager>();
            SoundManager       = GameClient.Get <ISoundManager>();

            AbilitiesController    = GameplayManager.GetController <AbilitiesController>();
            ParticlesController    = GameplayManager.GetController <ParticlesController>();
            BattleController       = GameplayManager.GetController <BattleController>();
            ActionsQueueController = GameplayManager.GetController <ActionsQueueController>();
            BattlegroundController = GameplayManager.GetController <BattlegroundController>();
            CardsController        = GameplayManager.GetController <CardsController>();

            AbilityData         = ability;
            CardKind            = cardKind;
            AbilityActivityType = ability.AbilityActivityType;
            AbilityCallType     = ability.AbilityCallType;
            AbilityTargetTypes  = ability.AbilityTargetTypes;
            AbilityEffectType   = ability.AbilityEffectType;
            _playerAvatar       = GameplayManager.CurrentPlayer;
            _opponenentAvatar   = GameplayManager.OpponentPlayer;

            PermanentInputEndEvent += InputEndedHandler;

            ParticleIds = new List <ulong>();
        }
示例#2
0
 public void Init()
 {
     _timerManager        = GameClient.Get <ITimerManager>();
     _soundManager        = GameClient.Get <ISoundManager>();
     _loadObjectsManager  = GameClient.Get <ILoadObjectsManager>();
     _gameplayManager     = GameClient.Get <IGameplayManager>();
     _particlesController = _gameplayManager.GetController <ParticlesController>();
 }
        private void ActionCompleted()
        {
            object caller = AbilityUnitOwner != null ? AbilityUnitOwner : (object)BoardSpell;

            switch (AffectObjectType)
            {
            case Enumerators.AffectObjectType.PLAYER:
                BattleController.AttackPlayerByAbility(caller, AbilityData, TargetPlayer);
                break;

            case Enumerators.AffectObjectType.CHARACTER:
                BattleController.AttackUnitByAbility(caller, AbilityData, TargetUnit);
                break;
            }

            Vector3 targetPosition = VfxObject.transform.position;

            ClearParticles();

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

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

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

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

            if (VfxObject != null)
            {
                VfxObject = Object.Instantiate(VfxObject);
                VfxObject.transform.position = targetPosition;
                ParticlesController.RegisterParticleSystem(VfxObject, true);
            }
        }
示例#4
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();
        }
        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);
            }
        }