예제 #1
0
    private IEnumerator LoadPlayerTriggerBoxNodes(CathodeFlowgraph flowgraph, GameObject parentTransform, System.Action <int, GameObject> loadModelCallback)
    {
        PreloadedFlowgraphContent content = preloadedPlayerTriggerBoxNodes.FirstOrDefault(o => o.flowraphID == flowgraph.nodeID);

        for (int i = 0; i < content.nodeNames.Count; i++)
        {
            GameObject thisNodeGO = GameObject.CreatePrimitive(PrimitiveType.Cube);
            thisNodeGO.name                    = content.nodeNames[i];
            thisNodeGO.transform.parent        = parentTransform.transform;
            thisNodeGO.transform.localPosition = content.nodeTransforms[i].position;
            thisNodeGO.transform.localRotation = content.nodeTransforms[i].rotation;
            thisNodeGO.transform.localScale    = new Vector3(content.half_dimensions.y, content.half_dimensions.z, content.half_dimensions.x) * 2; //i dont think this is right
        }
        yield break;
    }
예제 #2
0
    private PreloadedFlowgraphContent PreloadFlowgraphContent(CathodeFlowgraph flowgraph, uint typeID)
    {
        PreloadedFlowgraphContent content = new PreloadedFlowgraphContent();

        content.flowraphID = flowgraph.nodeID;
        List <CathodeNodeEntity> models = GetAllOfType(ref flowgraph, typeID);

        for (int i = 0; i < models.Count; i++)
        {
            CathodeNodeEntity thisNode     = models[i];
            List <int>        modelIndexes = new List <int>();
            List <UInt32>     resourceID   = new List <UInt32>();
            foreach (CathodeParameterReference paramRef in thisNode.nodeParameterReferences)
            {
                CathodeParameter param = commandsPAK.GetParameter(paramRef.offset);
                if (param == null)
                {
                    continue;
                }
                if (param.dataType != CathodeDataType.SHORT_GUID)
                {
                    continue;
                }
                resourceID.Add(((CathodeResource)param).resourceID);
            }
            for (int x = 0; x < resourceID.Count; x++)
            {
                List <CathodeResourceReference> resRef = flowgraph.GetResourceReferencesByID(resourceID[x]);
                for (int y = 0; y < resRef.Count; y++)
                {
                    if (resRef[y].entryType != CathodeResourceReferenceType.RENDERABLE_INSTANCE)
                    {
                        continue;                                                                          //Ignoring collision maps, etc, for now
                    }
                    for (int p = 0; p < resRef[y].entryCountREDS; p++)
                    {
                        modelIndexes.Add(redsBIN[resRef[y].entryIndexREDS] + p);
                    }
                }
            }
            content.nodeModelIDs.Add(modelIndexes);
            content.nodeTransforms.Add(GetTransform(ref thisNode));
            content.half_dimensions = GetHalfDimensions(ref thisNode);
            content.nodeNames.Add(NodeDB.GetNodeTypeName(thisNode.nodeType, ref commandsPAK) + ": " + NodeDB.GetFriendlyName(thisNode.nodeID));
        }
        return(content);
    }
예제 #3
0
    private IEnumerator LoadModelReferenceNodes(CathodeFlowgraph flowgraph, GameObject parentTransform, System.Action <int, GameObject> loadModelCallback)
    {
        PreloadedFlowgraphContent content = preloadedModelReferenceNodes.FirstOrDefault(o => o.flowraphID == flowgraph.nodeID);

        for (int i = 0; i < content.nodeNames.Count; i++)
        {
            GameObject thisNodeGO = new GameObject(content.nodeNames[i]);
            thisNodeGO.transform.parent        = parentTransform.transform;
            thisNodeGO.transform.localPosition = content.nodeTransforms[i].position;
            thisNodeGO.transform.localRotation = content.nodeTransforms[i].rotation;
            for (int x = 0; x < content.nodeModelIDs[i].Count; x++)
            {
                loadModelCallback(content.nodeModelIDs[i][x], thisNodeGO);
            }
        }
        yield break;
    }