示例#1
0
            public void RecordCarouselLocation()
            {
                Point3D loc = m_Carousel.GetWorldLocation();

                m_Carousel.Xr = loc.X;
                m_Carousel.Yr = loc.Y;
                m_Carousel.Zr = loc.Z;
            }
示例#2
0
            protected override void OnTick()
            {
                List <Item> list = new List <Item>();

                Point3D loc = m_Carousel.GetWorldLocation();

                foreach (Item item in m_Carousel.GetItemsInRange(2))
                {
                    //Point3D loc = item.GetWorldLocation();
                    list.Add(item);
                }

                foreach (Item item in list)
                {
                    Point3D itemloc = item.GetWorldLocation();

                    if (item.X == (m_Carousel.Xr - 2) & item.Y == (m_Carousel.Yr - 2))
                    {
                        item.Y++;
                    }
                    else if (item.X == (m_Carousel.Xr - 2) & item.Y == (m_Carousel.Yr - 1))
                    {
                        item.Y++;
                    }
                    else if (item.X == (m_Carousel.Xr - 2) & item.Y == m_Carousel.Yr)
                    {
                        item.Y++;
                    }
                    else if (item.X == (m_Carousel.Xr - 2) & item.Y == (m_Carousel.Yr + 1))
                    {
                        item.Y++;
                    }
                    else if (item.X == (m_Carousel.Xr - 2) & item.Y == (m_Carousel.Yr + 2))
                    {
                        item.X++;
                    }
                    else if (item.X == (m_Carousel.Xr - 1) & item.Y == (m_Carousel.Yr + 2))
                    {
                        item.X++;
                    }
                    else if (item.X == m_Carousel.Xr & item.Y == (m_Carousel.Yr + 2))
                    {
                        item.X++;
                    }
                    else if (item.X == (m_Carousel.Xr + 1) & item.Y == (m_Carousel.Yr + 2))
                    {
                        item.X++;
                    }
                    else if (item.X == (m_Carousel.Xr + 2) & item.Y == (m_Carousel.Yr + 2))
                    {
                        item.Y--;
                    }
                    else if (item.X == (m_Carousel.Xr + 2) & item.Y == (m_Carousel.Yr + 1))
                    {
                        item.Y--;
                    }
                    else if (item.X == (m_Carousel.Xr + 2) & item.Y == m_Carousel.Yr)
                    {
                        item.Y--;
                    }
                    else if (item.X == (m_Carousel.Xr + 2) & item.Y == (m_Carousel.Yr - 1))
                    {
                        item.Y--;
                    }
                    else if (item.X == (m_Carousel.Xr + 2) & item.Y == (m_Carousel.Yr - 2))
                    {
                        item.X--;
                    }
                    else if (item.X == (m_Carousel.Xr + 1) & item.Y == (m_Carousel.Yr - 2))
                    {
                        item.X--;
                    }
                    else if (item.X == m_Carousel.Xr & item.Y == (m_Carousel.Yr - 2))
                    {
                        item.X--;
                    }
                    else if (item.X == (m_Carousel.Xr - 1) & item.Y == (m_Carousel.Yr - 2))
                    {
                        item.X--;
                    }
                }

                List <Mobile> mobilelist = new List <Mobile>();

                foreach (Mobile mobile in m_Carousel.GetMobilesInRange(2))
                {
                    mobilelist.Add(mobile);
                }

                foreach (Mobile mobile in mobilelist)
                {
                    if (mobile.X == (m_Carousel.Xr - 2) & mobile.Y == (m_Carousel.Yr - 2))
                    {
                        mobile.Y++; mobile.Direction = Direction.Left;
                    }

                    else if (mobile.X == (m_Carousel.Xr - 2) & mobile.Y == (m_Carousel.Yr - 1))
                    {
                        mobile.Y++; mobile.Direction = Direction.South;
                    }
                    else if (mobile.X == (m_Carousel.Xr - 2) & mobile.Y == m_Carousel.Yr)
                    {
                        mobile.Y++; mobile.Direction = Direction.South;
                    }
                    else if (mobile.X == (m_Carousel.Xr - 2) & mobile.Y == (m_Carousel.Yr + 1))
                    {
                        mobile.Y++; mobile.Direction = Direction.South;
                    }

                    else if (mobile.X == (m_Carousel.Xr - 2) & mobile.Y == (m_Carousel.Yr + 2))
                    {
                        mobile.X++; mobile.Direction = Direction.Down;
                    }

                    else if (mobile.X == (m_Carousel.Xr - 1) & mobile.Y == (m_Carousel.Yr + 2))
                    {
                        mobile.X++; mobile.Direction = Direction.East;
                    }
                    else if (mobile.X == (m_Carousel.Xr) & mobile.Y == (m_Carousel.Yr + 2))
                    {
                        mobile.X++; mobile.Direction = Direction.East;
                    }
                    else if (mobile.X == (m_Carousel.Xr + 1) & mobile.Y == (m_Carousel.Yr + 2))
                    {
                        mobile.X++; mobile.Direction = Direction.East;
                    }

                    else if (mobile.X == (m_Carousel.Xr + 2) & mobile.Y == (m_Carousel.Yr + 2))
                    {
                        mobile.Y--; mobile.Direction = Direction.Right;
                    }

                    else if (mobile.X == (m_Carousel.Xr + 2) & mobile.Y == (m_Carousel.Yr + 1))
                    {
                        mobile.Y--; mobile.Direction = Direction.North;
                    }
                    else if (mobile.X == (m_Carousel.Xr + 2) & mobile.Y == m_Carousel.Yr)
                    {
                        mobile.Y--; mobile.Direction = Direction.North;
                    }
                    else if (mobile.X == (m_Carousel.Xr + 2) & mobile.Y == (m_Carousel.Yr - 1))
                    {
                        mobile.Y--; mobile.Direction = Direction.North;
                    }

                    else if (mobile.X == (m_Carousel.Xr + 2) & mobile.Y == (m_Carousel.Yr - 2))
                    {
                        mobile.X--; mobile.Direction = Direction.Mask;
                    }

                    else if (mobile.X == (m_Carousel.Xr + 1) & mobile.Y == (m_Carousel.Yr - 2))
                    {
                        mobile.X--; mobile.Direction = Direction.West;
                    }
                    else if (mobile.X == m_Carousel.Xr & mobile.Y == (m_Carousel.Yr - 2))
                    {
                        mobile.X--; mobile.Direction = Direction.West;
                    }
                    else if (mobile.X == (m_Carousel.Xr - 1) & mobile.Y == (m_Carousel.Yr - 2))
                    {
                        mobile.X--; mobile.Direction = Direction.West;
                    }
                }

                if (m_Carousel.Power == false)
                {
                    Stop();
                }
                else
                {
                    Start();
                }
            }