예제 #1
0
        private static void spawnTarget(FactionCountry faction, Vector3 position, Vector3 forward, int distance, int num)
        {
            if (!posList.ContainsKey(faction))
            {
                posList.Add(faction, new Queue <Vector3>());
            }
            Vector3 center      = position + forward.normalized * distance;
            Vector3 forward_hoz = Quaternion.Euler(0, 90, 0) * forward.normalized;

            for (int i = 0; i < num; i++)
            {
                Vector3 item;
                if (i % 2 == 0)
                {
                    item = center + ((i / 2) + 1) * forward_hoz.normalized;
                }
                else
                {
                    item = center - (i / 2) * forward_hoz.normalized;
                }
                item.y = vectorAngle(new Vector2(position.x, position.y), new Vector2(item.x, item.y));
                posList[faction].Enqueue(item);
            }
            posList.ToDfList().ForEach((KeyValuePair <FactionCountry, Queue <Vector3> > pair) =>
            {
                pair.Value.ToDfList().ForEach((Vector3 pos) =>
                {
                    int id = Framework.addCarbonPlayer("靶标机器人");
                    botList.Add(id);
                    Framework.CarbonPlayer player = Framework.getCarbonPlayer(id);
                    player.spawn(pair.Key, PlayerClass.ArmyLineInfantry);
                });
            });
        }
예제 #2
0
            public void spawn(FactionCountry factionCountry, PlayerClass playerClass)
            {
                int currentRoundIdentifier = instant.serverGameManager.CurrentRoundIdentifier;
                SpawnSectionCriteria spawnSectionCriteria = ComponentReferenceManager.genericObjectPools.spawnSectionCriteria.Obtain();

                spawnSectionCriteria.Faction = factionCountry;
                dfList <SpawnSection> dfList = instant.serverSpawnSectionManager.QuerySpawnSections(spawnSectionCriteria, false);

                ComponentReferenceManager.genericObjectPools.spawnSectionCriteria.Release(spawnSectionCriteria);
                if (dfList.Count == 0)
                {
                    dfList.Release();
                    return;
                }
                int sectionIdentifier = dfList[0].sectionIdentifier;

                dfList.Release();
                int characterHeadIdentifier = 1;
                CharacterVoiceIdentifier  characterVoiceIdentifier = getDefaultVoice(factionCountry);
                ClientChosenSpawnSettings spawnSettings            = new ClientChosenSpawnSettings
                {
                    RoundIdentifier          = currentRoundIdentifier,
                    CharacterVoiceIdentifier = characterVoiceIdentifier,
                    CharacterHeadIdentifier  = characterHeadIdentifier,
                    Faction        = factionCountry,
                    ClassType      = playerClass,
                    SpawnSectionID = sectionIdentifier
                };

                instant.serverGameManager.QueueClientChosenSpawnSettings(networkPlayer, spawnSettings, false);
            }
예제 #3
0
    public void OnPlayerSpawned(int playerId, int spawnSectionId, FactionCountry playerFaction, PlayerClass playerClass, int uniformId, GameObject playerObject)
    {
        playerFactionDictionary[playerId] = playerFaction;
        playerObjectDictionary[playerId]  = playerObject;

        if (runningCommands.Count > 0)
        {
            var  runningCommand = runningCommands[0];
            bool isBot;
            if (playerIsBotDictionary.TryGetValue(playerId, out isBot) && isBot)
            {
                runningCommand.requiredToSpawn--;
                if (runningCommand.requiredToSpawn == 0)
                {
                    runningCommands.RemoveAt(0);
                }

                var targetPosition = runningCommand.position + (runningCommand.rightDirection * runningCommand.spawnedCount);
                var hits           = Physics.RaycastNonAlloc(targetPosition, Vector3.down, resultHits, 2);
                if (hits > 0)
                {
                    var closestDistance = resultHits[0].distance;
                    var closestPoint    = resultHits[0].point;
                    for (int i = 1; i < hits; i++)
                    {
                        var raycastHit = resultHits[i];
                        if (closestDistance < raycastHit.distance)
                        {
                            closestDistance = raycastHit.distance;
                            closestPoint    = raycastHit.point;
                        }
                    }

                    targetPosition = closestPoint;
                }

                playerObject.transform.position    = targetPosition;
                playerObject.transform.eulerAngles = new Vector3(0, runningCommand.yRotation, 0);

                Debug.LogFormat("YRotation set to {0}", playerObject.transform.eulerAngles);

                runningCommand.spawnedCount++;

                faceDirections.Add(new ForceFacingDirection()
                {
                    playerTransform  = playerObject.transform,
                    facingDirection  = new Vector3(0, runningCommand.yRotation, 0),
                    stopRotatingTime = currentTime + 5
                });
            }
        }
    }
예제 #4
0
            private CharacterVoiceIdentifier getDefaultVoice(FactionCountry factionCountry)
            {
                switch (factionCountry)
                {
                case FactionCountry.British:
                    return(CharacterVoiceIdentifier.Joseph_British_1);

                case FactionCountry.French:
                    return(CharacterVoiceIdentifier.Herve_French_1);

                case FactionCountry.Prussian:
                    return(CharacterVoiceIdentifier.Fabrec_Prussian_1);

                default:
                    return(CharacterVoiceIdentifier.Joseph_British_1);
                }
            }
예제 #5
0
        private static void Framework_playerSpawnDelegate(int playerId)
        {
            ServerRoundPlayer serverRoundPlayer =
                instant.serverRoundPlayerManager.ResolveServerRoundPlayer(playerId);

            if (serverRoundPlayer.NetworkPlayer.isCarbonPlayer && serverRoundPlayer.SpawnData.ClassType == PlayerClass.ArmyLineInfantry)
            {
                FactionCountry faction = serverRoundPlayer.SpawnData.Faction;
                if (!posList.ContainsKey(faction))
                {
                    return;
                }
                Vector3 vector = posList[faction].Dequeue();
                Framework.CarbonPlayer player = Framework.getCarbonPlayer(playerId);
                player.teleport(vector);
                vector.x = 0;
                vector.z = 0;
                Framework.getCarbonPlayer(playerId).activeAction(PlayerActions.FireFirearm, vector, MeleeStrikeType.None);
            }
        }
예제 #6
0
 public void OnRoundDetails(int roundId, string serverName, string mapName, FactionCountry attackingFaction, FactionCountry defendingFaction, GameplayMode gameplayMode, GameType gameType)
 {
     Debug.LogFormat("OnRoundDetails {0} {1} {2} {3} {4} {5} {6}", roundId, serverName, mapName, attackingFaction, defendingFaction,
                     gameplayMode, gameType);
 }
예제 #7
0
 public void OnPlayerSpawned(int playerId, int spawnSectionId, FactionCountry playerFaction, PlayerClass playerClass, int uniformId, GameObject playerObject)
 {
 }
예제 #8
0
 public void OnShipSpawned(int shipId, GameObject shipObject, FactionCountry shipfaction, ShipType shipType, int shipNameId)
 {
 }
예제 #9
0
 public void OnVehicleSpawned(int vehicleId, FactionCountry playerFaction, PlayerClass playerClass, GameObject playerObject, int ownerPlayerId)
 {
 }
예제 #10
0
 public void OnRoundEndFactionWinner(FactionCountry factionCountry, FactionRoundWinnerReason reason)
 {
 }
예제 #11
0
 public void OnRoundDetails(int roundId, string serverName, string mapName, FactionCountry attackingFaction, FactionCountry defendingFaction, GameplayMode gameplayMode, GameType gameType)
 {
 }
예제 #12
0
 public void OnCapturePointOwnerChanged(int capturePoint, FactionCountry factionCountry)
 {
 }
예제 #13
0
 public void OnPlayerSpawned(int playerId, int spawnSectionId, FactionCountry playerFaction, PlayerClass playerClass, int uniformId, GameObject playerObject)
 {
     Debug.LogFormat("OnPlayerSpawned {0} {1} {2} {3} {4} {5}", playerId, spawnSectionId, playerFaction, playerClass, uniformId, playerObject.name);
 }
예제 #14
0
 public void OnShipSpawned(int shipId, GameObject shipObject, FactionCountry shipfaction, ShipType shipType, int shipNameId)
 {
     Debug.LogFormat("OnShipSpawned {0} {1} {2} {3}, {4}", shipId, shipObject.name, shipfaction, shipType, shipNameId);
 }
예제 #15
0
 public void OnVehicleSpawned(int vehicleId, FactionCountry vehicleFaction, PlayerClass vehicleClass, GameObject vehicleObject, int ownerPlayerId)
 {
     Debug.LogFormat("OnVehicleSpawned {0} {1} {2} {3} {4}", vehicleId, vehicleFaction, vehicleClass, vehicleObject.name, ownerPlayerId);
 }
예제 #16
0
 public void OnRoundEndFactionWinner(FactionCountry factionCountry, FactionRoundWinnerReason reason)
 {
     Debug.LogFormat("OnRoundEndFactionWinner {0} {1}", factionCountry, reason);
 }
예제 #17
0
 public void OnCapturePointOwnerChanged(int capturePoint, FactionCountry factionCountry)
 {
     Debug.LogFormat("OnCapturePointOwnerChanged {0} {1}", capturePoint, factionCountry.ToString());
 }