예제 #1
0
        public void Update(Game_PlayerController player)
        {
            player.Level.GameMap.OverlapActorsSquare(player.transform.position, ViewDistance, newEntities);
            for (int i = newEntities.Count; i-- > 0;)
            {
                if (ReferenceEquals(newEntities[i], player))
                {
                    newEntities.RemoveAt(i);
                    continue;
                }
                if (!syncedEntities.Contains(newEntities[i]))
                {
                    IntroduceRelevanceEntity(player, newEntities[i]);
                    syncedEntities.Add(newEntities[i]);
                }
                oldEntities.Remove(newEntities[i]);
            }
            for (int i = 0; i < oldEntities.Count; i++)
            {
                player.ActiveSession.S2C_BASE_PAWN_REMOVE(oldEntities[i].Pawn as Base_Pawn);
                syncedEntities.Remove(oldEntities[i]);
            }
            oldEntities.Clear();
            var ce = oldEntities;

            oldEntities = newEntities;
            newEntities = ce;
        }
예제 #2
0
 public GameSession Get(Game_PlayerController controller)
 {
     for (int i = 0; i < sessions.Count; i++)
     {
         var gs = sessions[i] as GameSession;
         if (gs != null && gs.ActiveController == controller)
         {
             return(gs);
         }
     }
     throw new Exception("Session not found for controller: " + controller);
 }
예제 #3
0
        public void S2C_PLAYER_ADD(Game_PlayerController pc)
        {
            var msg = GameHeader.S2C_PLAYER_ADD.CreatePacket();

            pc.WriteAddStream(msg);
            var pawn = pc.Pawn as Game_PlayerPawn;

            pawn.WriteAddStream(msg);
            pawn.Appearance.WriteAddStream(msg);
            pawn.BaseAppearance.WriteAddStream(msg);
            pawn.Character.WriteAddStream(msg);
            pawn.CharacterStats.WriteAddStream(msg);
            pawn.combatState.WriteAddStream(msg);
            pawn.Effects.WriteAddStream(msg);
            Connection.SendMessage(msg);
        }
예제 #4
0
        void IntroduceRelevanceEntity(Game_PlayerController player, Game_Controller other)
        {
            var pc = other as Game_PlayerController;

            if (pc != null)
            {
                player.ActiveSession.S2C_PLAYER_ADD(pc);
                return;
            }
            var npc = other as Game_NPCController;

            if (npc != null)
            {
                player.ActiveSession.S2C_NPC_ADD(npc);
                return;
            }
            Debug.LogWarning("Relevance ADD type not implemented: " + other.GetType());
        }
예제 #5
0
 public void cl_OnPlayerTick(float aDeltaTime, Game_PlayerController outer)
 {
     //Game_PlayerPawn gpp = (Game_PlayerPawn)outer.Pawn;
     outer.TickMovement(aDeltaTime);
 }