Exemple #1
0
        public void Bleed()
        {
            Point p = Position;

            if (Game.Current.RNG.Next(3) == 0)
            {
                p += new Point(-1 + Game.Current.RNG.Next(3), -1 + Game.Current.RNG.Next(3));
            }
            Decal.Generate(Decal.Prefabs.BloodDrops, p);
        }
Exemple #2
0
 public static Decal Generate(Prefabs prefab, Point position)
 {
     IEnumerable<Decal> q;
     q = from decal in Area.Current.Decals
         where decal.Position == position
         select decal;
     List<Decal> matches = q.ToList<Decal>();
     if (matches.Count == 1) {
         if (prefab == Prefabs.BloodDrops || prefab == Prefabs.BloodSplatter || prefab == Prefabs.BloodPool) {
             matches[0].Density++;
             matches[0].Life = 0;
             switch (matches[0].Type) {
                 case Types.BloodDrops:
                     if (matches[0].Density < 3) return null;
                     Area.Current.Decals.Remove(matches[0]);
                     return Generate(Prefabs.BloodSplatter, position);
                 case Types.BloodSplatter:
                     if (matches[0].Density < 8) return null;
                     Area.Current.Decals.Remove(matches[0]);
                     return Generate(Prefabs.BloodPool, position);
                 case Types.BloodPool:
                     return null;
             }
         }
     }
     if (matches.Count > 1) throw new Exception("OMG!");
     Decal d = new Decal();
     switch (prefab) {
         case Prefabs.BloodDrops:
             d.Type = Types.BloodDrops;
             d.DrawMode = DrawModes.OnlyForegroundColor;
             d.ForegroundColor = TCODColor.Interpolate(TCODColor.red, new TCODColor(58, 5, 14), 0f);
             d.Description = "There is some blood on the ground here.";
             break;
         case Prefabs.BloodSplatter:
             d.Type = Types.BloodSplatter;
             d.DrawMode = DrawModes.Normal;
             d.Symbol = (char)7;
             d.ForegroundColor = TCODColor.desaturatedCrimson;
             d.Description = "There is a splatter of blood here.";
             break;
         case Prefabs.BloodPool:
             d.Type = Types.BloodPool;
             d.DrawMode = DrawModes.OnlyBackgroundColor;
             d.BackgroundColor = TCODColor.desaturatedCrimson;
             d.Description = "A pool of blood covers the ground here.";
             break;
     }
     d.Area = Area.Current;
     d.Position = position;
     Area.Current.Decals.Add(d);
     return d;
 }
Exemple #3
0
        public static Decal Generate(Prefabs prefab, Point position)
        {
            IEnumerable <Decal> q;

            q = from decal in Area.Current.Decals
                where decal.Position == position
                select decal;
            List <Decal> matches = q.ToList <Decal>();

            if (matches.Count == 1)
            {
                if (prefab == Prefabs.BloodDrops || prefab == Prefabs.BloodSplatter || prefab == Prefabs.BloodPool)
                {
                    matches[0].Density++;
                    matches[0].Life = 0;
                    switch (matches[0].Type)
                    {
                    case Types.BloodDrops:
                        if (matches[0].Density < 3)
                        {
                            return(null);
                        }
                        Area.Current.Decals.Remove(matches[0]);
                        return(Generate(Prefabs.BloodSplatter, position));

                    case Types.BloodSplatter:
                        if (matches[0].Density < 8)
                        {
                            return(null);
                        }
                        Area.Current.Decals.Remove(matches[0]);
                        return(Generate(Prefabs.BloodPool, position));

                    case Types.BloodPool:
                        return(null);
                    }
                }
            }
            if (matches.Count > 1)
            {
                throw new Exception("OMG!");
            }
            Decal d = new Decal();

            switch (prefab)
            {
            case Prefabs.BloodDrops:
                d.Type            = Types.BloodDrops;
                d.DrawMode        = DrawModes.OnlyForegroundColor;
                d.ForegroundColor = TCODColor.Interpolate(TCODColor.red, new TCODColor(58, 5, 14), 0f);
                d.Description     = "There is some blood on the ground here.";
                break;

            case Prefabs.BloodSplatter:
                d.Type            = Types.BloodSplatter;
                d.DrawMode        = DrawModes.Normal;
                d.Symbol          = (char)7;
                d.ForegroundColor = TCODColor.desaturatedCrimson;
                d.Description     = "There is a splatter of blood here.";
                break;

            case Prefabs.BloodPool:
                d.Type            = Types.BloodPool;
                d.DrawMode        = DrawModes.OnlyBackgroundColor;
                d.BackgroundColor = TCODColor.desaturatedCrimson;
                d.Description     = "A pool of blood covers the ground here.";
                break;
            }
            d.Area     = Area.Current;
            d.Position = position;
            Area.Current.Decals.Add(d);
            return(d);
        }
Exemple #4
0
 public void BleedDirectly()
 {
     Decal.Generate(Decal.Prefabs.BloodDrops, Position);
 }