示例#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;
            }
        }
示例#2
0
 public override void Update(Level level, int x, int y, ref int states)
 {
 }
示例#3
0
文件: Tile.cs 项目: Porl91/Platformer
 public abstract void Update(Level level, int x, int y, ref int states);