IEnumerator Spawn(PlayerSleepData data) { while (true) { if (IsPlayerSleeping(data)) { Vector3 position = Vector3.zero; //GetSpawnPosition( //PlayerFactory.mMainPlayer.transform.position, //data.minRadius, //data.maxRadius); Quaternion rot = Quaternion.identity; //Quaternion.LookRotation(PlayerFactory.mMainPlayer.transform.position - position, Vector3.up); int pathID = 0; int typeID = (int)AiUtil.GetPointType(position); if (Application.loadedLevelName.Equals(GameConfig.MainSceneName)) { pathID = AISpawnDataStory.GetRandomPathIDFromType(typeID, position); } else if (Application.loadedLevelName.Equals(GameConfig.AdventureSceneName)) { int mapID = AiUtil.GetMapID(position); int areaID = AiUtil.GetAreaID(position); pathID = AISpawnDataAdvSingle.GetPathID(mapID, areaID, typeID); } AIResource.Instantiate(pathID, position, rot, OnSleepSpawned); } yield return(new WaitForSeconds(data.interval)); } }
int GetPathIDStory() { return(AISpawnDataStory.GetRandomPathIDFromType(typeID, position)); }