Пример #1
0
        private void Collide(Critter critter, Terrain terrain)
        {
            if (critter.Mover is NullMover)
            {
                return;
            }

            Sound.PlayZap();

            critter.Bounceback();
            critter.Bump();

            terrain.Nudge();

            Sprite bump = new ParticleExplosionSprite(10, Color.LightBlue, Color.White, 1, 2, 5)
            {
                Position = new Point((critter.Position.X + terrain.Position.X) / 2, (critter.Position.Y + terrain.Position.Y) / 2)
            };

            AddSprite(bump);
        }
Пример #2
0
        private void Collide(Critter critter1, Critter critter2)
        {
            if (critter1.Mover is NullMover || critter2.Mover is NullMover)
            {
                return;
            }

            Sound.PlayBump();

            critter1.Bounceback();
            critter2.Bounceback();

            critter1.FightWith(critter2.NumberNameAndAuthor);
            critter2.FightWith(critter1.NumberNameAndAuthor);

            Sprite fight = new ParticleExplosionSprite(10, Color.DarkRed, Color.Red, 1, 5, 10)
            {
                Position = new Point((critter1.Position.X + critter2.Position.X) / 2, (critter1.Position.Y + critter2.Position.Y) / 2)
            };

            AddSprite(fight);
        }