Пример #1
0
 protected override void OnTick()
 {
     if (!_carpet.Move(_carpet.Moving, _carpet.Speed))
     {
         _carpet.Stop();
     }
 }
Пример #2
0
 protected override void OnTick()
 {
     if (!_carpet.AdjustAltitude(_dir))
     {
         _carpet.Stop();
     }
 }
Пример #3
0
        public override void OnResponse(Server.Network.NetState sender, RelayInfo info)
        {
            int val = (info.ButtonID - 1);

            if (val < 0)
            {
                return;
            }

            int type  = (val % 10);
            int index = (val / 10);

            switch (type)
            {
            case 0:                     //directional movement
            {
                switch (index)
                {
                case 0: _carpet.StartMove(Direction.Up); break;

                case 1: _carpet.StartMove(Direction.North); break;

                case 2: _carpet.StartMove(Direction.Right); break;

                case 3: _carpet.StartMove(Direction.East); break;

                case 4: _carpet.StartMove(Direction.Down); break;

                case 5: _carpet.StartMove(Direction.South); break;

                case 6: _carpet.StartMove(Direction.Left); break;

                case 7: _carpet.StartMove(Direction.West); break;

                case 8:
                default: _carpet.Stop(); break;
                }

                break;
            }

            case 1:                     //altitude adjustment
            {
                switch (index)
                {
                case 0: _carpet.StartAdjustAltitude(Direction.Up); break;

                case 1: _carpet.StartAdjustAltitude(Direction.Down); break;

                case 2:
                default: _carpet.StopAltitudeChange(); break;
                }

                break;
            }

            case 2:                     //speed adjustment
            {
                switch (index)
                {
                case 0: _carpet.Speed++; break;

                case 1: _carpet.Speed--; break;
                }

                break;
            }

            case 3:                     //turning
            {
                switch (index)
                {
                case 0: _carpet.SetFacing((Direction)(((int)_carpet.Facing + -2) & 0x7)); break;

                case 1: _carpet.SetFacing((Direction)(((int)_carpet.Facing + 2) & 0x7)); break;
                }

                break;
            }

            case 4:
            {
                switch (index)
                {
                case 0:
                {
                    sender.Mobile.BeginTarget(10, false, Server.Targeting.TargetFlags.None, new TargetStateCallback(carpetEntity_selectionCallback), true);
                    sender.Mobile.SendMessage("Select an entity to include in this carpet's movement region.");

                    break;
                }

                case 1:
                {
                    sender.Mobile.BeginTarget(10, false, Server.Targeting.TargetFlags.None, new TargetStateCallback(carpetEntity_selectionCallback), false);
                    sender.Mobile.SendMessage("Select an entity to exclude from this carpet's movement region.");

                    break;
                }
                }

                break;
            }
            }

            Resend(sender.Mobile);
        }