当前位置: 首页>>代码示例>>C#>>正文


C# ICharacter.Coordinates方法代码示例

本文整理汇总了C#中ICharacter.Coordinates方法的典型用法代码示例。如果您正苦于以下问题:C# ICharacter.Coordinates方法的具体用法?C# ICharacter.Coordinates怎么用?C# ICharacter.Coordinates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ICharacter的用法示例。


在下文中一共展示了ICharacter.Coordinates方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ExecuteCommand

        public override void ExecuteCommand(ICharacter character, Identity target, string[] args)
        {
            Vector3 position = new Vector3();
            position.X = character.Coordinates().x;
            position.Y = character.Coordinates().y;
            position.Z = character.Coordinates().z;
            byte type = byte.Parse(args[1]);
            /*if (type == 2)
            {
                // Set temperature
                WeatherControlMessageHandler.Default.Send(
                    character,
                    byte.Parse(args[1]),
                    (byte)(sbyte.Parse(args[2])),
                    byte.Parse(args[3]),
                    byte.Parse(args[4]),
                    byte.Parse(args[5]),
                    byte.Parse(args[6]),
                    byte.Parse(args[7]),
                    byte.Parse(args[8]));
            }
            else*/
            {
                int ambientColor = Convert.ToInt32(args[13], 16);
                int fogColor = Convert.ToInt32(args[14], 16);

                WeatherEntry newWeather = new WeatherEntry();
                newWeather.AmbientColor = ambientColor;
                newWeather.FogColor = fogColor;
                newWeather.Position = position;
                newWeather.FadeIn = short.Parse(args[1]);
                newWeather.Duration = int.Parse(args[2]);
                newWeather.FadeOut = short.Parse(args[3]);
                newWeather.Range = Single.Parse(args[4]);
                newWeather.WeatherType = (WeatherType)byte.Parse(args[5]);
                newWeather.Intensity = byte.Parse(args[6]);
                newWeather.Wind = byte.Parse(args[7]);
                newWeather.Clouds = byte.Parse(args[8]);
                newWeather.Thunderstrikes = byte.Parse(args[9]);
                newWeather.Tremors = byte.Parse(args[10]);
                newWeather.ThunderstrikePercentage = byte.Parse(args[11]);
                newWeather.TremorPercentage = byte.Parse(args[12]);
                newWeather.ZBufferVisibility = byte.Parse(args[15]);
                newWeather.Playfield = character.Playfield.Identity;

                WeatherSettings.Instance.Add(newWeather);

                WeatherControlMessageHandler.Default.Send(character, newWeather);
            }
        }
开发者ID:gordonc64,项目名称:CellAO-NightPredator,代码行数:50,代码来源:Weather.cs

示例2: ExecuteCommand

        public override void ExecuteCommand(ICharacter character, Identity target, string[] args)
        {
            if ((character.Stats[StatIds.externaldoorinstance].Value == 0)
                || (character.Stats[StatIds.externalplayfieldinstance].Value == 0))
            {
                ChatTextMessageHandler.Default.Create(character, "Please enter a proxyfied playfield first.");
            }

            Coordinate tempCoordinate = character.Coordinates();
            PlayfieldData pfData = PlayfieldLoader.PFData[character.Playfield.Identity.Instance];
            StatelData o = null;
            foreach (StatelData s in pfData.Statels)
            {
                if (o == null)
                {
                    o = s;
                }
                else
                {
                    if (Coordinate.Distance2D(tempCoordinate, s.Coord())
                        < Coordinate.Distance2D(tempCoordinate, o.Coord()))
                    {
                        o = s;
                    }
                }
            }
            if (o == null)
            {

                ChatTextMessageHandler.Default.Create(
                    character,
                    "No statel on this playfield... Very odd, where exactly are you???");

            }
            else
            {
                DBTeleport tel = new DBTeleport();
                tel.playfield = character.Stats[StatIds.externalplayfieldinstance].Value;
                tel.statelType = 0xc748; // Door only for now
                tel.statelInstance = character.Stats[StatIds.externaldoorinstance].BaseValue;
                tel.destinationPlayfield = o.PlayfieldId;
                tel.destinationType = (int)o.Identity.Type;
                tel.destinationInstance = BitConverter.ToUInt32(BitConverter.GetBytes(o.Identity.Instance), 0);

                var temp = TeleportDao.Instance.GetWhere(new { tel.playfield, tel.statelType, tel.statelInstance });
                foreach (var t in temp)
                {
                    TeleportDao.Instance.Delete(t.Id);
                }
                TeleportDao.Instance.Add(tel);
                character.Playfield.Publish(
            ChatTextMessageHandler.Default.CreateIM(character, "Proxy saved"));

            }
        }
开发者ID:gordonc64,项目名称:CellAO-NightPredator,代码行数:55,代码来源:SaveProxy.cs

示例3: ExecuteCommand

        /// <summary>
        /// </summary>
        /// <param name="character">
        /// </param>
        /// <param name="target">
        /// </param>
        /// <param name="args">
        /// </param>
        public override void ExecuteCommand(ICharacter character, Identity target, string[] args)
        {
            List<MessageBody> replies = new List<MessageBody>();
            string reply = "Looking up for statel in playfield " + character.Playfield.Identity.Instance;
            replies.Add(ChatTextMessageHandler.Default.Create(character, reply));
            StatelData o = null;
            StaticDynel o2 = null;
            Vendor o3 = null;
            Coordinate tempCoordinate = character.Coordinates();
            if (!PlayfieldLoader.PFData.ContainsKey(character.Playfield.Identity.Instance))
            {
                reply = "Could not find data for playfield " + character.Playfield.Identity.Instance;
                replies.Add(ChatTextMessageHandler.Default.Create(character, reply));
            }
            else
            {
                if (target.Equals(Identity.None))
                {
                    PlayfieldData pfData = PlayfieldLoader.PFData[character.Playfield.Identity.Instance];
                    foreach (StatelData s in pfData.Statels)
                    {
                        if (o == null)
                        {
                            o = s;
                        }
                        else
                        {
                            if (Coordinate.Distance2D(tempCoordinate, s.Coord())
                                < Coordinate.Distance2D(tempCoordinate, o.Coord()))
                            {
                                o = s;
                            }
                        }
                    }

                    foreach (StaticDynel sd in Pool.Instance.GetAll<StaticDynel>(character.Playfield.Identity))
                    {
                        if (o2 == null)
                        {
                            o2 = sd;
                        }
                        else
                        {
                            if (Coordinate.Distance2D(tempCoordinate, sd.Coordinate)
                                < Coordinate.Distance2D(tempCoordinate, o2.Coordinate))
                            {
                                o2 = sd;
                            }
                        }

                    }

                }
                else
                {
                    o =
                        PlayfieldLoader.PFData[character.Playfield.Identity.Instance].Statels.FirstOrDefault(
                            x => x.Identity == target);
                    o2 =
                        Pool.Instance.GetAll<StaticDynel>(character.Playfield.Identity)
                            .FirstOrDefault(x => x.Identity == target);
                    o3 =
                        Pool.Instance.GetAll<Vendor>(character.Playfield.Identity)
                            .FirstOrDefault(x => x.Identity == target);
                }

                if ((o == null) && (o2 == null) && (o3 == null))
                {
                    replies.Add(
                        ChatTextMessageHandler.Default.Create(
                            character,
                            "No statel/static dynel on this playfield... Very odd, where exactly are you???"));
                }
                else
                {
                    if (o3 != null)
                    {
                        replies.Add(
                                                    ChatTextMessageHandler.Default.Create(
                                                        character,
                                                        o3.Identity.Type.ToString() + " " + ((int)o3.Identity.Type).ToString("X8") + ":"
                                                        + o3.Identity.Instance.ToString("X8")));
                        replies.Add(
                            ChatTextMessageHandler.Default.Create(character, "Item Template Id: " + o3.Template.ID));
                        foreach (Event se in o3.Events)
                        {
                            replies.Add(ChatTextMessageHandler.Default.Create(character, se.ToString()));
                        }
                    }
                    else if (((o != null) && (o2 == null))
                        || ((o != null) && (Coordinate.Distance2D(tempCoordinate, o.Coord())
                            < Coordinate.Distance2D(tempCoordinate, o2.Coordinate))))
//.........这里部分代码省略.........
开发者ID:CellAO,项目名称:CellAO-NightPredator,代码行数:101,代码来源:ShowStatel.cs

示例4: CheckCollision

 /// <summary>
 /// </summary>
 /// <param name="character">
 /// </param>
 /// <returns>
 /// </returns>
 public static WallCollisionResult CheckCollision(ICharacter character)
 {
     return CheckCollision(character.Coordinates(), character.Playfield.Identity.Instance);
 }
开发者ID:gordonc64,项目名称:CellAO-NightPredator,代码行数:10,代码来源:WallCollision.cs

示例5: SpawnRandomMob

        public void SpawnRandomMob(ICharacter character)
        {
            Coordinate coord = character.Coordinates();

            DBMobTemplate[] templates = MobTemplateDao.Instance.GetAll().ToArray();
            Random rnd = new Random(Environment.TickCount);

            int mobNumber = rnd.Next(templates.Length);

            DBMobTemplate template = templates[mobNumber];
            NPCController npcController = new NPCController();
            Character mobCharacter = NonPlayerCharacterHandler.SpawnMobFromTemplate(
                template.Hash,
                character.Playfield.Identity,
                character.Coordinates(),
                character.RawHeading,
                npcController);
            mobCharacter.Playfield = character.Playfield;
            SimpleCharFullUpdateMessage mess = SimpleCharFullUpdate.ConstructMessage(mobCharacter);
            character.Playfield.Announce(mess);
            AppearanceUpdateMessageHandler.Default.Send(mobCharacter);

            Vector3 v = new Vector3(coord.x, coord.y, coord.z + 5);
            mobCharacter.AddWaypoint(v, false);
            v.x += 10 - rnd.Next(20);
            v.z -= 10 - rnd.Next(20);

            mobCharacter.AddWaypoint(v, false);
            v.x += 10 - rnd.Next(20);
            v.z -= 10 - rnd.Next(20);
            mobCharacter.AddWaypoint(v, false);
            v.x += 10 - rnd.Next(20);
            v.z -= 10 - rnd.Next(20);
            mobCharacter.AddWaypoint(v, false);
            mobCharacter.Stats[StatIds.health].Value = 10000;
            mobCharacter.DoNotDoTimers = false;
        }
开发者ID:gordonc64,项目名称:CellAO-NightPredator,代码行数:37,代码来源:Spawn.cs

示例6: ExecuteCommand

        /// <summary>
        /// </summary>
        /// <param name="character">
        /// </param>
        /// <param name="target">
        /// </param>
        /// <param name="args">
        /// </param>
        public override void ExecuteCommand(ICharacter character, Identity target, string[] args)
        {
            if (string.Compare(args[0], "spawnrandom", true) == 0)
            {
                this.SpawnRandomMob(character);
                return;
            }

            if (string.Compare(args[0], "spawncount", true) == 0)
            {
                this.SpawnCount(character);
                return;
            }

            if (string.Compare(args[1], "list", true) == 0)
            {
                // list templates
                IEnumerable<DBMobTemplate> mobTemplates =
                    MobTemplateDao.Instance.GetMobTemplatesByName((args.Length > 2) ? args[2] : "%", false);

                StringBuilder text = new StringBuilder("List of mobtemplates (Hash, Name): ");
                foreach (DBMobTemplate mt in mobTemplates)
                {
                    text.AppendLine(string.Format("{0},'{1}'", mt.Hash, mt.Name));
                }

                character.Playfield.Publish(ChatTextMessageHandler.Default.CreateIM(character, text.ToString()));
            }
            else
            {
                // try spawning mob
                Character mobCharacter = null;
                if (args.Length == 3)
                {
                    // DBMobTemplate mt = MobTemplateDao.GetMobTemplateByHash(args[1])
                    // character.Playfield.Despawn
                    //NonPlayerCharacterHandler.SpawnMonster(client, args[1], uint.Parse(args[2]));
                    NPCController npcController = new NPCController();
                    mobCharacter = NonPlayerCharacterHandler.SpawnMobFromTemplate(
                        args[1],
                        character.Playfield.Identity,
                        character.Coordinates(),
                        character.RawHeading,
                        npcController,
                        int.Parse(args[2]));
                }
                if (args.Length == 2)
                {
                    NPCController npcController = new NPCController();
                    mobCharacter = NonPlayerCharacterHandler.SpawnMobFromTemplate(
                        args[1],
                        character.Playfield.Identity,
                        character.Coordinates(),
                        character.RawHeading,
                        npcController);
                }
                if (mobCharacter != null)
                {
                    mobCharacter.Playfield = character.Playfield;
                    SimpleCharFullUpdateMessage mess = SimpleCharFullUpdate.ConstructMessage(mobCharacter);
                    character.Playfield.Announce(mess);
                    AppearanceUpdateMessageHandler.Default.Send(mobCharacter);
                    // HEAL!!!!
                    mobCharacter.Stats[StatIds.health].Value = mobCharacter.Stats[StatIds.life].Value;
                    mobCharacter.DoNotDoTimers = false;
                }
            }

            // this.CommandHelp(client);

            //var check = new List<Type> { typeof(float), typeof(float), typeof(int) };

            //var coord = new Coordinate();
            //int pf = character.Playfield.Identity.Instance;
            //if (CheckArgumentHelper(check, args))
            //{
            //    coord = new Coordinate(
            //        float.Parse(args[1], NumberStyles.Any, CultureInfo.InvariantCulture),
            //        character.Coordinates.y,
            //        float.Parse(args[2], NumberStyles.Any, CultureInfo.InvariantCulture));
            //    pf = int.Parse(args[3]);
            //}

            //check.Clear();
            //check.Add(typeof(float));
            //check.Add(typeof(float));
            //check.Add(typeof(string));
            //check.Add(typeof(float));
            //check.Add(typeof(int));

            //if (CheckArgumentHelper(check, args))
            //{
//.........这里部分代码省略.........
开发者ID:gordonc64,项目名称:CellAO-NightPredator,代码行数:101,代码来源:Spawn.cs

示例7: ExecuteCommand

 public override void ExecuteCommand(ICharacter character, Identity target, string[] args)
 {
     if (args[0].ToLower() == "walktest")
     {
         ICharacter npc = Pool.Instance.GetObject<ICharacter>(character.Playfield.Identity, character.SelectedTarget);
         if (npc != null)
         {
             Vector3 newcoords = new Vector3();
             newcoords.X = npc.RawCoordinates.X;
             newcoords.Y = npc.RawCoordinates.Y;
             newcoords.Z = npc.RawCoordinates.Z;
             newcoords.X += 20;
             npc.Controller.MoveTo(newcoords);
         }
     }
     if (args[0].ToLower() == "walkback")
     {
         ICharacter npc = Pool.Instance.GetObject<ICharacter>(character.Playfield.Identity, character.SelectedTarget);
         if (npc != null)
         {
             Vector3 newcoords = new Vector3();
             newcoords.X = npc.RawCoordinates.X;
             newcoords.Y = npc.RawCoordinates.Y;
             newcoords.Z = npc.RawCoordinates.Z;
             newcoords.X -= 20;
             npc.Controller.MoveTo(newcoords);
         }
     }
     if (args[0].ToLower() == "followtest")
     {
         ICharacter npc = Pool.Instance.GetObject<ICharacter>(character.Playfield.Identity, character.SelectedTarget);
         if (npc != null)
         {
             npc.Controller.Follow(character.Identity);
         }
     }
     if (args[0].ToLower() == "showcoords")
     {
         ICharacter npc = Pool.Instance.GetObject<ICharacter>(character.Playfield.Identity, character.SelectedTarget);
         if (npc != null)
         {
             character.Playfield.Publish(
                 ChatTextMessageHandler.Default.CreateIM(
                     character,
                     "Coordinates of " + character.SelectedTarget.ToString(true) + ": "
                     + npc.Coordinates().ToString()));
             character.Playfield.Publish(
                 ChatTextMessageHandler.Default.CreateIM(
                     character,
                     "Heading of " + character.SelectedTarget.ToString(true) + ": " + npc.Heading.ToString()));
         }
     }
     if (args[0].ToLower() == "addwp")
     {
         CellAO.Core.Vector.Vector3 v = character.Coordinates().coordinate;
         bool running = character.MoveMode == MoveModes.Run;
         ICharacter npc = Pool.Instance.GetObject<ICharacter>(character.Playfield.Identity, character.SelectedTarget);
         if (npc != null)
         {
             npc.AddWaypoint(v, running);
             character.Playfield.Publish(
                 ChatTextMessageHandler.Default.CreateIM(
                     character,
                     "Waypoint added: " + character.SelectedTarget.ToString(true) + ": "
                     + character.Coordinates().ToString()));
         }
     }
 }
开发者ID:gordonc64,项目名称:CellAO-NightPredator,代码行数:68,代码来源:WalkingTest.cs


注:本文中的ICharacter.Coordinates方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。