// Token: 0x06000EB2 RID: 3762 RVA: 0x000693D0 File Offset: 0x000675D0 private void CheckSpawn() { if (Player.m_localPlayer == null) { return; } this.RemoveSeendTempTexts(); Raven.RavenText bestText = this.GetBestText(); if (this.IsSpawned() && this.CanHide() && bestText != null && bestText != this.m_currentText) { this.FlyAway(true); this.m_currentText = null; } if (this.IsAway() && bestText != null) { if (this.EnemyNearby(base.transform.position)) { return; } if (RandEventSystem.InEvent()) { return; } bool forceTeleport = this.m_timeSinceTeleport < 6f; this.Spawn(bestText, forceTeleport); } }
// Token: 0x0600037D RID: 893 RVA: 0x0001E560 File Offset: 0x0001C760 public override bool HuntPlayer() { return(base.HuntPlayer() && (!this.IsEventCreature() || RandEventSystem.InEvent()) && (!this.DespawnInDay() || !EnvMan.instance.IsDay())); }
// Token: 0x0600036D RID: 877 RVA: 0x0001D5F4 File Offset: 0x0001B7F4 protected override void UpdateAI(float dt) { base.UpdateAI(dt); if (!this.m_nview.IsOwner()) { return; } if (this.IsSleeping()) { this.UpdateSleep(dt); return; } this.m_aiStatus = ""; Humanoid humanoid = this.m_character as Humanoid; bool flag; bool flag2; this.UpdateTarget(humanoid, dt, out flag, out flag2); if (this.m_avoidLand && !this.m_character.IsSwiming()) { this.m_aiStatus = "Move to water"; base.MoveToWater(dt, 20f); return; } if (((this.DespawnInDay() && EnvMan.instance.IsDay()) || (this.IsEventCreature() && !RandEventSystem.HaveActiveEvent())) && (this.m_targetCreature == null || !flag2)) { base.MoveAwayAndDespawn(dt, true); this.m_aiStatus = "Trying to despawn "; return; } if (this.m_fleeIfNotAlerted && !this.HuntPlayer() && this.m_targetCreature && !base.IsAlerted() && Vector3.Distance(this.m_targetCreature.transform.position, base.transform.position) - this.m_targetCreature.GetRadius() > this.m_alertRange) { base.Flee(dt, this.m_targetCreature.transform.position); this.m_aiStatus = "Avoiding conflict"; return; } if (this.m_fleeIfLowHealth > 0f && this.m_character.GetHealthPercentage() < this.m_fleeIfLowHealth && this.m_timeSinceHurt < 20f && this.m_targetCreature != null) { base.Flee(dt, this.m_targetCreature.transform.position); this.m_aiStatus = "Low health, flee"; return; } if ((this.m_afraidOfFire || this.m_avoidFire) && base.AvoidFire(dt, this.m_targetCreature, this.m_afraidOfFire)) { if (this.m_afraidOfFire) { this.m_targetStatic = null; this.m_targetCreature = null; } this.m_aiStatus = "Avoiding fire"; return; } if (this.m_circleTargetInterval > 0f && this.m_targetCreature) { if (this.m_targetCreature) { this.m_pauseTimer += dt; if (this.m_pauseTimer > this.m_circleTargetInterval) { if (this.m_pauseTimer > this.m_circleTargetInterval + this.m_circleTargetDuration) { this.m_pauseTimer = 0f; } base.RandomMovementArroundPoint(dt, this.m_targetCreature.transform.position, this.m_circleTargetDistance, base.IsAlerted()); this.m_aiStatus = "Attack pause"; return; } } else { this.m_pauseTimer = 0f; } } if (this.m_targetCreature != null) { if (EffectArea.IsPointInsideArea(this.m_targetCreature.transform.position, EffectArea.Type.NoMonsters, 0f)) { base.Flee(dt, this.m_targetCreature.transform.position); this.m_aiStatus = "Avoid no-monster area"; return; } } else { EffectArea effectArea = EffectArea.IsPointInsideArea(base.transform.position, EffectArea.Type.NoMonsters, 15f); if (effectArea != null) { base.Flee(dt, effectArea.transform.position); this.m_aiStatus = "Avoid no-monster area"; return; } } if (this.m_fleeIfHurtWhenTargetCantBeReached && this.m_targetCreature != null && !this.m_havePathToTarget && this.m_timeSinceHurt < 20f) { this.m_aiStatus = "Hide from unreachable target"; base.Flee(dt, this.m_targetCreature.transform.position); return; } if ((!base.IsAlerted() || (this.m_targetStatic == null && this.m_targetCreature == null)) && this.UpdateConsumeItem(humanoid, dt)) { this.m_aiStatus = "Consume item"; return; } ItemDrop.ItemData itemData = this.SelectBestAttack(humanoid, dt); bool flag3 = itemData != null && Time.time - itemData.m_lastAttackTime > itemData.m_shared.m_aiAttackInterval && Time.time - this.m_lastAttackTime > this.m_minAttackInterval && !base.IsTakingOff(); if ((this.m_character.IsFlying() ? this.m_circulateWhileChargingFlying : this.m_circulateWhileCharging) && (this.m_targetStatic != null || this.m_targetCreature != null) && itemData != null && !flag3 && !this.m_character.InAttack()) { this.m_aiStatus = "Move around target weapon ready:" + flag3.ToString(); if (itemData != null) { this.m_aiStatus = this.m_aiStatus + " Weapon:" + itemData.m_shared.m_name; } Vector3 point = this.m_targetCreature ? this.m_targetCreature.transform.position : this.m_targetStatic.transform.position; base.RandomMovementArroundPoint(dt, point, this.m_randomMoveRange, base.IsAlerted()); return; } if ((!(this.m_targetStatic == null) || !(this.m_targetCreature == null)) && itemData != null) { if (itemData.m_shared.m_aiTargetType == ItemDrop.ItemData.AiTarget.Enemy) { if (this.m_targetStatic) { Vector3 vector = this.m_targetStatic.FindClosestPoint(base.transform.position); if (Vector3.Distance(vector, base.transform.position) >= itemData.m_shared.m_aiAttackRange || !base.CanSeeTarget(this.m_targetStatic)) { this.m_aiStatus = "Move to static target"; base.MoveTo(dt, vector, 0f, base.IsAlerted()); return; } base.LookAt(this.m_targetStatic.GetCenter()); if (base.IsLookingAt(this.m_targetStatic.GetCenter(), itemData.m_shared.m_aiAttackMaxAngle) && flag3) { this.m_aiStatus = "Attacking piece"; this.DoAttack(null, false); return; } base.StopMoving(); return; } else if (this.m_targetCreature) { if (flag || flag2 || (this.HuntPlayer() && this.m_targetCreature.IsPlayer())) { this.m_beenAtLastPos = false; this.m_lastKnownTargetPos = this.m_targetCreature.transform.position; float num = Vector3.Distance(this.m_lastKnownTargetPos, base.transform.position) - this.m_targetCreature.GetRadius(); float num2 = this.m_alertRange * this.m_targetCreature.GetStealthFactor(); if ((flag2 && num < num2) || this.HuntPlayer()) { this.SetAlerted(true); } bool flag4 = num < itemData.m_shared.m_aiAttackRange; if (!flag4 || !flag2 || itemData.m_shared.m_aiAttackRangeMin < 0f || !base.IsAlerted()) { this.m_aiStatus = "Move closer"; Vector3 velocity = this.m_targetCreature.GetVelocity(); Vector3 vector2 = velocity * this.m_interceptTime; Vector3 vector3 = this.m_lastKnownTargetPos; if (num > vector2.magnitude / 4f) { vector3 += velocity * this.m_interceptTime; } if (base.MoveTo(dt, vector3, 0f, base.IsAlerted())) { flag4 = true; } } else { base.StopMoving(); } if (flag4 && flag2 && base.IsAlerted()) { this.m_aiStatus = "In attack range"; base.LookAt(this.m_targetCreature.GetTopPoint()); if (flag3 && base.IsLookingAt(this.m_lastKnownTargetPos, itemData.m_shared.m_aiAttackMaxAngle)) { this.m_aiStatus = "Attacking creature"; this.DoAttack(this.m_targetCreature, false); return; } } } else { this.m_aiStatus = "Searching for target"; if (this.m_beenAtLastPos) { base.RandomMovement(dt, this.m_lastKnownTargetPos); return; } if (base.MoveTo(dt, this.m_lastKnownTargetPos, 0f, base.IsAlerted())) { this.m_beenAtLastPos = true; return; } } } } else if (itemData.m_shared.m_aiTargetType == ItemDrop.ItemData.AiTarget.FriendHurt || itemData.m_shared.m_aiTargetType == ItemDrop.ItemData.AiTarget.Friend) { this.m_aiStatus = "Helping friend"; Character character = (itemData.m_shared.m_aiTargetType == ItemDrop.ItemData.AiTarget.FriendHurt) ? base.HaveHurtFriendInRange(this.m_viewRange) : base.HaveFriendInRange(this.m_viewRange); if (character) { if (Vector3.Distance(character.transform.position, base.transform.position) >= itemData.m_shared.m_aiAttackRange) { base.MoveTo(dt, character.transform.position, 0f, base.IsAlerted()); return; } if (flag3) { base.StopMoving(); base.LookAt(character.transform.position); this.DoAttack(character, true); return; } base.RandomMovement(dt, character.transform.position); return; } else { base.RandomMovement(dt, base.transform.position); } } return; } if (this.m_follow) { base.Follow(this.m_follow, dt); this.m_aiStatus = "Follow"; return; } this.m_aiStatus = string.Concat(new object[] { "Random movement (weapon: ", (itemData != null) ? itemData.m_shared.m_name : "none", ") (targetpiece: ", this.m_targetStatic, ") (target: ", this.m_targetCreature ? this.m_targetCreature.gameObject.name : "none", ")" }); base.IdleMovement(dt); }
public static void PublicSetRandomEvent(RandEventSystem instance, RandomEvent ev, Vector3 pos) { return; }
// Token: 0x06000EA9 RID: 3753 RVA: 0x00068CF0 File Offset: 0x00066EF0 private void Update() { this.m_timeSinceTeleport += Time.deltaTime; if (!this.IsAway() && !this.IsFlying() && Player.m_localPlayer) { Vector3 vector = Player.m_localPlayer.transform.position - base.transform.position; vector.y = 0f; vector.Normalize(); float f = Vector3.SignedAngle(base.transform.forward, vector, Vector3.up); if (Mathf.Abs(f) > this.m_minRotationAngle) { this.m_animator.SetFloat("anglevel", this.m_rotateSpeed * Mathf.Sign(f), 0.4f, Time.deltaTime); base.transform.rotation = Quaternion.RotateTowards(base.transform.rotation, Quaternion.LookRotation(vector), Time.deltaTime * this.m_rotateSpeed); } else { this.m_animator.SetFloat("anglevel", 0f, 0.4f, Time.deltaTime); } } if (this.IsSpawned()) { if (Player.m_localPlayer != null && !Chat.instance.IsDialogVisible(base.gameObject) && Vector3.Distance(Player.m_localPlayer.transform.position, base.transform.position) < this.m_autoTalkDistance) { this.m_randomTextTimer += Time.deltaTime; float num = this.m_hasTalked ? this.m_randomTextInterval : this.m_randomTextIntervalImportant; if (this.m_randomTextTimer >= num) { this.m_randomTextTimer = 0f; if (this.m_hasTalked) { this.Say("", this.m_randomTexts[UnityEngine.Random.Range(0, this.m_randomTexts.Count)], false, false, false); } else { this.Say("", this.m_randomTextsImportant[UnityEngine.Random.Range(0, this.m_randomTextsImportant.Count)], false, false, false); } } } if ((Player.m_localPlayer == null || Vector3.Distance(Player.m_localPlayer.transform.position, base.transform.position) > this.m_despawnDistance || this.EnemyNearby(base.transform.position) || RandEventSystem.InEvent() || this.m_currentText == null || this.m_groundObject == null || this.m_hasTalked) && this.CanHide()) { bool forceTeleport = this.GetBestText() != null || this.m_groundObject == null; this.FlyAway(forceTeleport); this.RestartSpawnCheck(3f); } this.m_exclamation.SetActive(!this.m_hasTalked); return; } this.m_exclamation.SetActive(false); }