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)); } }
static int GetBossMonsterProtoID(Vector3 pos, float rndVal, ref float fScale) { int pathID = 0, typeID = 0; typeID = (int)AiUtil.GetPointType(pos); int mapID = AiUtil.GetMapID(pos); int areaID = AiUtil.GetAreaID(pos); pathID = AISpawnDataAdvSingle.GetBossPathIDScale(mapID, areaID, typeID, rndVal, ref fScale); return(pathID); }
static int GetMonsterProtoID(Vector3 pos, ref float fScale) { int pathID = 0, typeID = 0; typeID = (int)AiUtil.GetPointType(pos); if (PeGameMgr.IsStory) { int mapid = PeMappingMgr.Instance.GetAiSpawnMapId(new Vector2(pos.x, pos.z)); pathID = AISpeciesData.GetRandomAI(AISpawnDataStory.GetAiSpawnData(mapid, typeID)); } else if (PeGameMgr.IsAdventure) { int mapID = AiUtil.GetMapID(pos); int areaID = AiUtil.GetAreaID(pos); pathID = AISpawnDataAdvSingle.GetPathIDScale(mapID, areaID, typeID, ref fScale); } return(pathID); }
//0 - 5 kilometer : 1; //5 - 10 kilometer : 2; //10 - 15 kilometer : 3; //15 - 20 kilometer : 4; int GetAreaID() { return(AiUtil.GetAreaID(transform.position)); }