Пример #1
0
    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);
    }
Пример #4
0
 int GetPathIDAdventure()
 {
     if (mNoise == null)
     {
         return(AISpawnDataAdvSingle.GetPathID(GetMapID(), GetAreaID(), typeID));
     }
     else
     {
         if (!mIsBoss)
         {
             return(AISpawnDataAdvSingle.GetPathID(GetMapID(), GetAreaID(), typeID, GetNoiseValue()));
         }
         else
         {
             return(AISpawnDataAdvSingle.GetBossPathID(GetMapID(), GetAreaID(), typeID, GetNoiseValue()));
         }
     }
 }