示例#1
0
        public Asteroid(Asteroid astCopy) : base(astCopy.currLoc)
        {
            aSize = astCopy.aSize;
            RandomVelocity();

            // can't figure out how to have iSize set before
            // base constructor, which calls into InitPoints,
            // so clear and do it again
            InitPoints();
        }
示例#2
0
        /// <summary>
        /// Reduce the size by one level.
        /// </summary>
        /// <returns>The new reduce size.</returns>
        public ASTEROID_SIZE ReduceSize()
        {
            if (Size != ASTEROID_SIZE.DNE)
            {
                Size -= 1;
            }

            InitPoints();
            RandomVelocity();

            return(Size);
        }
示例#3
0
        /// <summary>
        /// Creates a new instance of <see cref="Asteroid"/>.
        /// </summary>
        /// <param name="size">Initial <see cref="ASTEROID_SIZE"/>.</param>
        public Asteroid(ASTEROID_SIZE size) : base(new Point(0, 0))
        {
            Size = size;

            // Can't place the object randomly in constructor - stinky
            currLoc.X = Random.Next(2) * (ScreenCanvas.CANVAS_WIDTH - 1);
            currLoc.Y = Random.Next(ScreenCanvas.CANVAS_HEIGHT - 1);

            RandomVelocity();

            // can't figure out how to have Size set before
            // base constructor, which calls into InitPoints,
            // so clear and do it again
            InitPoints();
        }
示例#4
0
        public Asteroid(ASTEROID_SIZE size) : base(new Point(0, 0))
        {
            aSize = size;

            // Can't place the object randomly in constructor - stinky
            currLoc.X = rndGen.Next(2) * (iMaxX - 1);
            currLoc.Y = rndGen.Next(iMaxY - 1);

            RandomVelocity();

            // can't figure out how to have iSize set before
            // base constructor, which calls into InitPoints,
            // so clear and do it again
            InitPoints();
        }
示例#5
0
        public Asteroid(ASTEROID_SIZE size)
        {
            this.Size = size;

            switch (size)
            {
                case ASTEROID_SIZE.ASTEROID_SMALL:
                    Slots = 2;
                    Build_Time = 4;
                    break;
                case ASTEROID_SIZE.ASTEROID_MEDIUM:
                    Slots = 4;
                    Build_Time = 6;
                    break;
                case ASTEROID_SIZE.ASTEROID_LARGE:
                    Slots = 6;
                    Build_Time = 8;
                    break;
            }
        }