コード例 #1
0
ファイル: Building.cs プロジェクト: nako75/20Clash
        public override void FastForward(int seconds)
        {
            ConstructionTimer?.FastForward(seconds);
            BoostTimer?.FastForward(seconds);

            base.FastForward(seconds);
        }
コード例 #2
0
ファイル: Building.cs プロジェクト: nako75/20Clash
        public void SpeedUpConstruction()
        {
            if (ConstructionTimer == null)
            {
                return;
            }
            var cost = GamePlayUtil.GetSpeedUpCost(ConstructionTimer.GetRemainingSeconds(Home.Time));

            if (Home.UseDiamonds(cost))
            {
                FinishConstruction();
            }
            else
            {
                Logger.Log("Payment failed.", GetType(), Logger.ErrorLevel.Warning);
            }
        }
コード例 #3
0
ファイル: Building.cs プロジェクト: nako75/20Clash
        public override void Tick()
        {
            if (ConstructionTimer != null)
            {
                if (ConstructionTimer.GetRemainingSeconds(Home.Time) <= 0)
                {
                    FinishConstruction();
                }
            }

            if (BoostTimer != null)
            {
                if (BoostTimer.GetRemainingSeconds(Home.Time) <= 0)
                {
                    BoostTimer = null;
                }
            }

            base.Tick();
        }
コード例 #4
0
ファイル: Building.cs プロジェクト: nako75/20Clash
        public override JObject Save()
        {
            var jObject = base.Save();

            jObject.Add("data", Data);
            jObject.Add("lvl", _upgradeLevel);

            if (Id > 0)
            {
                jObject.Add("id", Id);
            }

            if (ConstructionTimer != null)
            {
                jObject.Add("const_t", ConstructionTimer.GetRemainingSeconds(Home.Time));
            }

            if (BoostTimer != null)
            {
                jObject.Add("boost_t", BoostTimer.GetRemainingSeconds(Home.Time));
            }

            if (Locked)
            {
                jObject.Add("locked", true);
            }

            if (AttackMode)
            {
                jObject.Add("attack_mode", true);
            }

            if (BoostPause)
            {
                jObject.Add("boost_pause", true);
            }

            return(jObject);
        }