public override TaskStatus OnUpdate() { if (((Singleton <MainUIManager> .Instance != null) && (Singleton <MainUIManager> .Instance.GetInLevelUICanvas() != null)) && (Singleton <MainUIManager> .Instance.GetInLevelUICanvas().hintArrowManager != null)) { MonoSpawnPoint spawnPoint = Singleton <MainUIManager> .Instance.GetInLevelUICanvas().hintArrowManager.GetSpawnPoint(); this.SpawnPoint.SetValue((spawnPoint == null) ? null : spawnPoint.name); } return(TaskStatus.Success); }
private Vector3 GetTargetPosition(bool useRandom = true) { this._spawnPointIndex = -1; this._targetRuntimeID = 0; this._useRandomSpawnPoint = false; MonoSpawnPoint hintSpawnPoint = this.GetHintSpawnPoint(); if (hintSpawnPoint != null) { return(hintSpawnPoint.transform.position); } BaseActor[] actorByCategory = Singleton <EventManager> .Instance.GetActorByCategory <BaseActor>(6); for (int i = 0; i < actorByCategory.Length; i++) { if ((actorByCategory[i].IsActive() && (actorByCategory[i] is StageExitFieldActor)) && ((actorByCategory[i].runtimeID != this._lastTargetRuntimeID) && !this._passedRuntimeIDs.Contains(actorByCategory[i].runtimeID))) { this._targetRuntimeID = actorByCategory[i].runtimeID; return(actorByCategory[i].gameObject.transform.position); } } List <BaseMonoDynamicObject> allNavigationArrows = Singleton <DynamicObjectManager> .Instance.GetAllNavigationArrows(); for (int j = 0; j < allNavigationArrows.Count; j++) { if ((allNavigationArrows[j].IsActive() && (allNavigationArrows[j].GetRuntimeID() != this._lastTargetRuntimeID)) && !this._passedRuntimeIDs.Contains(allNavigationArrows[j].GetRuntimeID())) { RaycastHit hit; Vector3 vector = allNavigationArrows[j].XZPosition - ((Vector3)(allNavigationArrows[j].transform.forward * 100f)); if (Physics.Raycast(allNavigationArrows[j].XZPosition + ((Vector3)(0.5f * Vector3.up)), -allNavigationArrows[j].transform.forward, out hit, 100f, (((int)1) << InLevelData.OBSTACLE_COLLIDER_LAYER) | (((int)1) << InLevelData.STAGE_COLLIDER_LAYER))) { vector = allNavigationArrows[j].XZPosition - ((Vector3)(allNavigationArrows[j].transform.forward * hit.distance)); } this._targetRuntimeID = allNavigationArrows[j].GetRuntimeID(); return(vector); } } if (useRandom) { int num3 = 0; do { this._spawnPointIndex = UnityEngine.Random.Range(0, this._stageEnv.spawnPoints.Length); }while (((num3++ < 10) && (this._stageEnv.spawnPoints.Length > 1)) && this._passedSpawnPoints.Contains(this._spawnPointIndex)); if (this._stageEnv.spawnPoints[this._spawnPointIndex] != null) { this._useRandomSpawnPoint = true; return(this._stageEnv.spawnPoints[this._spawnPointIndex].transform.position); } } return(base._aiEntity.transform.position); }
private MonoSpawnPoint GetHintSpawnPoint() { MonoSpawnPoint spawnPoint = Singleton <MainUIManager> .Instance.GetInLevelUICanvas().hintArrowManager.GetSpawnPoint(); if (spawnPoint != null) { this._spawnPointIndex = this._stageEnv.GetNamedSpawnPointIx(spawnPoint.name); if (((this._spawnPointIndex >= 0) && (this._spawnPointIndex != this._lastSpawnPointIndex)) && !this._passedSpawnPoints.Contains(this._spawnPointIndex)) { return(spawnPoint); } } return(null); }
public void AddHintArrowForPath(MonoSpawnPoint spawn) { if (this._hintArrowForPath != null) { this.RemoveHintArrowForPath(); } string path = "UI/HintArrowAlt/HintArrowExitAlt"; MonoHintArrow component = UnityEngine.Object.Instantiate <GameObject>(Miscs.LoadResource <GameObject>(path, BundleType.RESOURCE_FILE)).GetComponent <MonoHintArrow>(); component.Init(0, null); component.transform.SetParent(this._hintRing.transform, false); this._pathSpawn = spawn; this._hintArrowForPath = component; this._hintArrowForPath.SetVisible(true); this.UpdateHintArrow(component.transform, spawn.XZPosition, false); }