예제 #1
0
 public void OnInitializeCompleted()
 {
     _logger.Info("Server Room Initialize Completed");
     _state = RoomState.Running;
     _rule.GameStart(_contexts);
     _contexts.session.commonSession.SessionMode =
         ModeUtil.CreateSharedPlayerMode(_contexts, _contexts.session.commonSession.RoomInfo.ModeId);
     FreeMapPosition.Init(_contexts);
     DebugUtil.LogInUnity("Server Room Initialize Completed");
 }
예제 #2
0
        public void OnInitializeCompleted()
        {
            logger.Info("Server Room Initialize Completed");
            state = RoomState.Running;
            rule.GameStart(ContextsWrapper.contexts);
            ContextsWrapper.SessionMode =
                ModeUtil.CreateSharedPlayerMode(ContextsWrapper.contexts,
                                                ContextsWrapper.RoomInfo.ModeId);
            DebugUtil.InitShootArchiveS(ContextsWrapper.RoomInfo.RoomDisplayId);
            FreeMapPosition.Init(ContextsWrapper.contexts);
            DebugUtil.LogInUnity("Server Room Initialize Completed");

            if (channelToPlayer.Count == 0)
            {
                /*GameOver(true);*/
            }
        }
예제 #3
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);
        }
예제 #4
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);
        }