Beispiel #1
0
        public void Hit(int index, Shot src)
        {
            if(index == Points.Length - 1 || index == 0) return;
            if (!Armor)
            {
                if (index < Config.data.BASE_LENGTH)
                {
                    Die(src.Source);
                    src.Die();
                    return;
                }

                var d = new DeadPlayer(Points.Skip(index).ToArray(), this);

                Score -= (int)Math.Floor((double)(Length - index - 1) / 2 / Config.data.FOOD_GROW);
                src.Source.Score += (int)Math.Ceiling((double)(Length - index - 1) / 3 / Config.data.FOOD_GROW);
                Length = index + 1;

                src.Die();

                if (Splitted != null)
                    Splitted(this, d);
            }
            else
            {
                int h = Points[index - 1].HeadingTo(Points[index + 1]);
                src.Heading = h - (src.Heading - h);
                Armor = false;
            }
        }
Beispiel #2
0
 private void s_Splitted(Player sender, DeadPlayer deadPart)
 {
     AddSnake(deadPart);
 }