Beispiel #1
0
        public void Execute()
        {
            var time = ServiceTimer.DeltaTime;

            for (int i = 0; i < _timeRemainings.Count; i++)

            {
                var obj = _timeRemainings[i];
                obj.CurrentTime -= time;

                if (obj.CurrentTime <= 0.0f)
                {
                    obj?.Method?.Invoke();
                    CustomDebug.Log($"Invoke method {obj.Method}");
                    if (!obj.IsRepeating)
                    {
                        obj.Remove();
                    }
                    else
                    {
                        obj.CurrentTime = obj.Time;
                    }
                }
            }
        }
Beispiel #2
0
 public static void Add(this TimeRemaining value)
 {
     if (_timeRemainings.Contains(value))
     {
         return;
     }
     _timeRemainings.Add(value);
     CustomDebug.Log($"Timer Add {value}");
 }
Beispiel #3
0
        private void OnCollisionEnter(Collision collision)
        {
            CustomDebug.Log($"collision woth {collision}");

            var tempObj = collision.gameObject.GetComponent <ISetDamage>();

            if (tempObj != null)
            {
                tempObj.SetDamage(new InfoCollision(_damage, collision.contacts[0], collision.transform));
            }
        }
Beispiel #4
0
        //private void OnValidate()
        //{
        //    if (TryGetComponent(out Canvas canvas))
        //    {
        //        Canvas = canvas;
        //        Canvas.enabled = false;
        //    }
        //}

        private void TestingPrint()
        {
            Count++;
            CustomDebug.Log($"Testign timer execute {Count} times!");
        }