示例#1
0
        public override void DoAction(IEventArgs args)
        {
            FreeData fd       = GetPlayer(args);
            int      realTime = args.GetInt(time);

            if (realTime < 0)
            {
                fd.EffectBufs.RemoveEffect(args.GetString(effect), args.GetFloat(level));
            }
            else
            {
                fd.EffectBufs.AddEffect(args.GetString(effect), args.GetFloat(level), realTime);
            }
        }
示例#2
0
        private void HandlePlayer(Collider collider, IEventArgs fr, Contexts contexts, float damage, Vector3 bombPos)
        {
            var entityReference = collider.transform.GetComponent <EntityReference>();
            var player          = entityReference.Reference as PlayerEntity;

            if (null == player)
            {
                Logger.ErrorFormat("player {0} has no player reference ", collider.name);
                return;
            }
            if (HasObstacle(player.position.Value, player.position.Value + Vector3.up * CeilCheckDistance))
            {
                return;
            }

            /*if (player.IsOnVehicle())
             * {
             *  if (Logger.IsDebugEnabled)
             *  {
             *      Logger.Debug("player in vehicle ");
             *  }
             *  var vehicleEntity = contexts.vehicle.GetEntityWithEntityKey(player.controlledVehicle.EntityKey);
             *  vehicleEntity.GetGameData().DecreaseHp(Core.Prediction.VehiclePrediction.Cmd.VehiclePartIndex.Body, damage);
             * }
             * else
             * {*/
            if (null != action)
            {
                disPara.SetValue(Math.Max(0,
                                          (fr.GetFloat(radius) - Vector3.Distance(bombPos, player.position.Value)) / fr.GetFloat(radius)));
                fr.TempUsePara(damagePara);
                fr.TempUsePara(disPara);
                fr.TempUsePara(typePara);
                fr.TempUse("current", (FreeData)player.freeData.FreeData);
                action.Act(fr);

                fr.ResumePara("damage");
                fr.ResumePara("dis");
                fr.ResumePara("type");
                fr.Resume("current");
            }

            //}
        }
        protected override void BuildMessage(IEventArgs args)
        {
            builder.Key = args.GetInt(key);
            if (fields != null)
            {
                for (int i = 0; i < fields.Count; i++)
                {
                    switch (fields[i].type)
                    {
                    case KeyField:
                        builder.Ks.Add(args.GetInt(fields[i].value));
                        break;

                    case IntField:
                        builder.Ins.Add(args.GetInt(fields[i].value));
                        break;

                    case BoolField:
                        builder.Bs.Add(args.GetBool(fields[i].value));
                        break;

                    case StringField:
                        builder.Ss.Add(args.GetString(fields[i].value));
                        break;

                    case FloatField:
                        builder.Fs.Add(args.GetFloat(fields[i].value));
                        break;

                    case DoubleField:
                        builder.Ds.Add(args.getDouble(fields[i].value));
                        break;

                    case LongField:
                        builder.Ls.Add(args.GetLong(fields[i].value));
                        break;
                    }
                }
            }
        }