示例#1
0
 void CheckIsSpawnTrigger()
 {
     if (!IsSpawnTrigger)
     {
         SSCreatNpcData creatNpcData = GetComponent <SSCreatNpcData>();
         if (creatNpcData == null)
         {
             //没有使用该产生点.
             Destroy(gameObject);
         }
     }
 }
示例#2
0
 /// <summary>
 /// 使产生点贴地.
 /// </summary>
 void MakeSpawnPointToLand(SSCreatNpcData dt)
 {
     if (dt != null)
     {
         MakePintToLand(dt.transform);
         int length = dt.m_NpcPathGp.Length;
         for (int i = 0; i < length; i++)
         {
             if (dt.m_NpcPathGp[i] != null)
             {
                 MakePathNodeToLand(dt.m_NpcPathGp[i].transform);
             }
         }
     }
 }
示例#3
0
    NpcSpawnData GetNpcSpawnData(NpcState npcType, SpawnPointState pointState)
    {
        if (pointState == SpawnPointState.Null)
        {
            //不产生战车、JPBoss和SuperJPBoss.
            return(null);
        }

        NpcSpawnData data = new NpcSpawnData();

        //获取ncp预制.
        data.NpcPrefab = GetNpcPrefab(npcType, pointState);
        SSCreatNpcData creatNpcDt = GetCreatNpcData(npcType, pointState);

        if (creatNpcDt != null)
        {
            //获取npc路径.
            data.NpcPath = creatNpcDt.GetNpcPahtData();
            //获取产生点组件.
            data.SpawnPoint = creatNpcDt.m_SpawnPoint;
        }
        return(data);
    }
示例#4
0
    /// <summary>
    /// 获取创建npc的组件.
    /// </summary>
    SSCreatNpcData GetCreatNpcData(NpcState npcType, SpawnPointState type)
    {
        SSCreatNpcData[] comGp = null;
        switch (type)
        {
        case SpawnPointState.Left:
        {
            if (npcType == NpcState.ZhanChe)
            {
                comGp = m_NpcData.LeftSpawnPointGp;
            }
            else
            {
                comGp = m_NpcData.Boss_LeftSpawnPointGp;
            }
            break;
        }

        case SpawnPointState.Right:
        {
            if (npcType == NpcState.ZhanChe)
            {
                comGp = m_NpcData.RightSpawnPointGp;
            }
            else
            {
                comGp = m_NpcData.Boss_RightSpawnPointGp;
            }
            break;
        }

        case SpawnPointState.Up:
        {
            if (npcType == NpcState.ZhanChe)
            {
                comGp = m_NpcData.UpSpawnPointGp;
            }
            else
            {
                comGp = m_NpcData.Boss_UpSpawnPointGp;
            }
            break;
        }

        case SpawnPointState.Down:
        {
            if (npcType == NpcState.ZhanChe)
            {
                comGp = m_NpcData.DownSpawnPointGp;
            }
            else
            {
                comGp = m_NpcData.Boss_DownSpawnPointGp;
            }
            break;
        }
        }

        if (comGp == null || comGp.Length <= 0)
        {
            Debug.LogWarning("Unity: not find CreatNpcData! type ================ " + type + ", npcType == " + npcType);
            return(null);
        }

        SSCreatNpcData com = null;
        int            rv  = Random.Range(0, 100) % comGp.Length;

        com = comGp[rv];
        if (com == null)
        {
            Debug.LogWarning("Unity: com was null! rv ============ " + rv + ", type == " + type);
        }
        return(com);
    }
示例#5
0
    // Use this for initialization
    void Awake()
    {
        SSCreatNpcData npcDataCom = gameObject.GetComponent <SSCreatNpcData>();

        if (NpcObj == null && npcDataCom == null)
        {
            if (!XkGameCtrl.GetInstance().IsCartoonShootTest)
            {
                Debug.LogWarning("Unity:" + "NpcObj was null");
                GameObject obj = null;
                obj.name = "null";
            }
            return;
        }

        if (NpcObj != null)
        {
            XKNpcMoveCtrl npcScript = NpcObj.GetComponent <XKNpcMoveCtrl>();
            if (npcScript != null)
            {
                if (IsFireMove && IsAimPlayer)
                {
                    Debug.LogWarning("Unity:" + "SpawnPoint.IsFireMove and SpawnPoint.IsAimPlayer is true!");
                    GameObject obj = null;
                    obj.name = "null";
                }
            }
        }

        if (NpcPath != null)
        {
            if (NpcPath.childCount < 1)
            {
                Debug.LogWarning("Unity:" + "NpcPath.childCount was wrong! childCount = " + NpcPath.childCount);
                GameObject obj = null;
                obj.name = "null";
            }

            if (NpcPath.GetComponent <NpcPathCtrl>() == null)
            {
                Debug.LogWarning("Unity:" + "NpcPath was wrong! cannot find NpcPathCtrl script");
                GameObject obj = null;
                obj.name = "null";
            }
        }

        if (NpcSpawnLoop.Length > 0)
        {
            for (int i = 0; i < NpcSpawnLoop.Length; i++)
            {
                if (NpcSpawnLoop[i] == null)
                {
                    Debug.LogWarning("Unity:" + "NpcSpawnLoop was wrong! index " + (i + 1));
                    GameObject obj = null;
                    obj.name = "null";
                    break;
                }
            }
        }

        if (ChildSpawnPoint.Length > 0)
        {
            for (int i = 0; i < ChildSpawnPoint.Length; i++)
            {
                if (ChildSpawnPoint[i] == null)
                {
                    Debug.LogWarning("Unity:" + "ChildSpawnPoint was wrong! index " + (i + 1));
                    GameObject obj = null;
                    obj.name = "null";
                    break;
                }
            }
        }

        if (ChildSpawnPoint.Length > 0 && NpcFangZhen == null)
        {
            Debug.LogWarning("Unity:" + "NpcFangZhen is null! fangZhenLength " + ChildSpawnPoint.Length);
            GameObject obj = null;
            obj.name = "null";
        }
        //Invoke("CheckIsRemoveTrigger", 1f);

        MeshRenderer mesh = gameObject.GetComponent <MeshRenderer>();

        if (mesh != null)
        {
            Destroy(mesh);
        }

        MeshFilter meshFt = gameObject.GetComponent <MeshFilter>();

        if (meshFt != null)
        {
            Destroy(meshFt);
        }
    }