コード例 #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));
        }
    }
コード例 #2
0
    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);
    }
コード例 #3
0
    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
    static int GetMonsterProtoIDForBeacon(int bcnProtoId, Vector3 pos, ref float fScale)
    {
        if (!EntityMonsterBeacon.IsBcnMonsterProtoId(bcnProtoId))               // not encoded
        {
            return(bcnProtoId);
        }

        int spType, lvl, spawnType;

        EntityMonsterBeacon.DecodeBcnMonsterProtoId(bcnProtoId, out spType, out lvl, out spawnType);

        int terType  = 0;
        int areaType = -1;

        AISpawnTDWavesData.TDMonsterData md = null;
        if (spType < EntityMonsterBeacon.TowerDefenseSpType_Beg)
        {
            PointType pt = AiUtil.GetPointType(pos);
            switch (pt)
            {
            default:
            case PointType.PT_Ground:
                terType = 0;
                break;

            case PointType.PT_Water:
                terType = 1;
                break;

            case PointType.PT_Slope:
                terType = 2;
                break;

            case PointType.PT_Cave:
                terType = 3;
                break;
            }
            areaType = PeGameMgr.IsStory ? PeMappingMgr.Instance.GetAiSpawnMapId(new Vector2(pos.x, pos.z)) : AiUtil.GetMapID(pos);
            if (PeGameMgr.IsAdventure && areaType == 5)
            {
                areaType = 2;
            }
        }
        int opPlayerId = -1;

        if (MainPlayerCmpt.gMainPlayer != null)
        {
            SkAliveEntity skPlayer = MainPlayerCmpt.gMainPlayer.Entity.aliveEntity;
            if (skPlayer != null)
            {
                opPlayerId = (int)skPlayer.GetAttribute(AttribType.DefaultPlayerID);
            }
        }
        md = AISpawnTDWavesData.GetMonsterProtoId(!PeGameMgr.IsStory, spType, lvl, spawnType, areaType, terType, opPlayerId);
        if (null != md)
        {
            // md.ProtoId |= EntityProto.IdAirbornePujaMask;	// test airborne
            if (md.IsAirbornePuja)
            {
                md.ProtoId |= EntityProto.IdAirbornePujaMask;
            }
            if (md.IsAirbornePaja)
            {
                md.ProtoId |= EntityProto.IdAirbornePajaMask;
            }
            if (md.IsGrp)
            {
                md.ProtoId |= EntityProto.IdGrpMask;
            }
            return(md.ProtoId);
        }
        return(-1);
    }
コード例 #5
0
ファイル: SPPoint.cs プロジェクト: shrubba/planetexplorers
 void CalculatePointType()
 {
     mType = AiUtil.GetPointType(position);
 }