Beispiel #1
0
        public static bool CheckTimer(this GameEntity gameEntity, TimerFlag flag)
        {
            if (!gameEntity.hasTimerComp)
            {
                return(false);
            }

            if (gameEntity.timerComp.Timers[flag.ToIdx()] <= 0)
            {
                return(true);
            }

            return(false);
        }
Beispiel #2
0
        public static void ResetTimer(this GameEntity gameEntity,
                                      TimerFlag flag,
                                      float value = -1f)
        {
            if (value < 0)
            {
                switch (flag)
                {
                case TimerFlag.Fire:
                    value = 1.0f / gameEntity.GetStat(StatFlag.AttackSpeed);
                    break;

                default:
                    value = 0f;
                    break;
                }
            }

            gameEntity.timerComp.Timers[flag.ToIdx()] = value;
        }