Пример #1
0
        private void FadeOut(GameTime gameTime)
        {
            _fadeStepTimer += gameTime.ElapsedGameTime.TotalSeconds;
            _fadeOutTimer  += gameTime.ElapsedGameTime.TotalSeconds;

            if (_fadeOutTimer > FADE_OUT_TIME)
            {
                PlayWindow.RemoveVirus(this);
            }
            while (_fadeStepTimer > FADE_STEP_TIME)
            {
                Color color = Sprite.Color;
                color.A        -= 1;
                color.R        -= 1;
                color.G        -= 1;
                color.B        -= 1;
                Sprite.Color    = color;
                _fadeStepTimer -= FADE_STEP_TIME;
            }
        }
Пример #2
0
        public void ExplodeByVirus()
        {
            float radius = Body.FixtureList.First().Shape.Radius;

            for (int i = 0; i < 1 + _virusList.Count; i++)
            {
                Vector2 position;
                position.X = this.Position.X - radius / 2 + (float)Shared.Random.NextDouble() * radius;
                position.Y = this.Position.Y - radius / 2 + (float)Shared.Random.NextDouble() * radius;

                Virus newVirus = new Virus(PlayWindow, position);
                PlayWindow.RegisterVirus(newVirus);

                ApplyExplodeForce(newVirus);
            }

            foreach (var item in _virusList)
            {
                PlayWindow.RemoveVirus(item);
            }
            PlayWindow.RemoveGoodCell(this);
        }