// Token: 0x060004E4 RID: 1252 RVA: 0x00013AA4 File Offset: 0x00011CA4 public override GameObject DoSpawn(Vector3 position, Quaternion rotation, DirectorSpawnRequest directorSpawnRequest) { Vector3 position2 = position; position2.y += Util.GetBodyPrefabFootOffset(this.prefab); GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.prefab, position2, rotation); NetworkServer.Spawn(gameObject); return(gameObject); }
// Token: 0x06000515 RID: 1301 RVA: 0x00014494 File Offset: 0x00012694 public virtual GameObject DoSpawn(Vector3 position, Quaternion rotation, DirectorSpawnRequest spawnRequest) { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.prefab, position, rotation); if (this.sendOverNetwork) { NetworkServer.Spawn(gameObject); } return(gameObject); }
// Token: 0x060004E8 RID: 1256 RVA: 0x00013B70 File Offset: 0x00011D70 public override GameObject DoSpawn(Vector3 position, Quaternion rotation, DirectorSpawnRequest directorSpawnRequest) { CharacterMaster characterMaster = new MasterSummon { masterPrefab = this.prefab, position = position, rotation = rotation, summonerBodyObject = directorSpawnRequest.summonerBodyObject, teamIndexOverride = directorSpawnRequest.teamIndexOverride, ignoreTeamMemberLimit = directorSpawnRequest.ignoreTeamMemberLimit, loadout = this._runtimeLoadout }.Perform(); if (characterMaster == null) { return(null); } return(characterMaster.gameObject); }
// Token: 0x060004EC RID: 1260 RVA: 0x00013C14 File Offset: 0x00011E14 public override GameObject DoSpawn(Vector3 position, Quaternion rotation, DirectorSpawnRequest directorSpawnRequest) { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.prefab, position, rotation); Transform transform = gameObject.transform; RaycastHit raycastHit; if (this.orientToFloor && Physics.Raycast(new Ray(position + gameObject.transform.up * 3f, -transform.up), out raycastHit, 9f, LayerIndex.world.mask)) { transform.up = raycastHit.normal; } transform.Rotate(Vector3.up, UnityEngine.Random.Range(0f, 360f), Space.Self); if (this.slightlyRandomizeOrientation) { transform.Translate(Vector3.down * 0.3f, Space.Self); transform.rotation *= Quaternion.Euler(UnityEngine.Random.Range(-30f, 30f), UnityEngine.Random.Range(-30f, 30f), UnityEngine.Random.Range(-30f, 30f)); } NetworkServer.Spawn(gameObject); return(gameObject); }
// 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); } }
// Token: 0x06001294 RID: 4756 RVA: 0x0004FF00 File Offset: 0x0004E100 private void PopulateScene() { ClassicStageInfo component = SceneInfo.instance.GetComponent <ClassicStageInfo>(); this.PlaceTeleporter(); Action action = new Action(this.DefaultPlayerSpawnPointGenerator); SceneDirector.GenerateSpawnPointsDelegate generateSpawnPointsDelegate = SceneDirector.onPreGeneratePlayerSpawnPointsServer; if (generateSpawnPointsDelegate != null) { generateSpawnPointsDelegate(this, ref action); } if (action != null) { action(); } Run.instance.OnPlayerSpawnPointsPlaced(this); while (this.interactableCredit > 0) { DirectorCard directorCard = this.SelectCard(component.interactableSelection, this.interactableCredit); if (directorCard == null) { break; } if (directorCard.CardIsValid()) { this.interactableCredit -= directorCard.cost; if (Run.instance) { int i = 0; while (i < 10) { DirectorPlacementRule placementRule = new DirectorPlacementRule { placementMode = DirectorPlacementRule.PlacementMode.Random }; GameObject gameObject = this.directorCore.TrySpawnObject(new DirectorSpawnRequest(directorCard.spawnCard, placementRule, this.rng)); if (gameObject) { PurchaseInteraction component2 = gameObject.GetComponent <PurchaseInteraction>(); if (component2 && component2.costType == CostTypeIndex.Money) { component2.Networkcost = Run.instance.GetDifficultyScaledCost(component2.cost); break; } break; } else { i++; } } } } } if (Run.instance && Run.instance.stageClearCount == 0) { this.monsterCredit = 0; } int num = 0; while (this.monsterCredit > 0 && num < 40) { DirectorCard directorCard2 = this.SelectCard(component.monsterSelection, this.monsterCredit); if (directorCard2 == null) { break; } if (directorCard2.CardIsValid()) { this.monsterCredit -= directorCard2.cost; int j = 0; while (j < 10) { DirectorSpawnRequest directorSpawnRequest = new DirectorSpawnRequest(directorCard2.spawnCard, new DirectorPlacementRule { placementMode = DirectorPlacementRule.PlacementMode.Random }, this.rng); directorSpawnRequest.teamIndexOverride = new TeamIndex?(TeamIndex.Monster); GameObject gameObject2 = this.directorCore.TrySpawnObject(directorSpawnRequest); if (gameObject2) { num++; CharacterMaster component3 = gameObject2.GetComponent <CharacterMaster>(); if (component3) { GameObject bodyObject = component3.GetBodyObject(); if (bodyObject) { DeathRewards component4 = bodyObject.GetComponent <DeathRewards>(); if (component4) { component4.expReward = (uint)((float)directorCard2.cost * this.expRewardCoefficient * Run.instance.difficultyCoefficient); component4.goldReward = (uint)((float)directorCard2.cost * this.expRewardCoefficient * 2f * Run.instance.difficultyCoefficient); } foreach (EntityStateMachine entityStateMachine in bodyObject.GetComponents <EntityStateMachine>()) { entityStateMachine.initialStateType = entityStateMachine.mainStateType; } } num++; break; } break; } else { j++; } } } } Xoroshiro128Plus xoroshiro128Plus = new Xoroshiro128Plus(this.rng.nextUlong); if (SceneInfo.instance.countsAsStage) { int num2 = 0; foreach (CharacterMaster characterMaster in CharacterMaster.readOnlyInstancesList) { num2 += characterMaster.inventory.GetItemCount(ItemIndex.TreasureCache); } if (num2 > 0) { GameObject gameObject3 = DirectorCore.instance.TrySpawnObject(new DirectorSpawnRequest(Resources.Load <SpawnCard>("SpawnCards/InteractableSpawnCard/iscLockbox"), new DirectorPlacementRule { placementMode = DirectorPlacementRule.PlacementMode.Random }, xoroshiro128Plus)); if (gameObject3) { ChestBehavior component5 = gameObject3.GetComponent <ChestBehavior>(); if (component5) { component5.tier2Chance *= (float)num2; component5.tier3Chance *= Mathf.Pow((float)num2, 2f); } } } } }
// Token: 0x06000A25 RID: 2597 RVA: 0x0002C404 File Offset: 0x0002A604 public GameObject TrySpawnObject([NotNull] DirectorSpawnRequest directorSpawnRequest) { SpawnCard spawnCard = directorSpawnRequest.spawnCard; DirectorPlacementRule placementRule = directorSpawnRequest.placementRule; Xoroshiro128Plus rng = directorSpawnRequest.rng; NodeGraph nodeGraph = SceneInfo.instance.GetNodeGraph(spawnCard.nodeGraphType); GameObject result = null; switch (placementRule.placementMode) { case DirectorPlacementRule.PlacementMode.Direct: result = spawnCard.DoSpawn(placementRule.spawnOnTarget ? placementRule.spawnOnTarget.position : directorSpawnRequest.placementRule.position, Quaternion.identity, directorSpawnRequest); break; case DirectorPlacementRule.PlacementMode.Approximate: { List <NodeGraph.NodeIndex> list = nodeGraph.FindNodesInRangeWithFlagConditions(placementRule.targetPosition, placementRule.minDistance, placementRule.maxDistance, (HullMask)(1 << (int)spawnCard.hullSize), spawnCard.requiredFlags, spawnCard.forbiddenFlags, placementRule.preventOverhead); while (list.Count > 0) { int index = rng.RangeInt(0, list.Count); NodeGraph.NodeIndex nodeIndex = list[index]; Vector3 position; nodeGraph.GetNodePosition(nodeIndex, out position); if (this.CheckPositionFree(nodeGraph, nodeIndex, spawnCard)) { result = spawnCard.DoSpawn(position, Quaternion.identity, directorSpawnRequest); if (spawnCard.occupyPosition) { this.AddOccupiedNode(nodeGraph, nodeIndex); break; } break; } else { list.RemoveAt(index); } } break; } case DirectorPlacementRule.PlacementMode.ApproximateSimple: { NodeGraph.NodeIndex nodeIndex2 = nodeGraph.FindClosestNodeWithFlagConditions(placementRule.targetPosition, spawnCard.hullSize, spawnCard.requiredFlags, spawnCard.forbiddenFlags, placementRule.preventOverhead); Vector3 position2; if (nodeGraph.GetNodePosition(nodeIndex2, out position2)) { if (this.CheckPositionFree(nodeGraph, nodeIndex2, spawnCard)) { result = spawnCard.DoSpawn(position2, Quaternion.identity, directorSpawnRequest); if (spawnCard.occupyPosition) { this.AddOccupiedNode(nodeGraph, nodeIndex2); } } else { Debug.Log("Position not free."); } } else { Debug.Log("Could not find node."); } break; } case DirectorPlacementRule.PlacementMode.NearestNode: { NodeGraph.NodeIndex nodeIndex3 = nodeGraph.FindClosestNodeWithFlagConditions(placementRule.targetPosition, spawnCard.hullSize, spawnCard.requiredFlags, spawnCard.forbiddenFlags, placementRule.preventOverhead); Vector3 position3; if (nodeGraph.GetNodePosition(nodeIndex3, out position3)) { result = spawnCard.DoSpawn(position3, Quaternion.identity, directorSpawnRequest); if (spawnCard.occupyPosition) { this.AddOccupiedNode(nodeGraph, nodeIndex3); } } break; } case DirectorPlacementRule.PlacementMode.Random: { List <NodeGraph.NodeIndex> activeNodesForHullMaskWithFlagConditions = nodeGraph.GetActiveNodesForHullMaskWithFlagConditions((HullMask)(1 << (int)spawnCard.hullSize), spawnCard.requiredFlags, spawnCard.forbiddenFlags); while (activeNodesForHullMaskWithFlagConditions.Count > 0) { int index2 = rng.RangeInt(0, activeNodesForHullMaskWithFlagConditions.Count); NodeGraph.NodeIndex nodeIndex4 = activeNodesForHullMaskWithFlagConditions[index2]; Vector3 position4; if (nodeGraph.GetNodePosition(nodeIndex4, out position4) && this.CheckPositionFree(nodeGraph, nodeIndex4, spawnCard)) { result = spawnCard.DoSpawn(position4, Quaternion.identity, directorSpawnRequest); if (spawnCard.occupyPosition) { this.AddOccupiedNode(nodeGraph, nodeIndex4); break; } break; } else { activeNodesForHullMaskWithFlagConditions.RemoveAt(index2); } } break; } } return(result); }
// Token: 0x06000505 RID: 1285 RVA: 0x00014327 File Offset: 0x00012527 public override GameObject DoSpawn(Vector3 position, Quaternion rotation, DirectorSpawnRequest directorSpawnRequest) { this.prefab = this.masterPrefabs[(int)(directorSpawnRequest.rng.nextNormalizedFloat * (float)this.masterPrefabs.Length)]; return(base.DoSpawn(position, rotation, directorSpawnRequest)); }
// Token: 0x06000934 RID: 2356 RVA: 0x00027E88 File Offset: 0x00026088 private bool AttemptSpawnOnTarget(GameObject spawnTarget) { if (this.currentMonsterCard == null) { if (CombatDirector.cvDirectorCombatEnableInternalLogs.value) { Debug.Log("Current monster card is null, pick new one."); } this.PrepareNewMonsterWave(this.monsterCards.Evaluate(this.rng.nextNormalizedFloat)); } if (!spawnTarget) { if (CombatDirector.cvDirectorCombatEnableInternalLogs.value) { Debug.LogFormat("Spawn target {0} is invalid.", new object[] { spawnTarget }); } return(false); } if (this.spawnCountInCurrentWave >= this.maximumNumberToSpawnBeforeSkipping) { this.spawnCountInCurrentWave = 0; if (CombatDirector.cvDirectorCombatEnableInternalLogs.value) { Debug.LogFormat("Spawn count has hit the max ({0}/{1}). Aborting spawn.", new object[] { this.spawnCountInCurrentWave, this.maximumNumberToSpawnBeforeSkipping }); } return(false); } int cost = this.currentMonsterCard.cost; int num = this.currentMonsterCard.cost; int num2 = this.currentMonsterCard.cost; CombatDirector.EliteTierDef eliteTierDef = this.currentActiveEliteTier; EliteIndex eliteIndex = this.currentActiveEliteIndex; num2 = (int)((float)num * this.currentActiveEliteTier.costMultiplier); if ((float)num2 <= this.monsterCredit) { num = num2; eliteTierDef = this.currentActiveEliteTier; eliteIndex = this.currentActiveEliteIndex; } else { eliteTierDef = CombatDirector.eliteTiers[0]; eliteIndex = EliteIndex.None; } if (!this.currentMonsterCard.CardIsValid()) { if (CombatDirector.cvDirectorCombatEnableInternalLogs.value) { Debug.LogFormat("Spawn card {0} is invalid, aborting spawn.", new object[] { this.currentMonsterCard.spawnCard }); } return(false); } if (this.monsterCredit < (float)num) { if (CombatDirector.cvDirectorCombatEnableInternalLogs.value) { Debug.LogFormat("Spawn card {0} is too expensive, aborting spawn.", new object[] { this.currentMonsterCard.spawnCard }); } return(false); } if (this.skipSpawnIfTooCheap && (float)(num2 * this.maximumNumberToSpawnBeforeSkipping) < this.monsterCredit) { if (CombatDirector.cvDirectorCombatEnableInternalLogs.value) { Debug.LogFormat("Card {0} seems too cheap ({1}/{2}). Comparing against most expensive possible ({3})", new object[] { this.currentMonsterCard.spawnCard, num * this.maximumNumberToSpawnBeforeSkipping, this.monsterCredit, this.mostExpensiveMonsterCostInDeck }); } if (this.mostExpensiveMonsterCostInDeck > num) { if (CombatDirector.cvDirectorCombatEnableInternalLogs.value) { Debug.LogFormat("Spawn card {0} is too cheap, aborting spawn.", new object[] { this.currentMonsterCard.spawnCard }); } return(false); } } SpawnCard spawnCard = this.currentMonsterCard.spawnCard; DirectorPlacementRule directorPlacementRule = new DirectorPlacementRule { placementMode = DirectorPlacementRule.PlacementMode.Approximate, spawnOnTarget = spawnTarget.transform, preventOverhead = this.currentMonsterCard.preventOverhead }; DirectorCore.GetMonsterSpawnDistance(this.currentMonsterCard.spawnDistance, out directorPlacementRule.minDistance, out directorPlacementRule.maxDistance); directorPlacementRule.minDistance *= this.spawnDistanceMultiplier; directorPlacementRule.maxDistance *= this.spawnDistanceMultiplier; DirectorSpawnRequest directorSpawnRequest = new DirectorSpawnRequest(spawnCard, directorPlacementRule, this.rng); directorSpawnRequest.ignoreTeamMemberLimit = true; directorSpawnRequest.teamIndexOverride = new TeamIndex?(TeamIndex.Monster); GameObject gameObject = DirectorCore.instance.TrySpawnObject(directorSpawnRequest); if (!gameObject) { Debug.LogFormat("Spawn card {0} failed to spawn. Aborting cost procedures.", new object[] { spawnCard }); return(false); } this.monsterCredit -= (float)num; this.spawnCountInCurrentWave++; CharacterMaster component = gameObject.GetComponent <CharacterMaster>(); GameObject bodyObject = component.GetBodyObject(); if (this.combatSquad) { this.combatSquad.AddMember(component); } float num3 = eliteTierDef.healthBoostCoefficient; float damageBoostCoefficient = eliteTierDef.damageBoostCoefficient; EliteDef eliteDef = EliteCatalog.GetEliteDef(eliteIndex); EquipmentIndex equipmentIndex = (eliteDef != null) ? eliteDef.eliteEquipmentIndex : EquipmentIndex.None; if (equipmentIndex != EquipmentIndex.None) { component.inventory.SetEquipmentIndex(equipmentIndex); } if (this.combatSquad) { int livingPlayerCount = Run.instance.livingPlayerCount; num3 *= Mathf.Pow((float)livingPlayerCount, 1f); } component.inventory.GiveItem(ItemIndex.BoostHp, Mathf.RoundToInt((num3 - 1f) * 10f)); component.inventory.GiveItem(ItemIndex.BoostDamage, Mathf.RoundToInt((damageBoostCoefficient - 1f) * 10f)); DeathRewards component2 = bodyObject.GetComponent <DeathRewards>(); if (component2) { component2.expReward = (uint)((float)num * this.expRewardCoefficient * Run.instance.compensatedDifficultyCoefficient); component2.goldReward = (uint)((float)num * this.expRewardCoefficient * 2f * Run.instance.compensatedDifficultyCoefficient); } if (this.spawnEffectPrefab && NetworkServer.active) { Vector3 origin = gameObject.transform.position; CharacterBody component3 = bodyObject.GetComponent <CharacterBody>(); if (component3) { origin = component3.corePosition; } EffectManager.SpawnEffect(this.spawnEffectPrefab, new EffectData { origin = origin }, true); } CombatDirector.OnSpawnedServer onSpawnedServer = this.onSpawnedServer; if (onSpawnedServer != null) { onSpawnedServer.Invoke(gameObject); } return(true); }