示例#1
0
        public void SetGuideCommand(GuideCmd cmd)
        {
            if (this.currentCmd == cmd)
            {
                return;
            }

            if (this.currentCmd is TargetCmd)
            {
                BaseVob target = ((TargetCmd)this.currentCmd).Target;
                target.OnDespawn -= OnTargetDespawn;
                if (this.guide != null)
                {
                    this.guide.RemoveGuideTarget(target);
                }
            }
            if (cmd is TargetCmd)
            {
                BaseVob target = ((TargetCmd)cmd).Target;
                target.OnDespawn += OnTargetDespawn;
                if (this.guide != null)
                {
                    this.guide.AddGuideTarget(target);
                }
            }

            if (this.guide != null)
            {
                Messages.WriteGuidableCmd(this.guide, this, cmd);
            }

            this.currentCmd = cmd;
        }
示例#2
0
            public static void WriteGuidableCmd(GameClient client, GuidedVob vob, GuideCmd cmd)
            {
                if (cmd == null)
                {
                    guideWriter.Write((byte)ServerMessages.GuideRemoveCmdMessage);
                }
                else
                {
                    guideWriter.Write((byte)ServerMessages.GuideSetCmdMessage);
                    guideWriter.Write(cmd.CmdType);
                    cmd.WriteStream(guideWriter);
                }

                guideWriter.Write((ushort)vob.ID);
                client.Send(guideWriter, NetPriority.Low, NetReliability.ReliableOrdered, 'W');
                guideWriter.Reset();
            }
示例#3
0
        internal void SetGuideCommand(GuideCmd cmd)
        {
            if (cmd != this.currentCmd)
            {
                if (this.currentCmd != null)
                {
                    this.currentCmd.Stop(this);
                }

                this.currentCmd = cmd;

                if (this.currentCmd != null)
                {
                    this.currentCmd.Start(this);
                }
            }
        }