예제 #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
        private void ReviveUnit(WorkingCard workingCard)
        {
            Player playerOwner = workingCard.Owner;

            if (playerOwner.BoardCards.Count >= Constants.MaxBoardUnits)
            {
                return;
            }

            Card libraryCard = workingCard.LibraryCard.Clone();

            WorkingCard card = new WorkingCard(libraryCard, playerOwner);
            BoardUnit   unit = BattlegroundController.CreateBoardUnit(playerOwner, card);

            playerOwner.RemoveCardFromGraveyard(workingCard);
            playerOwner.AddCardToBoard(card);
            playerOwner.BoardCards.Add(unit);

            if (playerOwner.IsLocalPlayer)
            {
                BattlegroundController.PlayerBoardCards.Add(unit);
                BattlegroundController.UpdatePositionOfBoardUnitsOfPlayer(GameplayManager.CurrentPlayer.BoardCards);
            }
            else
            {
                BattlegroundController.OpponentBoardCards.Add(unit);
                BattlegroundController.UpdatePositionOfBoardUnitsOfOpponent();
            }
        }
예제 #3
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;
        }
예제 #4
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;
        }
        public void Init()
        {
            _gameplayManager = GameClient.Get <IGameplayManager>();
            _timerManager    = GameClient.Get <ITimerManager>();

            _battlegroundController = _gameplayManager.GetController <BattlegroundController>();
        }
        public override void Action(object info = null)
        {
            base.Action(info);

            BoardUnit unit = info as BoardUnit;

            BattlegroundController.DestroyBoardUnit(unit);
        }
        protected override void InputEndedHandler()
        {
            base.InputEndedHandler();

            if (IsAbilityResolved)
            {
                BattlegroundController.TakeControlUnit(PlayerCallerOfAbility, TargetUnit);
            }
        }
        public void Init()
        {
            _activeAbilities = new List <ActiveAbility>();

            _gameplayManager = GameClient.Get <IGameplayManager>();
            _tutorialManager = GameClient.Get <ITutorialManager>();

            _cardsController        = _gameplayManager.GetController <CardsController>();
            _playerController       = _gameplayManager.GetController <PlayerController>();
            _battlegroundController = _gameplayManager.GetController <BattlegroundController>();
            _actionsQueueController = _gameplayManager.GetController <ActionsQueueController>();
        }
예제 #9
0
        public void Init()
        {
            _uiManager          = GameClient.Get <IUIManager>();
            _soundManager       = GameClient.Get <ISoundManager>();
            _loadObjectsManager = GameClient.Get <ILoadObjectsManager>();
            _dataManager        = GameClient.Get <IDataManager>();
            _gameplayManager    = GameClient.Get <IGameplayManager>();

            _battlegroundController = _gameplayManager.GetController <BattlegroundController>();

            // card vs player
            _targettingArrowPrefab = GameClient.Get <ILoadObjectsManager>().GetObjectByPath <GameObject>("Prefabs/Gameplay/Arrow/AttackArrowVFX_Object");

            _tutorials = JsonConvert.DeserializeObject <TutorialContentData>(_loadObjectsManager
                                                                             .GetObjectByPath <TextAsset>("Data/tutorial_data").text).TutorialDatas;
        }
예제 #10
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;
        }
예제 #11
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>();
        }
예제 #12
0
        public void Init()
        {
            _gameplayManager = GameClient.Get <IGameplayManager>();
            _dataManager     = GameClient.Get <IDataManager>();
            _tutorialManager = GameClient.Get <ITutorialManager>();
            _timerManager    = GameClient.Get <ITimerManager>();

            _cardsController        = _gameplayManager.GetController <CardsController>();
            _battlegroundController = _gameplayManager.GetController <BattlegroundController>();
            _boardArrowController   = _gameplayManager.GetController <BoardArrowController>();

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

            _pointerEventSolver              = new PointerEventSolver();
            _pointerEventSolver.DragStarted += PointerSolverDragStartedHandler;
            _pointerEventSolver.Clicked     += PointerEventSolverClickedHandler;
            _pointerEventSolver.Ended       += PointerEventSolverEndedHandler;
        }
예제 #13
0
        private void DevourTargetZombie(BoardUnit unit)
        {
            if (unit.Equals(AbilityUnitOwner))
            {
                return;
            }

            int health = unit.InitialHp;
            int damage = unit.InitialDamage;

            BattlegroundController.DestroyBoardUnit(unit);

            AbilityUnitOwner.BuffedHp  += health;
            AbilityUnitOwner.CurrentHp += health;

            AbilityUnitOwner.BuffedDamage  += damage;
            AbilityUnitOwner.CurrentDamage += damage;

            CreateVfx(unit.Transform.position, true, 5f);
        }
예제 #14
0
        public override void Action(object info = null)
        {
            base.Action(info);

            if (AbilityUnitOwner.IsReanimated)
            {
                return;
            }

            Player      owner       = AbilityUnitOwner.OwnerPlayer;
            Card        libraryCard = AbilityUnitOwner.Card.LibraryCard.Clone();
            WorkingCard card        = new WorkingCard(libraryCard, owner);
            BoardUnit   unit        = CreateBoardUnit(card, owner);

            unit.IsReanimated             = true;
            AbilityUnitOwner.IsReanimated = true;

            owner.AddCardToBoard(card);
            owner.BoardCards.Add(unit);

            if (!owner.IsLocalPlayer)
            {
                BattlegroundController.OpponentBoardCards.Add(unit);
                BattlegroundController.UpdatePositionOfBoardUnitsOfOpponent();
            }
            else
            {
                BattlegroundController.PlayerBoardCards.Add(unit);
                BattlegroundController.UpdatePositionOfBoardUnitsOfPlayer(GameplayManager.CurrentPlayer.BoardCards);
            }

            ActionsQueueController.PostGameActionReport(ActionsQueueController.FormatGameActionReport(
                                                            Enumerators.ActionType.REANIMATE_UNIT_BY_ABILITY, new object[]
            {
                owner, unit
            }));
        }
예제 #15
0
        public Player(GameObject playerObject, bool isOpponent)
        {
            PlayerObject  = playerObject;
            IsLocalPlayer = !isOpponent;

            _dataManager     = GameClient.Get <IDataManager>();
            _gameplayManager = GameClient.Get <IGameplayManager>();
            _soundManager    = GameClient.Get <ISoundManager>();

            _cardsController        = _gameplayManager.GetController <CardsController>();
            _battlegroundController = _gameplayManager.GetController <BattlegroundController>();
            _skillsController       = _gameplayManager.GetController <SkillsController>();
            _animationsController   = _gameplayManager.GetController <AnimationsController>();

            CardsInDeck      = new List <WorkingCard>();
            CardsInGraveyard = new List <WorkingCard>();
            CardsInHand      = new List <WorkingCard>();
            CardsOnBoard     = new List <WorkingCard>();
            BoardCards       = new List <BoardUnit>();

            CardsPreparingToHand = new List <BoardCard>();

            int heroId;

            if (!isOpponent)
            {
                if (!_gameplayManager.IsTutorial)
                {
                    heroId = _dataManager.CachedDecksData.Decks.First(d => d.Id == _gameplayManager.PlayerDeckId)
                             .HeroId;
                }
                else
                {
                    heroId = Constants.TutorialPlayerHeroId;
                }
            }
            else
            {
                heroId = _dataManager.CachedOpponentDecksData.Decks.First(d => d.Id == _gameplayManager.OpponentDeckId)
                         .HeroId;
            }

            SelfHero = _dataManager.CachedHeroesData.HeroesParsed[heroId];

            _health   = Constants.DefaultPlayerHp;
            InitialHp = _health;
            BuffedHp  = 0;
            _goo      = Constants.DefaultPlayerGoo;

            _avatarObject            = playerObject.transform.Find("Avatar/Hero_Object").gameObject;
            _overlordRegularObject   = playerObject.transform.Find("OverlordArea/RegularModel").gameObject;
            _overlordDeathObject     = playerObject.transform.Find("OverlordArea/OverlordDeath").gameObject;
            _avatarHeroHighlight     = playerObject.transform.Find("Avatar/HeroHighlight").gameObject;
            _avatarSelectedHighlight = playerObject.transform.Find("Avatar/SelectedHighlight").gameObject;

            _avatarAnimator = playerObject.transform.Find("Avatar/Hero_Object").GetComponent <Animator>();
            _deathAnimator  = _overlordDeathObject.GetComponent <Animator>();
            _gooBarFadeTool = playerObject.transform.Find("Avatar/Hero_Object").GetComponent <FadeTool>();

            _freezedHighlightObject = playerObject.transform.Find("Avatar/FreezedHighlight").gameObject;

            _avatarAnimator.enabled = false;
            _deathAnimator.enabled  = false;
            _deathAnimator.StopPlayback();

            PlayerHpChanged += PlayerHpChangedHandler;

            DamageByNoMoreCardsInDeck = 0;
        }
예제 #16
0
        public void StartGame()
        {
            if (_battlegroundController == null)
            {
                _battlegroundController = _gameplayManager.GetController <BattlegroundController>();

                _battlegroundController.PlayerGraveyardUpdated   += PlayerGraveyardUpdatedHandler;
                _battlegroundController.OpponentGraveyardUpdated += OpponentGraveyardUpdatedHandler;
            }

            _gameplayManager.PlayerDeckId = CurrentDeckId;

            OpponentDeck randomOpponentDeck =
                _dataManager.CachedOpponentDecksData.Decks[
                    Random.Range(0, _dataManager.CachedOpponentDecksData.Decks.Count)];

            _gameplayManager.OpponentDeckId = randomOpponentDeck.Id;

            //Debug.Log(_tutorialManager.CurrentTutorial.SpecificBattlegroundInfo);
            //Debug.Log(_tutorialManager.CurrentTutorial.SpecificBattlegroundInfo.OpponentInfo);
            //Debug.Log(_tutorialManager.CurrentTutorial.SpecificBattlegroundInfo.OpponentInfo.HeroId);
            int heroId         = 0; //Constants.TutorialPlayerHeroId; // TUTORIAL
            int opponentHeroId = 0;

            if (!_gameplayManager.IsTutorial)
            {
                heroId         = _dataManager.CachedDecksData.Decks.First(o => o.Id == CurrentDeckId).HeroId;
                opponentHeroId = randomOpponentDeck.HeroId;
            }
            else
            {
                heroId         = _tutorialManager.CurrentTutorial.SpecificBattlegroundInfo.PlayerInfo.HeroId;
                opponentHeroId = _tutorialManager.CurrentTutorial.SpecificBattlegroundInfo.OpponentInfo.HeroId;
            }


            Hero currentPlayerHero   = _dataManager.CachedHeroesData.HeroesParsed[heroId];
            Hero currentOpponentHero = _dataManager.CachedHeroesData.HeroesParsed[opponentHeroId];

            _playerDeckStatusTexture   = GameObject.Find("Player/Deck_Illustration/Deck").GetComponent <SpriteRenderer>();
            _opponentDeckStatusTexture =
                GameObject.Find("Opponent/Deck_Illustration/Deck").GetComponent <SpriteRenderer>();
            _playerGraveyardStatusTexture = GameObject.Find("Player/Graveyard_Illustration/Graveyard")
                                            .GetComponent <SpriteRenderer>();
            _opponentGraveyardStatusTexture = GameObject.Find("Opponent/Graveyard_Illustration/Graveyard")
                                              .GetComponent <SpriteRenderer>();

            _playerHealthText   = GameObject.Find("Player/Avatar/LivesCircle/DefenceText").GetComponent <TextMeshPro>();
            _opponentHealthText =
                GameObject.Find("Opponent/Avatar/LivesCircle/DefenceText").GetComponent <TextMeshPro>();

            _playerManaBar = new PlayerManaBarItem(GameObject.Find("PlayerManaBar"), "GooOverflowPlayer",
                                                   new Vector3(-3.55f, 0, -6.07f));
            _opponentManaBar = new PlayerManaBarItem(GameObject.Find("OpponentManaBar"), "GooOverflowOpponent",
                                                     new Vector3(9.77f, 0, 4.75f));

            // improve find to get it from OBJECTS ON BOARD!!
            _playerNameText   = GameObject.Find("Player/NameBoard/NameText").GetComponent <TextMeshPro>();
            _opponentNameText = GameObject.Find("Opponent/NameBoard/NameText").GetComponent <TextMeshPro>();

            _playerCardDeckCountText   = GameObject.Find("Player/CardDeckText").GetComponent <TextMeshPro>();
            _opponentCardDeckCountText = GameObject.Find("Opponent/CardDeckText").GetComponent <TextMeshPro>();

            _endTurnButton = GameObject.Find("EndTurnButton");

            PlayerPrimarySkillHandler =
                GameObject.Find("Player").transform.Find("Object_SpellPrimary").GetComponent <OnBehaviourHandler>();
            PlayerSecondarySkillHandler =
                GameObject.Find("Player").transform.Find("Object_SpellSecondary").GetComponent <OnBehaviourHandler>();

            OpponentPrimarySkillHandler =
                GameObject.Find("Opponent").transform.Find("Object_SpellPrimary").GetComponent <OnBehaviourHandler>();
            OpponentSecondarySkillHandler =
                GameObject.Find("Opponent").transform.Find("Object_SpellSecondary").GetComponent <OnBehaviourHandler>();

            if (currentPlayerHero != null)
            {
                SetHeroInfo(currentPlayerHero, "Player", PlayerPrimarySkillHandler.gameObject,
                            PlayerSecondarySkillHandler.gameObject);
                string playerNameText = currentPlayerHero.FullName;
                if (_backendDataControlMediator.LoadUserDataModel())
                {
                    playerNameText = _backendDataControlMediator.UserDataModel.UserId;
                }

                _playerNameText.text = playerNameText;
            }

            if (currentOpponentHero != null)
            {
                SetHeroInfo(currentOpponentHero, "Opponent", OpponentPrimarySkillHandler.gameObject,
                            OpponentSecondarySkillHandler.gameObject);
                _opponentNameText.text = currentOpponentHero.FullName;
            }

            _isPlayerInited = true;
        }