Esempio n. 1
0
        /// <summary>
        /// Creates the children shrapnels which emanate from the point. The time children are positioned 
        /// and the time is increased. The shrapnels are also added to the global shrapnel list.
        /// </summary>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <param name="currentTimeStep"></param>
        /// <returns></returns>
        private void CreateShrapnelChildren(int x, int y, int currentTimeStep)
        {
            for (int i = 0; i < 4; i++)
            {
                var Shrapnel = new ShrapnelNode
                {
                    Direction = (Direction)i,
                    X = x,
                    Y = y,
                    TimeStep = currentTimeStep,
                };

                Shrapnels.Add(Shrapnel);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Move the shrapnel according to its direction for a single step.
        /// </summary>
        /// <param name="shrapnel"></param>
        private ShrapnelNode Move(ShrapnelNode shrapnel)
        {
            switch (shrapnel.Direction)
            {
                case Direction.Down:
                    shrapnel.Y++;
                    break;
                case Direction.Right:
                    shrapnel.X++;
                    break;
                case Direction.Up:
                    shrapnel.Y--;
                    break;
                case Direction.Left:
                    shrapnel.X--;
                    break;
            }

            return shrapnel;
        }