using CSNetwork.GPDataType; using UnityEngine; namespace BrewMonster.Scripts.Ornament { public class CECOrnamentMan { CECBrushMan m_pBrushMan; // Trace for CD public virtual bool TraceWithBrush(ref BrushTraceInfo pInfo) { bool bCollide = false; //TO DO: fix later //save original result //bool bStartSolid = pInfo.bStartSolid; // Collide something at start point //bool bAllSolid = pInfo.bAllSolid; // All in something //int iClipPlane = pInfo.iClipPlane; // Clip plane's index //float fFraction = 100.0f; // Fraction //A3DVECTOR3 vNormal = pInfo.ClipPlane.GetNormal(); //clip plane normal //float fDist = pInfo.ClipPlane.GetDist(); //clip plane dist //if (m_pBrushMan != null && m_pBrushMan.Trace(pInfo) // && (pInfo.fFraction < fFraction)) //{ // fFraction = pInfo.fFraction; // bAllSolid = pInfo.bAllSolid; // bStartSolid = pInfo.bStartSolid; // iClipPlane = pInfo.iClipPlane; // vNormal = pInfo.ClipPlane.GetNormal(); // fDist = pInfo.ClipPlane.GetDist(); // bCollide = true; //} //HomeOnmtTable::iterator it1 = m_HomeOrnamentTab.begin(); //for (; it1 != m_HomeOrnamentTab.end(); ++it1) //{ // CECHomeOrnament* pHomeOrnament = *it1.value(); // if (!pHomeOrnament.IsLoaded()) // continue; // CELBuildingWithBrush* pBuildingWithBrush = pHomeOrnament.GetBuildingWithBrush(); // if (pBuildingWithBrush && pBuildingWithBrush.TraceWithBrush(pInfo) && (pInfo.fFraction < fFraction)) // { // fFraction = pInfo.fFraction; // bAllSolid = pInfo.bAllSolid; // bStartSolid = pInfo.bStartSolid; // iClipPlane = pInfo.iClipPlane; // vNormal = pInfo.ClipPlane.GetNormal(); // fDist = pInfo.ClipPlane.GetDist(); // bCollide = true; // } //} //// now see if collide with forest //CELForest* pForest = g_pGame.GetGameRun().GetWorld().GetForest(); //if ((fFraction > 0.0f) && pForest // && pForest.TraceWithBrush(pInfo) // && (pInfo.fFraction < fFraction)) //{ // fFraction = pInfo.fFraction; // bAllSolid = pInfo.bAllSolid; // bStartSolid = pInfo.bStartSolid; // iClipPlane = pInfo.iClipPlane; // vNormal = pInfo.ClipPlane.GetNormal(); // fDist = pInfo.ClipPlane.GetDist(); // bCollide = true; //} //// now see if collide with dynamic scene building //ECModelTable::iterator it = m_ECModelTab.begin(); //for (; it != m_ECModelTab.end(); ++it) //{ // ECMODELNODE* pNode = *it.value(); // if ((fFraction > 0.0f) && pNode // && pNode.TraceWithBrush(pInfo) // && (pInfo.fFraction < fFraction)) // { // fFraction = pInfo.fFraction; // bAllSolid = pInfo.bAllSolid; // bStartSolid = pInfo.bStartSolid; // iClipPlane = pInfo.iClipPlane; // vNormal = pInfo.ClipPlane.GetNormal(); // fDist = pInfo.ClipPlane.GetDist(); // bCollide = true; // } //} ////set back //pInfo.fFraction = fFraction; //pInfo.bStartSolid = bStartSolid; //pInfo.bAllSolid = bAllSolid; //pInfo.iClipPlane = iClipPlane; //pInfo.ClipPlane.SetNormal(vNormal); //pInfo.ClipPlane.SetD(fDist); return bCollide; } } }