SetRiverTile() private méthode

private SetRiverTile ( River river ) : void
river River
Résultat void
Exemple #1
0
        // This function got messy.  Sorry.
        public void DigRiver(River river, int size)
        {
            SetRiverTile(river);
            RiverSize = size;

            if (size == 1)
            {
                if (Bottom != null)
                {
                    Bottom.SetRiverTile(river);
                    if (Bottom.Right != null)
                    {
                        Bottom.Right.SetRiverTile(river);
                    }
                }
                if (Right != null)
                {
                    Right.SetRiverTile(river);
                }
            }

            if (size == 2)
            {
                if (Bottom != null)
                {
                    Bottom.SetRiverTile(river);
                    if (Bottom.Right != null)
                    {
                        Bottom.Right.SetRiverTile(river);
                    }
                }
                if (Right != null)
                {
                    Right.SetRiverTile(river);
                }
                if (Top != null)
                {
                    Top.SetRiverTile(river);
                    if (Top.Left != null)
                    {
                        Top.Left.SetRiverTile(river);
                    }
                    if (Top.Right != null)
                    {
                        Top.Right.SetRiverTile(river);
                    }
                }
                if (Left != null)
                {
                    Left.SetRiverTile(river);
                    if (Left.Bottom != null)
                    {
                        Left.Bottom.SetRiverTile(river);
                    }
                }
            }

            if (size == 3)
            {
                if (Bottom != null)
                {
                    Bottom.SetRiverTile(river);
                    if (Bottom.Right != null)
                    {
                        Bottom.Right.SetRiverTile(river);
                    }
                    if (Bottom.Bottom != null)
                    {
                        Bottom.Bottom.SetRiverTile(river);
                        if (Bottom.Bottom.Right != null)
                        {
                            Bottom.Bottom.Right.SetRiverTile(river);
                        }
                    }
                }
                if (Right != null)
                {
                    Right.SetRiverTile(river);
                    if (Right.Right != null)
                    {
                        Right.Right.SetRiverTile(river);
                        if (Right.Right.Bottom != null)
                        {
                            Right.Right.Bottom.SetRiverTile(river);
                        }
                    }
                }
                if (Top != null)
                {
                    Top.SetRiverTile(river);
                    if (Top.Left != null)
                    {
                        Top.Left.SetRiverTile(river);
                    }
                    if (Top.Right != null)
                    {
                        Top.Right.SetRiverTile(river);
                    }
                }
                if (Left != null)
                {
                    Left.SetRiverTile(river);
                    if (Left.Bottom != null)
                    {
                        Left.Bottom.SetRiverTile(river);
                    }
                }
            }

            if (size == 4)
            {
                if (Bottom != null)
                {
                    Bottom.SetRiverTile(river);
                    if (Bottom.Right != null)
                    {
                        Bottom.Right.SetRiverTile(river);
                    }
                    if (Bottom.Bottom != null)
                    {
                        Bottom.Bottom.SetRiverTile(river);
                        if (Bottom.Bottom.Right != null)
                        {
                            Bottom.Bottom.Right.SetRiverTile(river);
                        }
                    }
                }
                if (Right != null)
                {
                    Right.SetRiverTile(river);
                    if (Right.Right != null)
                    {
                        Right.Right.SetRiverTile(river);
                        if (Right.Right.Bottom != null)
                        {
                            Right.Right.Bottom.SetRiverTile(river);
                        }
                    }
                }
                if (Top != null)
                {
                    Top.SetRiverTile(river);
                    if (Top.Right != null)
                    {
                        Top.Right.SetRiverTile(river);
                        if (Top.Right.Right != null)
                        {
                            Top.Right.Right.SetRiverTile(river);
                        }
                    }
                    if (Top.Top != null)
                    {
                        Top.Top.SetRiverTile(river);
                        if (Top.Top.Right != null)
                        {
                            Top.Top.Right.SetRiverTile(river);
                        }
                    }
                }
                if (Left != null)
                {
                    Left.SetRiverTile(river);
                    if (Left.Bottom != null)
                    {
                        Left.Bottom.SetRiverTile(river);
                        if (Left.Bottom.Bottom != null)
                        {
                            Left.Bottom.Bottom.SetRiverTile(river);
                        }
                    }

                    if (Left.Left != null)
                    {
                        Left.Left.SetRiverTile(river);
                        if (Left.Left.Bottom != null)
                        {
                            Left.Left.Bottom.SetRiverTile(river);
                        }
                        if (Left.Left.Top != null)
                        {
                            Left.Left.Top.SetRiverTile(river);
                        }
                    }

                    if (Left.Top != null)
                    {
                        Left.Top.SetRiverTile(river);
                        if (Left.Top.Top != null)
                        {
                            Left.Top.Top.SetRiverTile(river);
                        }
                    }
                }
            }
        }