Example #1
0
        public override void Update(Level level, int x, int y, ref int states)
        {
            if (states++ > 5)
            {
                var w = level.GetTile(x - 1, y);
                var e = level.GetTile(x + 1, y);
                var s = level.GetTile(x, y + 1);

                var sw = level.GetTile(x - 1, y + 1);
                var se = level.GetTile(x + 1, y + 1);

                if (CanFlowInto(s))
                    level.SetTile(x, y + 1, this.Key);
                else
                {
                    if (CanFlowInto(e) && !(s is Water))
                        level.SetTile(x + 1, y, this.Key);

                    if (CanFlowInto(w) && !(s is Water))
                        level.SetTile(x - 1, y, this.Key);
                }

                if (!(sw is Water) && sw.IsObstructive && CanFlowInto(w))
                    level.SetTile(x - 1, y, this.Key);

                if (!(se is Water) && se.IsObstructive && CanFlowInto(e))
                    level.SetTile(x + 1, y, this.Key);

                states = 0;
            }
        }
Example #2
0
 public override void Update(Level level, int x, int y, ref int states)
 {
 }
Example #3
0
 public abstract void Update(Level level, int x, int y, ref int states);