예제 #1
0
        public BoardSpell(GameObject obj, WorkingCard card)
        {
            GameObject = obj;
            Transform  = obj.transform;

            Card = card;

            _eventHandler = GameObject.GetComponent <OnBehaviourHandler>();

            _eventHandler.Destroying += DestroyingHandler;
        }
예제 #2
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;
        }
예제 #3
0
        public BoardSkill(GameObject obj, Player player, HeroSkill skillInfo, bool isPrimary)
        {
            SelfObject = obj;
            Skill      = skillInfo;
            Owner      = player;
            IsPrimary  = isPrimary;

            _initialCooldown = skillInfo.InitialCooldown;
            _cooldown        = skillInfo.Cooldown;

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

            _playerController     = _gameplayManager.GetController <PlayerController>();
            _skillsController     = _gameplayManager.GetController <SkillsController>();
            _boardArrowController = _gameplayManager.GetController <BoardArrowController>();

            _glowObjectSprite = SelfObject.transform.Find("Glow").GetComponent <SpriteRenderer>();
            _glowObjectSprite.gameObject.SetActive(false);

            _cooldownText = SelfObject.transform.Find("SpellCost/SpellCostText").GetComponent <TextMeshPro>();

            string name = isPrimary ? "1stShutters" : "2ndtShutters";

            _shutterAnimator = SelfObject.transform.parent.transform
                               .Find("OverlordArea/RegularModel/CZB_3D_Overlord_death_regular_LOD0/" + name).GetComponent <Animator>();
            _shutterAnimator.enabled = false;
            _shutterAnimator.StopPlayback();

            Owner.TurnStarted += TurnStartedHandler;
            Owner.TurnEnded   += TurnEndedHandler;

            _behaviourHandler = SelfObject.GetComponent <OnBehaviourHandler>();
            {
                _pointerEventSolver              = new PointerEventSolver();
                _pointerEventSolver.DragStarted += PointerSolverDragStartedHandler;
                _pointerEventSolver.Clicked     += PointerEventSolverClickedHandler;
                _pointerEventSolver.Ended       += PointerEventSolverEndedHandler;
            }

            _cooldownText.text = _cooldown.ToString();

            _fightTargetingArrowPrefab =
                _loadObjectsManager.GetObjectByPath <GameObject>("Prefabs/Gameplay/Arrow/AttackArrowVFX_Object");
        }
예제 #4
0
        public ReportViewBase(GameObject prefab, Transform parent, GameActionReport gameAction)
        {
            LoadObjectsManager     = GameClient.Get <ILoadObjectsManager>();
            GameplayManager        = GameClient.Get <IGameplayManager>();
            ActionsQueueController = GameplayManager.GetController <ActionsQueueController>();
            CardsController        = GameplayManager.GetController <CardsController>();

            GameAction = gameAction;
            SelfObject = Object.Instantiate(prefab, parent, false);
            SelfObject.transform.SetSiblingIndex(0);
            PreviewImage = SelfObject.transform.Find("Image").GetComponent <Image>();

            OnBehaviourHandler behaviour = SelfObject.GetComponent <OnBehaviourHandler>();

            behaviour.PointerEntered += PointerEnteredHandler;
            behaviour.PointerExited  += PointerExitedHandler;

            PlayerAvatarPreviewPrefab =
                LoadObjectsManager.GetObjectByPath <GameObject>("Prefabs/Gameplay/PlayerAvatarPreview");
            AttackingHealthPrefab = LoadObjectsManager.GetObjectByPath <GameObject>("Prefabs/Gameplay/AttackingHealth");

            CreatePreviewPanel();
        }
예제 #5
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;
        }