示例#1
0
 public static void SetPlayerToUnitPosition(PlayerEntity player, UnitPosition up)
 {
     up.SetX(player.position.Value.x);
     up.SetY(player.position.Value.y);
     up.SetZ(player.position.Value.z);
     up.SetYaw(player.orientation.Yaw);
     up.SetPitch(player.orientation.Pitch);
 }
示例#2
0
        public override UnitPosition Select(IEventArgs args)
        {
            UnitPosition up = new UnitPosition();

            up.SetX(FreeUtil.ReplaceFloat(x, args));
            up.SetY(FreeUtil.ReplaceFloat(y, args));
            up.SetZ(FreeUtil.ReplaceFloat(z, args));
            up.SetYaw(FreeUtil.ReplaceFloat(yaw, args));
            up.SetPitch(FreeUtil.ReplaceFloat(pitch, args));
            return(up);
        }
        public override UnitPosition Select(IEventArgs args)
        {
            UnitPosition up = new UnitPosition();

            up.SetX(FreeUtil.ReplaceFloat(x, args));
            up.SetY(FreeUtil.ReplaceFloat(y, args));
            up.SetZ(FreeUtil.ReplaceFloat(z, args));
            up.SetYaw(FreeUtil.ReplaceFloat(yaw, args));
            up.SetPitch(FreeUtil.ReplaceFloat(pitch, args));
            up.SetInvalid(FreeUtil.ReplaceBool(invalid, args));
            up.SetRandomindex(FreeUtil.ReplaceInt(randomindex, args));
            return(up);
        }
示例#4
0
 private void Adjust(UnitPosition up, IEventArgs args)
 {
     up.SetX(up.GetX() + FreeUtil.ReplaceInt(x, args));
     up.SetY(up.GetY() + FreeUtil.ReplaceInt(y, args));
     up.SetZ(up.GetZ() + FreeUtil.ReplaceInt(z, args));
     if (!StringUtil.IsNullOrEmpty(pitch))
     {
         up.SetPitch(FreeUtil.ReplaceFloat(pitch, args));
     }
     if (!StringUtil.IsNullOrEmpty(yaw))
     {
         up.SetYaw(FreeUtil.ReplaceFloat(yaw, args));
     }
 }
示例#5
0
        private UnitPosition GetPosition(IEventArgs args, UnitPosition old,
                                         double angle)
        {
            Vector3 dir = new Vector3();
            Vector3 end = new Vector3();

            AnglesToVector(angle, FreeUtil.ReplaceFloat(pitch, args), ref dir);
            Vector3DMA(new Vector3(old.GetX(), old.GetY(), old.GetZ()), FreeUtil.ReplaceFloat(distance, args), dir, ref end);

            UnitPosition up = new UnitPosition();

            up.SetX(end.x);
            up.SetY(end.y + FreeUtil.ReplaceFloat(height, args));
            up.SetZ(end.z);
            up.SetYaw(old.GetYaw());

            return(up);
        }
示例#6
0
        public static UnitPosition GetAnglePosition(UnitPosition old,
                                                    double angle, float pitch, float distance, float height)
        {
            Vector3 dir = new Vector3();
            Vector3 end = new Vector3();

            AnglesToVector(angle, pitch, ref dir);
            Vector3DMA(new Vector3(old.GetX(), old.GetY(), old.GetZ()), distance, dir, ref end);

            UnitPosition up = new UnitPosition();

            up.SetX(end.x);
            up.SetY(end.y + height);
            up.SetZ(end.z);
            up.SetYaw(old.GetYaw());

            return(up);
        }
示例#7
0
 public override UnitPosition GetCenter(IEventArgs arg1)
 {
     foreach (MapConfigPoints.ID_Point p in MapConfigPoints.current.IDPints)
     {
         if (p.ID == FreeUtil.ReplaceInt(type, arg1))
         {
             UnitPosition unitPosition = new UnitPosition();
             if (p.points.Count > 0)
             {
                 unitPosition.SetX(p.points[0].pos.x);
                 unitPosition.SetY(p.points[0].pos.y);
                 unitPosition.SetZ(p.points[0].pos.z);
                 unitPosition.SetYaw(p.points[0].dir);
                 unitPosition.SetCylinderVolR(p.points[0].cylinderVolR);
                 unitPosition.SetCylinderVolH(p.points[0].cylinderVolH);
                 return(unitPosition);
             }
         }
     }
     return(null);
 }
示例#8
0
        public override UnitPosition Select(IEventArgs args)
        {
            if (tempPosition == null)
            {
                tempPosition = new UnitPosition();
                bitDic       = new Dictionary <int, RandomBit>();
            }

            if (MapConfigPoints.current != null)
            {
                int realType  = FreeUtil.ReplaceInt(type, args);
                int realIndex = FreeUtil.ReplaceInt(index, args);

                int mapId = args.GameContext.session.commonSession.RoomInfo.MapId;

                foreach (MapConfigPoints.ID_Point p in FreeMapPosition.GetPositions(mapId).IDPints)
                {
                    if (p.ID == realType)
                    {
                        if (!bitDic.ContainsKey(p.ID))
                        {
                            bitDic.Add(p.ID, new RandomBit(p.points.Count));
                        }

                        Vector3 v = Vector3.zero;
                        if (realIndex == 0)
                        {
                            v = p.points[Random(p.ID, p.points.Count)].pos;
                            if (birth)
                            {
                                if (HasPlayerNearBy(v, args))
                                {
                                    for (int i = 0; i < p.points.Count; i++)
                                    {
                                        realIndex = Random(p.ID, p.points.Count);
                                        v         = p.points[realIndex].pos;
                                        if (!HasPlayerNearBy(v, args))
                                        {
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (realIndex < 0 || realIndex >= p.points.Count)
                            {
                                realIndex = Math.Min(0, p.points.Count - 1);
                            }
                            v = p.points[realIndex].pos;
                        }
                        tempPosition.SetX(v.x);
                        tempPosition.SetY(v.y);
                        tempPosition.SetZ(v.z);
                        tempPosition.SetYaw(p.points[realIndex].dir);
                        tempPosition.SetCylinderVolR(p.points[realIndex].cylinderVolR);
                        tempPosition.SetCylinderVolH(p.points[realIndex].cylinderVolH);
                        break;
                    }
                }
            }

            return(tempPosition);
        }