Example #1
0
        /// <summary>
        /// конструктор корабля
        /// </summary>
        /// <param name="sf">шрифт для отображения корабля</param>
        /// <param name="rect">положение в пространстве</param>
        /// <param name="state">true - синий, false - красный</param>
        /// <param name="connected">планета вокруг которой вращается корабль</param>
        /// <param name="t">начальное положение корабля на орбите</param>
        public Ship(SpriteFont sf, Rectangle rect, bool state, Planet connected, float t)
        {
            live = 100;
            in_orbit = true;
            this.state = state;
            Connected_planet = connected;
            if (state == true)
            {
                Con_planet(null).Blue_count += 1;
            }
            else
            {
                Con_planet(null).Red_count += 1;
            }
            this.t = t;
            attack = 2;

            rn = new Random();

            this.sf = sf;
            coords.X = rect.X;
            coords.Y = rect.Y;

            Thread td = new Thread(Work);
            td.IsBackground = true;
            td.Start();
        }
Example #2
0
        /// <summary>
        /// блокировка
        /// </summary>
        /// <param name="pl">Изменяемая планета</param>
        /// <returns></returns>
        public Planet Con_planet(Planet pl)
        {
            lock(thisLock)
            {
                if (pl != null)
                {
                    this.Connected_Planet = pl;

                }
                return this.Connected_Planet;
            }
        }