Example #1
0
        public void Add(Axis axis)
        {
            var Gravity = axis.X * axis.X + axis.Y * axis.Y + axis.Z * axis.Z;

            if (Gravity < 0.5 || Gravity > 1.5)
            {
                AxisList.Add(axis);
                if (-0.2 > axis.X || axis.X > 0.2)
                {
                    if (axis.X < -0.6)
                    {
                        axis.AccDirection = AccelerationDirection.Right;
                    }
                    else if (axis.X > 0.6)
                    {
                        axis.AccDirection = AccelerationDirection.Left;
                    }
                }
                else
                {
                    if ((axis.Y * axis.Y + axis.Z * axis.Z > 1.5))
                    {
                        axis.AccDirection = AccelerationDirection.Up;
                    }
                    else if (axis.Y * axis.Y + axis.Z * axis.Z < 0.5)
                    {
                        axis.AccDirection = AccelerationDirection.Down;
                    }
                }
                axis.CurrentDateTime = DateTime.Now;
            }
        }
Example #2
0
 public override void Initialize()
 {
     base.Initialize();
     AxisList.Add(this);
     Pos.X       = random.Next(WidthOfGame);
     Pos.Y       = random.Next(HeightOfGame) + 50;
     AngleInDeg  = 0;
     CollideType = CollideTypes.EnemyShips;
     CollideAgainstTypes.Add(CollideTypes.EnemyShips);
     SortAxisList();
 }
Example #3
0
 private void AddAxis(AxisType axisType, float distanceToNext, float weightValue, float loadLimit = 0, float damage = 0)
 {
     if (AxisList.Count < 10)
     {
         float weightValueWithInaccuracy    = Math.Max(weightValue - Scales.Inaccuracy, 0);
         float distanceToNextWithInaccuracy = distanceToNext + InaccuracyRoulette;
         var   axis = new Axis(index: AxisList.Count,
                               type: axisType,
                               weightValue: weightValue,
                               weightValueWithInaccuracy: weightValueWithInaccuracy,
                               distanceToNext: distanceToNext,
                               distanceToNextWithInaccuracy: distanceToNextWithInaccuracy,
                               loadLimit: loadLimit,
                               damage: damage);
         AxisList.Add(axis);
     }
 }
Example #4
0
        /// <summary>
        /// Fluent interface for initializing pivot requests
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="axis"></param>
        /// <returns></returns>
        public PivotDefinition <T> OnAxis(params Expression <Func <T, object> >[] axis)
        {
            var axisNames = axis.Select(ExpressionTreeHelper.PropertyName);

            foreach (var axisName in axisNames)
            {
                var metadata = _schema.ServerSide.FirstOrDefault(v => v.Name == axisName);
                if (metadata == null)
                {
                    throw new ArgumentException($"Property {axisName} can not be used as a pivot axis as it is not a server-side value");
                }

                if (metadata.IsCollection)
                {
                    throw new ArgumentException($"Property {axisName} can not be used as a pivot axis as it is a collection");
                }

                AxisList.Add(metadata.Order);
            }

            return(this);
        }