コード例 #1
0
        public virtual void Initialize(Vector2Int position, bool isInitializingGame)
        {
            this.Origin = position;

            // 自分自身のマスターデータを取得してデータを参照している
            // セーブデータから読み込む時にアセットの参照はセーブしていないのでちょっとややこしい作りになっている
            this.cachedRecord = GameSystem.Instance.MasterData.CellEvent.Records.Get(this.Id);
            this.Gimmick      = this.cachedRecord.EventData.CreateGimmickController(this.Origin);

            foreach (var g in this.Gimmick.GetComponentsInChildren <ICellEventGimmick>())
            {
                g.Attach(this);
            }

            if (!isInitializingGame)
            {
                Assert.IsNotNull(this.cachedRecord.EventData.constructionSE, $"Id = {this.Id}の建設時のSE再生に失敗しました");
                GameSystem.Instance.SEController.Play(this.cachedRecord.EventData.constructionSE);

                Assert.IsNotNull(this.cachedRecord.EventData.constructionEffect, $"Id = {this.Id}の建設時のエフェクト生成に失敗しました");
                var effect = this.cachedRecord.EventData.constructionEffect.Rent();
                effect.transform.position   = this.Gimmick.transform.position;
                effect.transform.localScale = Vector3.one * this.cachedRecord.EventData.size;

                this.visibleAnimation
                .Rent(this.Gimmick)
                .ReturnToPoolOnComplete()
                .Animations.ForEach(a => a.DOPlay());
            }
        }
コード例 #2
0
        public FooterSelectCellEventElement Rent(MasterDataCellEvent.Record record)
        {
            var pool  = pools.Get(this);
            var clone = pool.Rent();

            clone.pool = pool;

            clone.text.text = record.Id.ToString();
            clone.record    = record;

            return(clone);
        }