Ejemplo n.º 1
0
        public BoardUnit(Transform parent)
        {
            _gameplayManager    = GameClient.Get <IGameplayManager>();
            _loadObjectsManager = GameClient.Get <ILoadObjectsManager>();
            _soundManager       = GameClient.Get <ISoundManager>();
            _tutorialManager    = GameClient.Get <ITutorialManager>();
            _timerManager       = GameClient.Get <ITimerManager>();

            _battlegroundController = _gameplayManager.GetController <BattlegroundController>();
            _playerController       = _gameplayManager.GetController <PlayerController>();
            _animationsController   = _gameplayManager.GetController <AnimationsController>();
            _battleController       = _gameplayManager.GetController <BattleController>();
            _actionsQueueController = _gameplayManager.GetController <ActionsQueueController>();
            _vfxController          = _gameplayManager.GetController <VfxController>();
            _ranksController        = _gameplayManager.GetController <RanksController>();
            _abilitiesController    = _gameplayManager.GetController <AbilitiesController>();
            _cardsController        = _gameplayManager.GetController <CardsController>();
            _inputController        = _gameplayManager.GetController <InputController>();
            _boardArrowController   = _gameplayManager.GetController <BoardArrowController>();


            GameObject =
                Object.Instantiate(_loadObjectsManager.GetObjectByPath <GameObject>("Prefabs/Gameplay/BoardCreature"));
            GameObject.transform.SetParent(parent, false);

            _fightTargetingArrowPrefab =
                _loadObjectsManager.GetObjectByPath <GameObject>("Prefabs/Gameplay/Arrow/AttackArrowVFX_Object");

            _pictureSprite = GameObject.transform.Find("CreaturePicture").GetComponent <SpriteRenderer>();
            _frozenSprite  = GameObject.transform.Find("Other/Frozen").GetComponent <SpriteRenderer>();
            _glowSprite    = GameObject.transform.Find("Other/Glow").GetComponent <SpriteRenderer>();
            _shieldSprite  = GameObject.transform.Find("Other/Shield").gameObject;

            _glowSelectedObjectSprite = GameObject.transform.Find("Other/GlowSelectedObject").gameObject;

            _attackText = GameObject.transform.Find("Other/AttackAndDefence/AttackText").GetComponent <TextMeshPro>();
            _healthText = GameObject.transform.Find("Other/AttackAndDefence/DefenceText").GetComponent <TextMeshPro>();

            _sleepingParticles = GameObject.transform.Find("Other/SleepingParticles").GetComponent <ParticleSystem>();

            _unitContentObject = GameObject.transform.Find("Other").gameObject;
            _unitContentObject.SetActive(false);

            _inputController.UnitSelectedEvent   += UnitSelectedEventHandler;
            _inputController.UnitDeselectedEvent += UnitDeselectedEventHandler;

            BuffsOnUnit = new List <Enumerators.BuffType>();
            AttackedBoardObjectsThisTurn = new List <object>();

            _glowSprite.gameObject.SetActive(true);
            _glowSprite.enabled = false;

            IsCreatedThisTurn = true;

            UnitStatus = Enumerators.UnitStatusType.NONE;

            IsAllAbilitiesResolvedAtStart = true;

            _gameplayManager.CanDoDragActions = false;
        }
Ejemplo n.º 2
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>();
        }
Ejemplo n.º 3
0
        public void Init()
        {
            _gameplayManager    = GameClient.Get <IGameplayManager>();
            _timerManager       = GameClient.Get <ITimerManager>();
            _loadObjectsManager = GameClient.Get <ILoadObjectsManager>();
            _dataManager        = GameClient.Get <IDataManager>();
            _soundManager       = GameClient.Get <ISoundManager>();
            _tutorialManager    = GameClient.Get <ITutorialManager>();
            _uiManager          = GameClient.Get <IUIManager>();

            _battlegroundController = _gameplayManager.GetController <BattlegroundController>();
            _vfxController          = _gameplayManager.GetController <VfxController>();
            _abilitiesController    = _gameplayManager.GetController <AbilitiesController>();
            _actionsQueueController = _gameplayManager.GetController <ActionsQueueController>();
            _animationsController   = _gameplayManager.GetController <AnimationsController>();
            _ranksController        = _gameplayManager.GetController <RanksController>();

            CreatureCardViewPrefab =
                _loadObjectsManager.GetObjectByPath <GameObject>("Prefabs/Gameplay/Cards/CreatureCard");
            SpellCardViewPrefab = _loadObjectsManager.GetObjectByPath <GameObject>("Prefabs/Gameplay/Cards/SpellCard");
            OpponentCardPrefab  = _loadObjectsManager.GetObjectByPath <GameObject>("Prefabs/Gameplay/Cards/OpponentCard");

            _gameplayManager.GameStarted += GameStartedHandler;
            _gameplayManager.GameEnded   += GameEndedHandler;

            _indexOfCard = -1;
        }
Ejemplo n.º 4
0
        private void TargetUnitDiedHandler()
        {
            if (TargetUnit != null)
            {
                TargetUnit.UnitDied -= TargetUnitDiedHandler;
            }

            AbilitiesController.DeactivateAbility(ActivityId);
        }
Ejemplo n.º 5
0
        public void Init()
        {
            _gameplayManager = GameClient.Get <IGameplayManager>();
            _tutorialManager = GameClient.Get <ITutorialManager>();

            _actionsQueueController = _gameplayManager.GetController <ActionsQueueController>();
            _abilitiesController    = _gameplayManager.GetController <AbilitiesController>();
            _vfxController          = _gameplayManager.GetController <VfxController>();

            FillStrongersAndWeakers();
        }
Ejemplo n.º 6
0
        private void CountDelay()
        {
            if (_delayedTurnsLeft == 0)
            {
                Action();

                AbilitiesController.DeactivateAbility(ActivityId);
            }

            _delayedTurnsLeft--;
        }
Ejemplo n.º 7
0
        public BoardCard(GameObject selfObject)
        {
            LoadObjectsManager = GameClient.Get <ILoadObjectsManager>();
            SoundManager       = GameClient.Get <ISoundManager>();
            DataManager        = GameClient.Get <IDataManager>();
            GameplayManager    = GameClient.Get <IGameplayManager>();
            TimerManager       = GameClient.Get <ITimerManager>();

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

            GameObject = selfObject;

            ElementSlotsOfCards = new List <ElementSlotOfCards>();

            CardAnimator         = GameObject.GetComponent <Animator>();
            CardAnimator.enabled = false;

            GlowSprite       = Transform.Find("Glow").GetComponent <SpriteRenderer>();
            PictureSprite    = Transform.Find("Picture").GetComponent <SpriteRenderer>();
            BackgroundSprite = Transform.Find("Frame").GetComponent <SpriteRenderer>();

            CostText   = Transform.Find("GooText").GetComponent <TextMeshPro>();
            NameText   = Transform.Find("TitleText").GetComponent <TextMeshPro>();
            BodyText   = Transform.Find("BodyText").GetComponent <TextMeshPro>();
            AmountText = Transform.Find("Amount/Text").GetComponent <TextMeshPro>();

            RemoveCardParticle = Transform.Find("RemoveCardParticle").GetComponent <ParticleSystem>();

            DistibuteCardObject = Transform.Find("DistributeCardObject").gameObject;

            ParentOfEditingGroupUI = Transform.Find("DeckEditingGroupUI");

            AnimationEventTriggering = GameObject.GetComponent <AnimationEventTriggering>();
            BehaviourHandler         = GameObject.GetComponent <OnBehaviourHandler>();

            AnimationEventTriggering.AnimationEventTriggered += OnAnimationEvent;

            CardsController.UpdateCardsStatusEvent += UpdateCardsStatusEventHandler;

            BehaviourHandler.MouseDownTriggered += MouseDownTriggeredHandler;
            BehaviourHandler.MouseUpTriggered   += MouseUpTriggeredHandler;

            BehaviourHandler.Destroying += DestroyingHandler;
        }
Ejemplo n.º 8
0
        public void Init()
        {
            _gameplayManager    = GameClient.Get <IGameplayManager>();
            _dataManager        = GameClient.Get <IDataManager>();
            _tutorialManager    = GameClient.Get <ITutorialManager>();
            _loadObjectsManager = GameClient.Get <ILoadObjectsManager>();

            _abilitiesController    = _gameplayManager.GetController <AbilitiesController>();
            _battlegroundController = _gameplayManager.GetController <BattlegroundController>();
            _cardsController        = _gameplayManager.GetController <CardsController>();
            _actionsQueueController = _gameplayManager.GetController <ActionsQueueController>();
            _skillsController       = _gameplayManager.GetController <SkillsController>();

            _gameplayManager.GameEnded   += GameEndedHandler;
            _gameplayManager.GameStarted += GameStartedHandler;

            _normalUnitCardInHand  = new List <WorkingCard>();
            _normalSpellCardInHand = new List <WorkingCard>();
        }
Ejemplo n.º 9
0
        protected override void TurnEndedHandler()
        {
            base.TurnEndedHandler();

            Player opponent = GetOpponentOverlord();

            foreach (BoardUnit unit in opponent.BoardCards)
            {
                if (unit.DamageDebuffUntillEndOfTurn != 0)
                {
                    unit.CurrentDamage += Mathf.Abs(unit.DamageDebuffUntillEndOfTurn);
                    unit.DamageDebuffUntillEndOfTurn = 0;
                }

                if (unit.HpDebuffUntillEndOfTurn != 0)
                {
                    unit.CurrentHp += Mathf.Abs(unit.HpDebuffUntillEndOfTurn);
                    unit.HpDebuffUntillEndOfTurn = 0;
                }
            }

            AbilitiesController.DeactivateAbility(ActivityId);
        }