public static fDiscGameObject CreateDiscGO(string sName, float fRadius, fMaterial material, bool bShareMaterial, bool bCollider) { GameObject go = new GameObject(sName); Mesh discMesh = PrimitiveCache.GetPrimitiveMesh(fPrimitiveType.Disc); initialize_meshgo(go, new fMesh(discMesh), bCollider, true); go.SetMaterial(material, bShareMaterial); return(new fDiscGameObject(go, new fMesh(go.GetSharedMesh()), fRadius)); }
public override void PreRender() { if (bBoxValid) { return; } fMesh newMesh = PrimitiveCache.GetPrimitiveMesh(fPrimitiveType.Box); UpdateMesh(newMesh, true, true); bBoxValid = true; }
public static fDiscGameObject CreateDiscGO(string sName, float fRadius, float fStartAngleDeg, float fEndAngleDeg, fMaterial material, bool bShareMaterial, bool bCollider) { GameObject go = new GameObject(sName); fMesh discMesh = PrimitiveCache.GetPrimitiveMesh(fPrimitiveType.Disc); initialize_meshgo(go, discMesh, bCollider, true); go.SetMaterial(material, bShareMaterial); fDiscGameObject discGO = new fDiscGameObject(go, new fMesh(go.GetSharedMesh()), fRadius); discGO.SetStartAngleDeg(fStartAngleDeg); discGO.SetEndAngleDeg(fEndAngleDeg); return(discGO); }
// create a subclass of fDiscGameObject public static T CreateDiscTypeGO <T>(string sName, float fRadius, fMaterial material, bool bShareMaterial, bool bCollider) where T : fDiscGameObject, new() { GameObject go = new GameObject(sName); Mesh discMesh = PrimitiveCache.GetPrimitiveMesh(fPrimitiveType.Disc); initialize_meshgo(go, new fMesh(discMesh), bCollider, true); go.SetMaterial(material, bShareMaterial); T fgo = new T(); fgo.Initialize(go, new fMesh(go.GetSharedMesh()), fRadius); return(fgo); // this lets us do it w/o new()/Initialize, however currently it means that subclass // must implement the constructor that takes GameObject... //return (T)Activator.CreateInstance(typeof(T), go, new fMesh(go.GetSharedMesh()), fRadius); }