本文整理汇总了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
}
}
}