コード例 #1
0
 // Token: 0x060012DC RID: 4828 RVA: 0x0005105C File Offset: 0x0004F25C
 public void BeginEncounter()
 {
     if (this.hasSpawnedServer || !NetworkServer.active)
     {
         return;
     }
     for (int i = 0; i < this.spawns.Length; i++)
     {
         ref ScriptedCombatEncounter.SpawnInfo spawnInfo = ref this.spawns[i];
         this.Spawn(ref spawnInfo);
     }
コード例 #2
0
        // Token: 0x060012DB RID: 4827 RVA: 0x00050F00 File Offset: 0x0004F100
        private void Spawn(ref ScriptedCombatEncounter.SpawnInfo spawnInfo)
        {
            Vector3 position = base.transform.position;
            DirectorPlacementRule directorPlacementRule = new DirectorPlacementRule
            {
                placementMode = DirectorPlacementRule.PlacementMode.NearestNode,
                minDistance   = 0f,
                maxDistance   = 1000f,
                position      = position
            };

            if (spawnInfo.explicitSpawnPosition)
            {
                directorPlacementRule.placementMode = DirectorPlacementRule.PlacementMode.Direct;
                directorPlacementRule.spawnOnTarget = spawnInfo.explicitSpawnPosition;
            }
            DirectorSpawnRequest directorSpawnRequest = new DirectorSpawnRequest(spawnInfo.spawnCard, directorPlacementRule, this.rng);

            directorSpawnRequest.ignoreTeamMemberLimit = true;
            directorSpawnRequest.teamIndexOverride     = new TeamIndex?(this.teamIndex);
            GameObject gameObject = DirectorCore.instance.TrySpawnObject(directorSpawnRequest);

            if (gameObject)
            {
                this.hasSpawnedServer = true;
                float num  = 1f;
                float num2 = 1f;
                num  += Run.instance.difficultyCoefficient / 2.5f;
                num2 += Run.instance.difficultyCoefficient / 30f;
                int livingPlayerCount = Run.instance.livingPlayerCount;
                num *= Mathf.Pow((float)livingPlayerCount, 0.5f);
                CharacterMaster component = gameObject.GetComponent <CharacterMaster>();
                component.inventory.GiveItem(ItemIndex.BoostHp, Mathf.RoundToInt((num - 1f) * 10f));
                component.inventory.GiveItem(ItemIndex.BoostDamage, Mathf.RoundToInt((num2 - 1f) * 10f));
                this.combatSquad.AddMember(component);
            }
        }