コード例 #1
0
ファイル: BoardUnit.cs プロジェクト: luanhailiang/Relentless
        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;
        }
コード例 #2
0
ファイル: BoardSkill.cs プロジェクト: luanhailiang/Relentless
        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");
        }
コード例 #3
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;
        }