Exemplo n.º 1
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));
            up.SetInvalid(FreeUtil.ReplaceBool(invalid, args));
            up.SetRandomindex(FreeUtil.ReplaceInt(randomindex, args));
            return(up);
        }
Exemplo n.º 2
0
        public override UnitPosition Select(IEventArgs args)
        {
            if (tempPosition == null)
            {
                tempPosition = new UnitPosition();
            }

            if (MapConfigPoints.current != null)
            {
                int realType = FreeUtil.ReplaceInt(type, args);
                int mapId    = args.GameContext.session.commonSession.RoomInfo.MapId;
                var poss     = args.FreeContext.Poss;
                foreach (MapConfigPoints.ID_Point p in FreeMapPosition.GetPositions(mapId).IDPints)
                {
                    if (p.ID == realType)
                    {
                        RandomBit randomBit = poss.AddRandomBit(p.ID, p.points.Count);
                        Vector3   v         = Vector3.zero;
                        int       index     = -1;
                        bool      invalid   = false;
                        if (randomBit.index >= 0)
                        {
                            index = poss.GetRandomBit(p.ID, p.points.Count);
                            v     = p.points[index].pos;
                        }
                        else
                        {
                            invalid = true;
                        }
                        tempPosition.SetInvalid(invalid);
                        tempPosition.SetX(v.x);
                        tempPosition.SetY(v.y);
                        tempPosition.SetZ(v.z);
                        tempPosition.SetRandomindex(index);
                        return(tempPosition);
                    }
                }
            }
            return(tempPosition);
        }