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


C# Instance.ConsoleMessage方法代码示例

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


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

示例1: vp_OnAvatarClick

        static void vp_OnAvatarClick(Instance sender, AvatarClickEventArgsT<Avatar<Vector3>, Vector3> args)
        {
            var distance = Vector3.Distance(args.Avatar.Position, args.ClickedAvatar.Position);
             Console.WriteLine(distance);

            //storage.stats.Find(x => x._name.Contains("seat")));
            //storage.stats.Find(x => x._name == args.ClickedAvatar.Name);
            for (int i = 0; i < storage.stats.Count; i++) // Loop through List with for
            {
                if (args.ClickedAvatar.Name == storage.stats[i]._name)
                {
                    if (storage.stats[i]._wep == "knife" && distance <= .5)
                    {
                        Console.WriteLine("knifed");
                        sender.ConsoleMessage(args.Avatar, "jeeves", string.Format("knifed {0}", args.ClickedAvatar.Name));
                        storage.stats[i]._health = storage.stats[i]._health - 5;

                        //sender.ConsoleMessage(args.Avatar, "jeeves", string.Format("{0} was stabbed by {1}", args.ClickedAvatar.Name, args.Avatar.Name)); //saw you saw trooper

                    }

                    else if (storage.stats[i]._wep == "handgun" && distance <= 5)
                    {
                        storage.stats[i]._ammo = storage.stats[i]._ammo - 1;
                        storage.stats[i]._health = storage.stats[i]._health - 5;
                        //sender.ConsoleMessage(args.Avatar, "jeeves", string.Format("{0} was shot by {1}", args.ClickedAvatar.Name, args.Avatar.Name)); //saw you saw trooper

                    }

                    else if (storage.stats[i]._wep == "sniper" && distance <= 15)
                    {
                        storage.stats[i]._ammo = storage.stats[i]._ammo - 1;
                        storage.stats[i]._health = storage.stats[i]._health - 5;
                        //sender.ConsoleMessage(args.Avatar, "jeeves", string.Format("{0} was sniped by {1}", args.ClickedAvatar.Name, args.Avatar.Name)); //saw you saw trooper

                    }

                    else if (storage.stats[i]._wep == "rocketlauncher" && distance <= 10)
                    {

                        //need help with splash code HELP!

                        storage.stats[i]._ammo = storage.stats[i]._ammo - 1;
                        storage.stats[i]._health = storage.stats[i]._health - 5;

                        // splash code
                        //sender.ConsoleMessage(args.Avatar, "jeeves", string.Format("{0} was blownup by {1}", args.ClickedAvatar.Name, args.Avatar.Name)); //saw you saw trooper

                    }
                    else
                    {
                        Console.WriteLine("failed");
                    }
                }

                if (storage.stats[i]._health <= 10) //if dead clause
                {

                    args.ClickedAvatar.Position = new Vector3(0, 1, 0);
                    args.ClickedAvatar.Rotation = new Vector3(0, 0, 0);
                    sender.TeleportAvatar(args.ClickedAvatar);
                    storage.stats[i]._health = 20;
                    storage.stats[i]._armor = 0;
                    storage.stats[i]._wep = "knife";
                    storage.stats[i]._ammo = 6;

                    //sender.ConsoleMessage(args.Avatar, "jeeves", string.Format("{0} was sent to hospital by {1}", args.ClickedAvatar.Name, args.Avatar.Name)); //saw you saw trooper
                }

            }
        }
开发者ID:Quiddityco,项目名称:jeeves,代码行数:71,代码来源:Program.cs


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