// Token: 0x06000DBE RID: 3518 RVA: 0x00043874 File Offset: 0x00041A74 private void Simulate(float deltaTime) { if (this.targetPlayers) { this.playerRetargetTimer -= deltaTime; if (this.playerRetargetTimer <= 0f) { this.playerRetargetTimer = this.rng.RangeFloat(1f, 10f); this.PickPlayerAsSpawnTarget(); } } this.monsterSpawnTimer -= deltaTime; if (this.monsterSpawnTimer <= 0f) { bool flag = false; if (TeamComponent.GetTeamMembers(TeamIndex.Monster).Count < 40 || this.isBoss) { flag = this.AttemptSpawnOnTarget(this.currentSpawnTarget); } if (flag) { if (this.shouldSpawnOneWave) { this.hasStartedWave = true; } this.monsterSpawnTimer += this.rng.RangeFloat(this.minSeriesSpawnInterval, this.maxSeriesSpawnInterval); return; } this.monsterSpawnTimer += this.rng.RangeFloat(this.minRerollSpawnInterval, this.maxRerollSpawnInterval); this.currentMonsterCard = null; if (this.shouldSpawnOneWave && this.hasStartedWave) { base.enabled = false; return; } } }
private void AttemptGrant(CharacterBody body) { if (!NetworkServer.active) { Debug.LogWarning("[Server] function 'System.Void RoR2.GenericPickupController::AttemptGrant(RoR2.CharacterBody)' called on client"); return; } foreach (TeamComponent component in TeamComponent.GetTeamMembers(TeamIndex.Player)) { body = component.GetComponent <CharacterBody>(); if (component && component.teamIndex == TeamIndex.Player) { Inventory inventory = body.inventory; if (inventory) { this.consumed = true; PickupDef pickupDef = PickupCatalog.GetPickupDef(this.pickupIndex); if (pickupDef.itemIndex != ItemIndex.None) { this.GrantItem(body, inventory); } if (pickupDef.equipmentIndex != EquipmentIndex.None) { this.GrantEquipment(body, inventory); } if (pickupDef.artifactIndex != ArtifactIndex.None) { this.GrantArtifact(body, pickupDef.artifactIndex); } if (pickupDef.coinValue != 0U) { this.GrantLunarCoin(body, pickupDef.coinValue); } } } } }
// Token: 0x06000C12 RID: 3090 RVA: 0x0003BE4C File Offset: 0x0003A04C private Transform FindTarget() { TeamIndex teamIndex = TeamIndex.Monster; TeamIndex teamIndex2 = this.teamFilter.teamIndex; if (teamIndex2 != TeamIndex.Player) { if (teamIndex2 == TeamIndex.Monster) { teamIndex = TeamIndex.Player; } } else { teamIndex = TeamIndex.Monster; } ReadOnlyCollection <TeamComponent> teamMembers = TeamComponent.GetTeamMembers(teamIndex); float num = 99999f; Transform result = null; Vector3 position = this.transform.position; for (int i = 0; i < teamMembers.Count; i++) { Transform transform = teamMembers[i].transform; if (!this.pastTargetList.Contains(transform) || (this.canBounceToSameTarget && transform != this.lastTarget)) { float num2 = Vector3.SqrMagnitude(transform.position - position); if (num2 < num && (!this.smartSeeking || !Physics.Raycast(position, transform.position - position, Mathf.Sqrt(num2), LayerIndex.world.mask)) && num2 <= this.maxChainDistance * this.maxChainDistance) { num = num2; result = transform; } } } return(result); }
// Token: 0x06000D1E RID: 3358 RVA: 0x00040DA8 File Offset: 0x0003EFA8 private void UpdateForCamera(CameraRigController cameraRigController) { this.visibility = VisibilityLevel.Visible; bool flag = false; float target = 1f; if (this.body) { if (flag) { target = 0f; } if (this.body.HasBuff(BuffIndex.Cloak)) { TeamIndex teamIndex = TeamIndex.Neutral; TeamComponent component = this.body.GetComponent <TeamComponent>(); if (component) { teamIndex = component.teamIndex; } this.visibility = ((cameraRigController.targetTeamIndex == teamIndex) ? VisibilityLevel.Revealed : VisibilityLevel.Cloaked); } } this.firstPersonFade = Mathf.MoveTowards(this.firstPersonFade, target, Time.deltaTime / 0.25f); this.fade *= this.firstPersonFade; if (this.fade <= 0f || this.invisibilityCount > 0) { this.visibility = VisibilityLevel.Invisible; } this.UpdateOverlays(); if (this.materialsDirty) { this.UpdateMaterials(); this.materialsDirty = false; } }
// Token: 0x06000426 RID: 1062 RVA: 0x00010B54 File Offset: 0x0000ED54 public bool DefaultHitCallback(ref BulletAttack.BulletHit hitInfo) { bool result = false; if (hitInfo.collider) { result = ((1 << hitInfo.collider.gameObject.layer & this.stopperMask) == 0); } if (this.hitEffectPrefab) { EffectManager.SimpleImpactEffect(this.hitEffectPrefab, hitInfo.point, this.HitEffectNormal ? hitInfo.surfaceNormal : (-hitInfo.direction), true); } if (hitInfo.collider) { SurfaceDef objectSurfaceDef = SurfaceDefProvider.GetObjectSurfaceDef(hitInfo.collider, hitInfo.point); if (objectSurfaceDef && objectSurfaceDef.impactEffectPrefab) { EffectData effectData = new EffectData { origin = hitInfo.point, rotation = Quaternion.LookRotation(hitInfo.surfaceNormal), color = objectSurfaceDef.approximateColor, surfaceDefIndex = objectSurfaceDef.surfaceDefIndex }; EffectManager.SpawnEffect(objectSurfaceDef.impactEffectPrefab, effectData, true); } } if (this.isCrit) { EffectManager.SimpleImpactEffect(Resources.Load <GameObject>("Prefabs/Effects/ImpactEffects/Critspark"), hitInfo.point, this.HitEffectNormal ? hitInfo.surfaceNormal : (-hitInfo.direction), true); } GameObject entityObject = hitInfo.entityObject; if (entityObject) { float num = 1f; switch (this.falloffModel) { case BulletAttack.FalloffModel.None: num = 1f; break; case BulletAttack.FalloffModel.DefaultBullet: num = 0.5f + Mathf.Clamp01(Mathf.InverseLerp(60f, 25f, hitInfo.distance)) * 0.5f; break; case BulletAttack.FalloffModel.Buckshot: num = 0.25f + Mathf.Clamp01(Mathf.InverseLerp(25f, 7f, hitInfo.distance)) * 0.75f; break; } DamageInfo damageInfo = new DamageInfo(); damageInfo.damage = this.damage * num; damageInfo.crit = this.isCrit; damageInfo.attacker = this.owner; damageInfo.inflictor = this.weapon; damageInfo.position = hitInfo.point; damageInfo.force = hitInfo.direction * (this.force * num); damageInfo.procChainMask = this.procChainMask; damageInfo.procCoefficient = this.procCoefficient; damageInfo.damageType = this.damageType; damageInfo.damageColorIndex = this.damageColorIndex; damageInfo.ModifyDamageInfo(hitInfo.damageModifier); TeamIndex teamIndex = TeamIndex.Neutral; if (this.owner) { TeamComponent component = this.owner.GetComponent <TeamComponent>(); if (component) { teamIndex = component.teamIndex; } } TeamIndex teamIndex2 = TeamIndex.Neutral; TeamComponent component2 = hitInfo.entityObject.GetComponent <TeamComponent>(); if (component2) { teamIndex2 = component2.teamIndex; } bool flag = teamIndex == teamIndex2; HealthComponent healthComponent = null; if (!flag) { healthComponent = entityObject.GetComponent <HealthComponent>(); } if (NetworkServer.active) { if (healthComponent) { healthComponent.TakeDamage(damageInfo); GlobalEventManager.instance.OnHitEnemy(damageInfo, hitInfo.entityObject); } GlobalEventManager.instance.OnHitAll(damageInfo, hitInfo.entityObject); } else if (ClientScene.ready) { BulletAttack.messageWriter.StartMessage(53); BulletAttack.messageWriter.Write(entityObject); BulletAttack.messageWriter.Write(damageInfo); BulletAttack.messageWriter.Write(healthComponent != null); BulletAttack.messageWriter.FinishMessage(); ClientScene.readyConnection.SendWriter(BulletAttack.messageWriter, QosChannelIndex.defaultReliable.intVal); } } return(result); }
// Token: 0x06001C39 RID: 7225 RVA: 0x00083F04 File Offset: 0x00082104 public static CharacterBody GetEnemyEasyTarget(CharacterBody casterBody, Ray aimRay, float maxDistance, float maxDeviation = 20f) { TeamIndex teamIndex = TeamIndex.Neutral; TeamComponent component = casterBody.GetComponent <TeamComponent>(); if (component) { teamIndex = component.teamIndex; } List <TeamComponent> list = new List <TeamComponent>(); for (TeamIndex teamIndex2 = TeamIndex.Neutral; teamIndex2 < TeamIndex.Count; teamIndex2 += 1) { if (teamIndex2 != teamIndex) { list.AddRange(TeamComponent.GetTeamMembers(teamIndex2)); } } Vector3 origin = aimRay.origin; Vector3 direction = aimRay.direction; List <Util.EasyTargetCandidate> candidatesList = new List <Util.EasyTargetCandidate>(list.Count); List <int> list2 = new List <int>(list.Count); float num = Mathf.Cos(maxDeviation * 0.017453292f); for (int i = 0; i < list.Count; i++) { Transform transform = list[i].transform; Vector3 a2 = transform.position - origin; float magnitude = a2.magnitude; float num2 = Vector3.Dot(a2 * (1f / magnitude), direction); CharacterBody component2 = transform.GetComponent <CharacterBody>(); if (num2 >= num && component2 != casterBody && magnitude < maxDistance) { float num3 = 1f / magnitude; float score = num2 + num3; candidatesList.Add(new Util.EasyTargetCandidate { transform = transform, score = score, distance = magnitude }); list2.Add(list2.Count); } } list2.Sort(delegate(int a, int b) { float score2 = candidatesList[a].score; float score3 = candidatesList[b].score; if (score2 == score3) { return(0); } if (score2 <= score3) { return(1); } return(-1); }); for (int j = 0; j < list2.Count; j++) { int index = list2[j]; CharacterBody component3 = candidatesList[index].transform.GetComponent <CharacterBody>(); if (component3 && component3 != casterBody) { return(component3); } } return(null); }
// Token: 0x06000BF5 RID: 3061 RVA: 0x000357D4 File Offset: 0x000339D4 private void OnTriggerEnter(Collider other) { if (NetworkServer.active && !this.gravitateTarget && this.teamFilter.teamIndex != TeamIndex.None && TeamComponent.GetObjectTeam(other.gameObject) == this.teamFilter.teamIndex) { this.gravitateTarget = other.gameObject.transform; } }
// Token: 0x06001014 RID: 4116 RVA: 0x00050B28 File Offset: 0x0004ED28 public void FixedUpdate() { if (NetworkServer.active) { if (this.body) { this.regenAccumulator += this.body.regen * Time.fixedDeltaTime; } if (this.regenAccumulator > 1f) { float num = Mathf.Floor(this.regenAccumulator); this.regenAccumulator -= num; this.Heal(num, default(ProcChainMask), false); } if (this.alive && this.regenAccumulator < -1f) { float num2 = Mathf.Ceil(this.regenAccumulator); this.regenAccumulator -= num2; this.Networkhealth = this.health + num2; if (this.health <= 0f) { this.Suicide(null); } } bool flag = this.shield == this.body.maxShield; if (this.body.outOfDanger) { this.Networkshield = this.shield + this.body.maxShield * 0.5f * Time.fixedDeltaTime; } this.Networkshield = Mathf.Min(this.shield, this.body.maxShield); if (this.shield == this.body.maxShield && !flag) { Util.PlaySound("Play_item_proc_personal_shield_end", base.gameObject); } if (this.devilOrbHealPool > 0f) { this.devilOrbTimer -= Time.fixedDeltaTime; if (this.devilOrbTimer <= 0f) { this.devilOrbTimer += 0.1f; float scale = 1f; float num3 = this.fullCombinedHealth / 10f; float num4 = 2.5f; this.devilOrbHealPool -= num3; DevilOrb devilOrb = new DevilOrb(); devilOrb.origin = this.body.aimOriginTransform.position; devilOrb.damageValue = num3 * num4; devilOrb.teamIndex = TeamComponent.GetObjectTeam(base.gameObject); devilOrb.attacker = base.gameObject; devilOrb.damageColorIndex = DamageColorIndex.Poison; devilOrb.scale = scale; devilOrb.procChainMask.AddProc(ProcType.HealNova); HurtBox hurtBox = devilOrb.PickNextTarget(devilOrb.origin, 40f); if (hurtBox) { devilOrb.target = hurtBox; devilOrb.isCrit = Util.CheckRoll(this.body.crit, this.body.master); OrbManager.instance.AddOrb(devilOrb); } } } } if (this.combatHealthbarTransform) { this.combatHealthTimer -= Time.fixedDeltaTime; if (this.combatHealthTimer <= 0f || !this.alive || this.body.HasBuff(BuffIndex.Cloak)) { this.combatHealthTimer = 0f; UnityEngine.Object.Destroy(this.combatHealthbarTransform.gameObject); } } if (!this.alive && this.wasAlive) { this.wasAlive = false; base.BroadcastMessage("OnDeath", null, SendMessageOptions.DontRequireReceiver); } }
// Token: 0x06000BF9 RID: 3065 RVA: 0x0003B218 File Offset: 0x00039418 private void UpdateCrosshair(Vector3 raycastStartPlanePoint) { this.lastAimAssist = this.aimAssist; Vector2 zero = Vector2.zero; Ray crosshairRaycastRay = this.GetCrosshairRaycastRay(zero, raycastStartPlanePoint); bool flag = false; this.lastCrosshairHurtBox = null; RaycastHit raycastHit = default(RaycastHit); RaycastHit[] array = Physics.RaycastAll(crosshairRaycastRay, this.maxAimRaycastDistance, LayerIndex.world.mask | LayerIndex.entityPrecise.mask, QueryTriggerInteraction.Ignore); float num = float.PositiveInfinity; int num2 = -1; for (int i = 0; i < array.Length; i++) { RaycastHit raycastHit2 = array[i]; HurtBox component = raycastHit2.collider.GetComponent <HurtBox>(); float distance = raycastHit2.distance; if (distance < num && distance > 3f && (!component || !component.healthComponent || !component.healthComponent.body || component.healthComponent.body.teamComponent.teamIndex != this.targetTeamIndex)) { num = distance; num2 = i; this.lastCrosshairHurtBox = component; } } if (num2 != -1) { flag = true; raycastHit = array[num2]; } this.aimAssist.aimAssistHurtbox = null; if (flag) { this.crosshairWorldPosition = raycastHit.point; float num3 = 1000f; if (raycastHit.distance < num3) { HurtBox component2 = raycastHit.collider.GetComponent <HurtBox>(); if (component2) { HealthComponent healthComponent = component2.healthComponent; if (healthComponent) { TeamComponent component3 = healthComponent.GetComponent <TeamComponent>(); if (component3 && component3.teamIndex != this.targetTeamIndex && component3.teamIndex != TeamIndex.None) { CharacterBody body = healthComponent.body; HurtBox hurtBox = (body != null) ? body.mainHurtBox : null; if (hurtBox) { this.aimAssist.aimAssistHurtbox = hurtBox; this.aimAssist.worldPosition = raycastHit.point; this.aimAssist.localPositionOnHurtbox = hurtBox.transform.InverseTransformPoint(raycastHit.point); return; } } } } } } else { this.crosshairWorldPosition = crosshairRaycastRay.GetPoint(this.maxAimRaycastDistance); } }
private void AddDot(GameObject attackerObject, float duration, DotController.DotIndex dotIndex, float damageMultiplier) { if (!NetworkServer.active) { Debug.LogWarning("[Server] function 'System.Void RoR2.DotController::AddDot(UnityEngine.GameObject,System.Single,RoR2.DotController/DotIndex,System.Single)' called on client"); return; } if (dotIndex < DotController.DotIndex.Bleed || dotIndex >= DotController.DotIndex.Count) { return; } TeamIndex teamIndex = TeamIndex.Neutral; float num = 0f; TeamComponent component = attackerObject.GetComponent <TeamComponent>(); if (component) { teamIndex = component.teamIndex; } CharacterBody component2 = attackerObject.GetComponent <CharacterBody>(); if (component2) { num = component2.damage; } DotController.DotDef dotDef = DotController.dotDefs[(int)dotIndex]; DotController.DotStack dotStack = new DotController.DotStack { dotIndex = dotIndex, dotDef = dotDef, attackerObject = attackerObject, attackerTeam = teamIndex, timer = duration, damage = dotDef.damageCoefficient * num * damageMultiplier, damageType = DamageType.Generic }; if (dotIndex == DotController.DotIndex.Helfire) { if (!component2) { return; } HealthComponent healthComponent = component2.healthComponent; if (!healthComponent) { return; } dotStack.damage = healthComponent.fullHealth * 0.01f * damageMultiplier; if (this.victimObject == attackerObject) { dotStack.damageType |= (DamageType.NonLethal | DamageType.Silent); } else if (this.victimTeam == teamIndex) { dotStack.damage *= 0.5f; } else { dotStack.damage *= 24f; } int i = 0; int count = this.dotStackList.Count; while (i < count) { if (this.dotStackList[i].dotIndex == DotController.DotIndex.Helfire && this.dotStackList[i].attackerObject == attackerObject) { this.dotStackList[i].timer = Mathf.Max(this.dotStackList[i].timer, duration); this.dotStackList[i].damage = dotStack.damage; return; } i++; } if (this.victimBody) { EffectManager.instance.SpawnEffect(Resources.Load <GameObject>("Prefabs/Effects/HelfireIgniteEffect"), new EffectData { origin = this.victimBody.corePosition }, true); } } this.dotStackList.Add(dotStack); }
public void EndRound() { if (!NetworkServer.active) { Debug.LogWarning("[Server] function 'System.Void RoR2.ArenaMissionController::EndRound()' called on client"); return; } int clearedRounds = this.clearedRounds; this.clearedRounds = clearedRounds + 1; if (this.currentRound < this.totalRoundsMax) { this.ReadyNextNullWard(); } else { Action action = ArenaMissionController.onBeatArena; if (action != null) { action(); } this.mainStateMachine.SetNextState(new ArenaMissionController.MissionCompleted()); Chat.SendBroadcastChat(new Chat.SimpleChatMessage { baseToken = "ARENA_END" }); } for (int i = 0; i < this.combatDirectors.Length; i++) { CombatDirector combatDirector = this.combatDirectors[i]; combatDirector.enabled = false; combatDirector.monsterCredit = 0f; } ReadOnlyCollection <TeamComponent> teamMembers = TeamComponent.GetTeamMembers(TeamIndex.Monster); for (int j = teamMembers.Count - 1; j >= 0; j--) { teamMembers[j].body.healthComponent.Suicide(base.gameObject, base.gameObject, DamageType.VoidDeath); } int participatingPlayerCount = Run.instance.participatingPlayerCount; if (participatingPlayerCount != 0 && this.rewardSpawnPosition) { List <PickupIndex> list = Run.instance.availableTier1DropList; if (this.currentRound > 4) { list = Run.instance.availableTier2DropList; } if (this.currentRound == this.totalRoundsMax) { list = Run.instance.availableTier3DropList; } ItemIndex itemIndex = this.rng.NextElementUniform <PickupIndex>(list).itemIndex; int num = participatingPlayerCount; float angle = 360f / (float)num; Vector3 vector = Quaternion.AngleAxis((float)UnityEngine.Random.Range(0, 360), Vector3.up) * (Vector3.up * 40f + Vector3.forward * 5f); Quaternion rotation = Quaternion.AngleAxis(angle, Vector3.up); int k = 0; while (k < num) { PickupDropletController.CreatePickupDroplet(new PickupIndex(itemIndex), this.rewardSpawnPosition.transform.position, vector); k++; vector = rotation * vector; } } }
// Token: 0x060011BD RID: 4541 RVA: 0x00057D31 File Offset: 0x00055F31 private int CountEnemies() { return(TeamComponent.GetTeamMembers(TeamIndex.Monster).Count); }
// Token: 0x060010A6 RID: 4262 RVA: 0x00052F28 File Offset: 0x00051128 private void FixedUpdate() { if (this.cachedOwnerInfo.gameObject != this.owner) { this.cachedOwnerInfo = new IcicleAuraController.OwnerInfo(this.owner); } this.UpdateRadius(); this.UpdatePosition(); if (NetworkServer.active) { if (!this.owner) { UnityEngine.Object.Destroy(base.gameObject); return; } for (int i = this.icicleLifetimes.Count - 1; i >= 0; i--) { List <float> list = this.icicleLifetimes; int index = i; list[index] -= Time.fixedDeltaTime; if (this.icicleLifetimes[i] <= 0f) { this.icicleLifetimes.RemoveAt(i); } } this.NetworkfinalIcicleCount = Mathf.Min((this.icicleLifetimes.Count > 0) ? (2 + this.icicleLifetimes.Count) : 0, 5); this.attackStopwatch += Time.fixedDeltaTime; } if (this.cachedOwnerInfo.characterBody) { if (this.finalIcicleCount > 0) { if (this.lastIcicleCount == 0) { this.OnIciclesActivated(); } if (this.lastIcicleCount < this.finalIcicleCount) { this.OnIcicleGained(); } } else if (this.lastIcicleCount > 0) { this.OnIciclesDeactivated(); } this.lastIcicleCount = this.finalIcicleCount; } if (NetworkServer.active && this.cachedOwnerInfo.characterBody && this.finalIcicleCount > 0) { float num = 0f; if (this.cachedOwnerInfo.characterBody.inventory) { num = 0.5f + 0.5f * (float)this.cachedOwnerInfo.characterBody.inventory.GetItemCount(ItemIndex.Icicle); } if (this.attackStopwatch >= 0.25f) { this.attackStopwatch = 0f; BlastAttack blastAttack = new BlastAttack(); blastAttack.attacker = this.owner; blastAttack.inflictor = base.gameObject; blastAttack.teamIndex = TeamComponent.GetObjectTeam(blastAttack.attacker); blastAttack.position = this.transform.position; blastAttack.procCoefficient = 0.05f; blastAttack.radius = this.actualRadius; blastAttack.baseForce = 0f; blastAttack.baseDamage = num * 0.25f * this.cachedOwnerInfo.characterBody.damage * (float)this.finalIcicleCount; blastAttack.bonusForce = Vector3.zero; blastAttack.crit = false; blastAttack.damageType = DamageType.Generic; blastAttack.falloffModel = BlastAttack.FalloffModel.None; blastAttack.damageColorIndex = DamageColorIndex.Item; blastAttack.Fire(); } } }
// Token: 0x0600162E RID: 5678 RVA: 0x0006A288 File Offset: 0x00068488 private void SetupIndicator() { if (this.indicator) { return; } CharacterBody component = base.GetComponent <CharacterBody>(); if (component) { TeamComponent component2 = component.GetComponent <TeamComponent>(); if (component2) { CharacterMaster master = component.master; bool flag = master && master.isBoss; GameObject gameObject = null; if (master && component2.teamIndex == TeamIndex.Player) { bool flag2 = false; PlayerCharacterMasterController component3 = master.GetComponent <PlayerCharacterMasterController>(); if (component3) { flag2 = true; GameObject networkUserObject = component3.networkUserObject; if (networkUserObject) { NetworkIdentity component4 = networkUserObject.GetComponent <NetworkIdentity>(); if (component4) { bool isLocalPlayer = component4.isLocalPlayer; } } } Vector3 position = component.transform.position; component.GetComponent <Collider>(); if (flag2) { gameObject = Resources.Load <GameObject>("Prefabs/PositionIndicators/PlayerPositionIndicator"); } else { gameObject = Resources.Load <GameObject>("Prefabs/PositionIndicators/NPCPositionIndicator"); } this.indicator = UnityEngine.Object.Instantiate <GameObject>(gameObject, position, Quaternion.identity, component.transform); } else if (flag) { gameObject = Resources.Load <GameObject>("Prefabs/PositionIndicators/BossPositionIndicator"); } if (this.indicator) { UnityEngine.Object.Destroy(this.indicator); this.indicator = null; } if (gameObject) { this.indicator = UnityEngine.Object.Instantiate <GameObject>(gameObject, base.transform); this.indicator.GetComponent <PositionIndicator>().targetTransform = component.coreTransform; Nameplate component5 = this.indicator.GetComponent <Nameplate>(); if (component5) { component5.SetBody(component); } } } } }
// Token: 0x06001678 RID: 5752 RVA: 0x00057D31 File Offset: 0x00055F31 private int GetMonsterCount() { return(TeamComponent.GetTeamMembers(TeamIndex.Monster).Count); }
// Token: 0x06000BF4 RID: 3060 RVA: 0x0003A450 File Offset: 0x00038650 private void Update() { if (Time.deltaTime == 0f) { return; } if (this.target != this.previousTarget) { this.previousTarget = this.target; Action <CameraRigController, GameObject> action = CameraRigController.onCameraTargetChanged; if (action != null) { action(this, this.target); } } this.lerpCameraTime += Time.deltaTime * this.lerpCameraTimeScale; this.firstPersonTarget = null; float num = this.baseFov; this.sceneCam.rect = this.viewport; Player player = null; UserProfile userProfile = null; bool flag = false; if (this.viewer && this.viewer.localUser != null) { player = this.viewer.localUser.inputPlayer; userProfile = this.viewer.localUser.userProfile; flag = this.viewer.localUser.isUIFocused; } if (this.cameraMode == CameraRigController.CameraMode.SpectateUser && player != null) { if (player.GetButtonDown("PrimarySkill")) { this.target = CameraRigController.GetNextSpectateGameObject(this.viewer, this.target); } if (player.GetButtonDown("SecondarySkill")) { this.target = CameraRigController.GetPreviousSpectateGameObject(this.viewer, this.target); } } LocalUser localUserViewer = this.localUserViewer; MPEventSystem mpeventSystem = (localUserViewer != null) ? localUserViewer.eventSystem : null; float num14; float num15; if ((!mpeventSystem || !mpeventSystem.isCursorVisible) && player != null && userProfile != null && !flag && this.overrideCam == null) { float mouseLookSensitivity = userProfile.mouseLookSensitivity; float num2 = userProfile.stickLookSensitivity * CameraRigController.aimStickGlobalScale.value * 45f; Vector2 vector = new Vector2(player.GetAxisRaw(2), player.GetAxisRaw(3)); Vector2 vector2 = new Vector2(player.GetAxisRaw(16), player.GetAxisRaw(17)); CameraRigController.< Update > g__ConditionalNegate | 69_0 (ref vector.x, userProfile.mouseLookInvertX); CameraRigController.< Update > g__ConditionalNegate | 69_0 (ref vector.y, userProfile.mouseLookInvertY); CameraRigController.< Update > g__ConditionalNegate | 69_0 (ref vector2.x, userProfile.stickLookInvertX); CameraRigController.< Update > g__ConditionalNegate | 69_0 (ref vector2.y, userProfile.stickLookInvertY); float magnitude = vector2.magnitude; float num3 = magnitude; this.aimStickPostSmoothing = Vector2.zero; this.aimStickPostDualZone = Vector2.zero; this.aimStickPostExponent = Vector2.zero; if (CameraRigController.aimStickDualZoneSmoothing.value != 0f) { float maxDelta = Time.deltaTime / CameraRigController.aimStickDualZoneSmoothing.value; num3 = Mathf.Min(Mathf.MoveTowards(this.stickAimPreviousAcceleratedMagnitude, magnitude, maxDelta), magnitude); this.stickAimPreviousAcceleratedMagnitude = num3; this.aimStickPostSmoothing = ((magnitude != 0f) ? (vector2 * (num3 / magnitude)) : Vector2.zero); } float num4 = num3; float value = CameraRigController.aimStickDualZoneSlope.value; float num5; if (num4 <= CameraRigController.aimStickDualZoneThreshold.value) { num5 = 0f; } else { num5 = 1f - value; } num3 = value * num4 + num5; this.aimStickPostDualZone = ((magnitude != 0f) ? (vector2 * (num3 / magnitude)) : Vector2.zero); num3 = Mathf.Pow(num3, CameraRigController.aimStickExponent.value); this.aimStickPostExponent = ((magnitude != 0f) ? (vector2 * (num3 / magnitude)) : Vector2.zero); if (magnitude != 0f) { vector2 *= num3 / magnitude; } if (this.cameraMode == CameraRigController.CameraMode.PlayerBasic && this.targetBody && !this.targetBody.isSprinting) { AimAssistTarget exists = null; AimAssistTarget exists2 = null; float value2 = CameraRigController.aimStickAssistMinSize.value; float num6 = value2 * CameraRigController.aimStickAssistMaxSize.value; float value3 = CameraRigController.aimStickAssistMaxSlowdownScale.value; float value4 = CameraRigController.aimStickAssistMinSlowdownScale.value; float num7 = 0f; float value5 = 0f; float num8 = 0f; Vector2 v = Vector2.zero; Vector2 zero = Vector2.zero; Vector2 normalized = vector2.normalized; Vector2 vector3 = new Vector2(0.5f, 0.5f); for (int i = 0; i < AimAssistTarget.instancesList.Count; i++) { AimAssistTarget aimAssistTarget = AimAssistTarget.instancesList[i]; if (aimAssistTarget.teamComponent.teamIndex != this.targetTeamIndex) { Vector3 vector4 = this.sceneCam.WorldToViewportPoint(aimAssistTarget.point0.position); Vector3 vector5 = this.sceneCam.WorldToViewportPoint(aimAssistTarget.point1.position); float num9 = Mathf.Lerp(vector4.z, vector5.z, 0.5f); if (num9 > 3f) { float num10 = 1f / num9; Vector2 vector6 = Util.ClosestPointOnLine(vector4, vector5, vector3) - vector3; float num11 = Mathf.Clamp01(Util.Remap(vector6.magnitude, value2 * aimAssistTarget.assistScale * num10, num6 * aimAssistTarget.assistScale * num10, 1f, 0f)); float num12 = Mathf.Clamp01(Vector3.Dot(vector6, vector2.normalized)); float num13 = num12 * num11; if (num7 < num11) { num7 = num11; exists2 = aimAssistTarget; } if (num13 > num8) { num7 = num11; value5 = num12; exists = aimAssistTarget; v = vector6; } } } } Vector2 vector7 = vector2; if (exists2) { float magnitude2 = vector2.magnitude; float d = Mathf.Clamp01(Util.Remap(1f - num7, 0f, 1f, value3, value4)); vector7 *= d; } if (exists) { vector7 = Vector3.RotateTowards(vector7, v, Util.Remap(value5, 1f, 0f, CameraRigController.aimStickAssistMaxDelta.value, CameraRigController.aimStickAssistMinDelta.value), 0f); } vector2 = vector7; } num14 = vector.x * mouseLookSensitivity * userProfile.mouseLookScaleX + vector2.x * num2 * userProfile.stickLookScaleX * Time.deltaTime; num15 = vector.y * mouseLookSensitivity * userProfile.mouseLookScaleY + vector2.y * num2 * userProfile.stickLookScaleY * Time.deltaTime; } else { num14 = 0f; num15 = 0f; } NetworkUser networkUser = Util.LookUpBodyNetworkUser(this.target); NetworkedViewAngles networkedViewAngles = null; if (networkUser) { networkedViewAngles = networkUser.GetComponent <NetworkedViewAngles>(); } this.targetTeamIndex = TeamIndex.None; bool flag2 = false; if (this.target) { this.targetBody = this.target.GetComponent <CharacterBody>(); flag2 = this.targetBody.isSprinting; TeamComponent component = this.target.GetComponent <TeamComponent>(); if (component) { this.targetTeamIndex = component.teamIndex; } this.targetParams = this.target.GetComponent <CameraTargetParams>(); } Vector3 vector8 = this.desiredCameraState.position; if (this.targetParams) { Vector3 position = this.target.transform.position; Vector3 cameraPivotPosition = this.targetParams.cameraPivotPosition; if (this.targetParams.dontRaycastToPivot) { vector8 = cameraPivotPosition; } else { Vector3 direction = cameraPivotPosition - position; Ray ray = new Ray(position, direction); float distance = this.Raycast(ray, direction.magnitude, this.targetParams.cameraParams.wallCushion); vector8 = ray.GetPoint(distance); } } if (this.cameraMode == CameraRigController.CameraMode.PlayerBasic || this.cameraMode == CameraRigController.CameraMode.SpectateUser) { float min = -89.9f; float max = 89.9f; Vector3 idealLocalCameraPos = new Vector3(0f, 0f, 0f); float wallCushion = 0.1f; Vector2 vector9 = Vector2.zero; if (this.targetParams) { min = this.targetParams.cameraParams.minPitch; max = this.targetParams.cameraParams.maxPitch; idealLocalCameraPos = this.targetParams.idealLocalCameraPos; wallCushion = this.targetParams.cameraParams.wallCushion; vector9 = this.targetParams.recoil; if (this.targetParams.aimMode == CameraTargetParams.AimType.FirstPerson) { this.firstPersonTarget = this.target; } if (this.targetParams.fovOverride >= 0f) { num = this.targetParams.fovOverride; num14 *= num / this.baseFov; num15 *= num / this.baseFov; } if (this.targetBody && flag2) { num14 *= 0.5f; num15 *= 0.5f; } } if (this.sprintingParticleSystem) { ParticleSystem.MainModule main = this.sprintingParticleSystem.main; if (flag2) { main.loop = true; if (!this.sprintingParticleSystem.isPlaying) { this.sprintingParticleSystem.Play(); } } else { main.loop = false; } } if (this.cameraMode == CameraRigController.CameraMode.PlayerBasic) { float num16 = this.pitch - num15; float num17 = this.yaw + num14; num16 += vector9.y; num17 += vector9.x; this.pitch = Mathf.Clamp(num16, min, max); this.yaw = Mathf.Repeat(num17, 360f); } else if (this.cameraMode == CameraRigController.CameraMode.SpectateUser && this.target) { if (networkedViewAngles) { this.SetPitchYaw(networkedViewAngles.viewAngles); } else { InputBankTest component2 = this.target.GetComponent <InputBankTest>(); if (component2) { this.SetPitchYawFromLookVector(component2.aimDirection); } } } this.desiredCameraState.rotation = Quaternion.Euler(this.pitch, this.yaw, 0f); Vector3 direction2 = vector8 + this.desiredCameraState.rotation * idealLocalCameraPos - vector8; float num18 = direction2.magnitude; float num19 = (1f + this.pitch / -90f) * 0.5f; num18 *= Mathf.Sqrt(1f - num19); if (num18 < 0.25f) { num18 = 0.25f; } float a = this.Raycast(new Ray(vector8, direction2), num18, wallCushion); this.currentCameraDistance = Mathf.Min(a, Mathf.SmoothDamp(this.currentCameraDistance, a, ref this.cameraDistanceVelocity, 0.5f)); this.desiredCameraState.position = vector8 + direction2.normalized * this.currentCameraDistance; this.pitch -= vector9.y; this.yaw -= vector9.x; if (networkedViewAngles && networkedViewAngles.hasEffectiveAuthority) { networkedViewAngles.viewAngles = new PitchYawPair(this.pitch, this.yaw); } } if (this.targetBody) { num *= (this.targetBody.isSprinting ? 1.3f : 1f); } this.desiredCameraState.fov = Mathf.SmoothDamp(this.desiredCameraState.fov, num, ref this.fovVelocity, 0.2f, float.PositiveInfinity, Time.deltaTime); if (this.hud) { CharacterMaster targetMaster = this.targetBody ? this.targetBody.master : null; this.hud.targetMaster = targetMaster; } this.UpdateCrosshair(vector8); CameraState cameraState = this.desiredCameraState; if (this.overrideCam != null) { if ((UnityEngine.Object) this.overrideCam) { cameraState = this.overrideCam.GetCameraState(this); } this.overrideCam = null; } if (this.lerpCameraTime >= 1f) { this.currentCameraState = cameraState; } else { this.currentCameraState = CameraState.Lerp(ref this.lerpCameraState, ref cameraState, CameraRigController.RemapLerpTime(this.lerpCameraTime)); } this.SetCameraState(this.currentCameraState); }
private void AddDot(GameObject attackerObject, float duration, DotController.DotIndex dotIndex, float damageMultiplier) { if (!NetworkServer.active) { Debug.LogWarning("[Server] function 'System.Void RoR2.DotController::AddDot(UnityEngine.GameObject,System.Single,RoR2.DotController/DotIndex,System.Single)' called on client"); return; } if (dotIndex < DotController.DotIndex.Bleed || dotIndex >= DotController.DotIndex.Count) { return; } TeamIndex teamIndex = TeamIndex.Neutral; float num = 0f; TeamComponent component = attackerObject.GetComponent <TeamComponent>(); if (component) { teamIndex = component.teamIndex; } CharacterBody component2 = attackerObject.GetComponent <CharacterBody>(); if (component2) { num = component2.damage; } DotController.DotDef dotDef = DotController.dotDefs[(int)dotIndex]; DotController.DotStack dotStack = new DotController.DotStack { dotIndex = dotIndex, dotDef = dotDef, attackerObject = attackerObject, attackerTeam = teamIndex, timer = duration, damage = dotDef.damageCoefficient * num * damageMultiplier, damageType = DamageType.Generic }; switch (dotIndex) { case DotController.DotIndex.Helfire: { if (!component2) { return; } HealthComponent healthComponent = component2.healthComponent; if (!healthComponent) { return; } dotStack.damage = healthComponent.fullHealth * 0.01f * damageMultiplier; if (this.victimObject == attackerObject) { dotStack.damageType |= (DamageType.NonLethal | DamageType.Silent); } else if (this.victimTeam == teamIndex) { dotStack.damage *= 0.5f; } else { dotStack.damage *= 24f; } int i = 0; int count = this.dotStackList.Count; while (i < count) { if (this.dotStackList[i].dotIndex == DotController.DotIndex.Helfire && this.dotStackList[i].attackerObject == attackerObject) { this.dotStackList[i].timer = Mathf.Max(this.dotStackList[i].timer, duration); this.dotStackList[i].damage = dotStack.damage; return; } i++; } if (this.victimBody) { EffectManager.SpawnEffect(Resources.Load <GameObject>("Prefabs/Effects/HelfireIgniteEffect"), new EffectData { origin = this.victimBody.corePosition }, true); } break; } case DotController.DotIndex.PercentBurn: dotStack.damage = Mathf.Min(dotStack.damage, this.victimBody.healthComponent.fullCombinedHealth * 0.01f); break; case DotController.DotIndex.Poison: { float a = this.victimHealthComponent.fullCombinedHealth / 100f * 1f * dotDef.interval; dotStack.damage = Mathf.Min(Mathf.Max(a, dotStack.damage), dotStack.damage * 50f); dotStack.damageType = DamageType.NonLethal; int j = 0; int count2 = this.dotStackList.Count; while (j < count2) { if (this.dotStackList[j].dotIndex == DotController.DotIndex.Poison) { this.dotStackList[j].timer = Mathf.Max(this.dotStackList[j].timer, duration); this.dotStackList[j].damage = dotStack.damage; return; } j++; } bool flag = false; for (int k = 0; k < this.dotStackList.Count; k++) { if (this.dotStackList[k].dotIndex == DotController.DotIndex.Poison) { flag = true; break; } } if (!flag && component2 != null) { CharacterMaster master = component2.master; if (master != null) { PlayerStatsComponent playerStatsComponent = master.playerStatsComponent; if (playerStatsComponent != null) { playerStatsComponent.currentStats.PushStatValue(StatDef.totalCrocoInfectionsInflicted, 1UL); } } } break; } } this.dotStackList.Add(dotStack); this.OnDotStackAddedServer(dotStack); }
// Token: 0x060017BB RID: 6075 RVA: 0x00066F64 File Offset: 0x00065164 public CharacterMaster Perform() { TeamIndex teamIndex; if (this.teamIndexOverride != null) { teamIndex = this.teamIndexOverride.Value; } else { if (!this.summonerBodyObject) { Debug.LogErrorFormat("Cannot spawn master {0}: No team specified.", new object[] { this.masterPrefab }); return(null); } teamIndex = TeamComponent.GetObjectTeam(this.summonerBodyObject); } if (!this.ignoreTeamMemberLimit) { TeamDef teamDef = TeamCatalog.GetTeamDef(teamIndex); if (teamDef == null) { Debug.LogErrorFormat("Attempting to spawn master {0} on TeamIndex.None. Is this intentional?", new object[] { this.masterPrefab }); return(null); } if (teamDef != null && teamDef.softCharacterLimit <= TeamComponent.GetTeamMembers(teamIndex).Count) { return(null); } } CharacterBody characterBody = null; CharacterMaster characterMaster = null; if (this.summonerBodyObject) { characterBody = this.summonerBodyObject.GetComponent <CharacterBody>(); } if (characterBody) { characterMaster = characterBody.master; } GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.masterPrefab, this.position, this.rotation); CharacterMaster component = gameObject.GetComponent <CharacterMaster>(); component.teamIndex = teamIndex; if (this.loadout != null) { component.SetLoadoutServer(this.loadout); } CharacterMaster characterMaster2 = characterMaster; if (characterMaster2 && characterMaster2.minionOwnership.ownerMaster) { characterMaster2 = characterMaster2.minionOwnership.ownerMaster; } component.minionOwnership.SetOwner(characterMaster2); if (this.summonerBodyObject) { AIOwnership component2 = gameObject.GetComponent <AIOwnership>(); if (component2) { if (characterMaster) { component2.ownerMaster = characterMaster; } CharacterBody component3 = this.summonerBodyObject.GetComponent <CharacterBody>(); if (component3) { CharacterMaster master = component3.master; if (master) { component2.ownerMaster = master; } } } BaseAI component4 = gameObject.GetComponent <BaseAI>(); if (component4) { component4.leader.gameObject = this.summonerBodyObject; } } Action <CharacterMaster> action = this.preSpawnSetupCallback; if (action != null) { action(component); } NetworkServer.Spawn(gameObject); component.Respawn(this.position, this.rotation, false); return(component); }