Esempio n. 1
0
 public RangeDamageBehaviour(RangeDamageBehaviourData data, List <Validator> validators) : base(data, validators)
 {
     this.pathfinder = Container.Instance.Resolve <IPathfinder>();
     this.comparator = data.Comparator;
     this.range      = data.Range;
     this.amount     = data.Amount;
 }
Esempio n. 2
0
        public static bool Compare(float value, float target, ComparatorMethod method)
        {
            switch (method)
            {
            case ComparatorMethod.EqualTo:
                return(Math.Abs(value - target) < Mathf.Epsilon);

            case ComparatorMethod.NotEqualTo:
                return(Math.Abs(value - target) > Mathf.Epsilon);

            case ComparatorMethod.GreaterThan:
                return(value > target);

            case ComparatorMethod.GreaterThanOrEqualTo:
                return(value >= target);

            case ComparatorMethod.LessThan:
                return(value < target);

            case ComparatorMethod.LessThanOrEqualTo:
                return(value <= target);

            default:
                throw new ArgumentOutOfRangeException(nameof(method), method, null);
            }
        }