public void StartTimer(int startingTime, TimerModes timerMode = TimerModes.defaultMode)
    {
        if (_timer == 0)
        {
            this.timerMode = timerMode;
            _timer         = startingTime;
            RpcUpdateTimerTextfield(_timer);

            if (isServer)
            {
                InvokeRepeating(nameof(PassSecond), 0f, 1f);
            }
        }
    }
Example #2
0
        public TimerText(SpriteFont font, TimerModes mode, CountModes countMode, int frames, Vector2 justify, Action onComplete = null)
            : base(true)
        {
            this.font = font;
            this.timerMode = mode;
            this.CountMode = countMode;
            this.frames = frames;
            this.justify = justify;

            #if DEBUG
            if (frames < 0)
                throw new Exception("Frames must be larger than or equal to zero!");
            #endif

            OnComplete = onComplete;

            UpdateText();
            CalculateOrigin();
        }
Example #3
0
        public TimerText(SpriteFont font, TimerModes mode, CountModes countMode, int frames, Vector2 justify, Action onComplete = null)
            : base(true)
        {
            this.font      = font;
            this.timerMode = mode;
            this.CountMode = countMode;
            this.frames    = frames;
            this.justify   = justify;

#if DEBUG
            if (frames < 0)
            {
                throw new Exception("Frames must be larger than or equal to zero!");
            }
#endif

            OnComplete = onComplete;

            UpdateText();
            CalculateOrigin();
        }