Hello,
I'm wondering if there is a fast and easy way to integrate the TVActor2 class within another class.
For the moment, I have the Class Unit working fine, but I have to redefine every method of the class and call them in my collection like :
'----------------------- Start of Collection Add function ----------------
Dim NewOBJ As ClsUnit
Set NewOBJ = New ClsUnit
Set UNIT= New TVActor2
With UNIT
.Load MESH, , True, True
If DebugMode = True Then
.ShowBoundingBox True
End If
If UnitTex <> "" Then
TVTexture.LoadTexture UnitTex, "Unit", , , TV_COLORKEY_NO
.SetTexture GetTex("Unit")
Else
Dim i As Integer
'setting Textures and Materials
For i = 0 To UNIT.GetBoneCount
.SetTexture .GetTexture(i), i
.SetMaterial .GetMaterial(i), i
Next
End If
.SetPosition x,y,z <------- Is not passed to ClsUnit via UNIT
End With
' this part works perfectly, but I only get Mesh and Texture (not position)
NewOBJ .TVActor2 = UNIT
'following methods have been directly implemented within the ClsUnit
' because previous line does not export parameters to the Class
NewOBJ .EnableFrustumCulling True
NewOBJ .SetPos PosX, TVLand.GetHeight(PosX, PosZ) + HeightAdjust, PosZ
NewOBJ .SetAnimationLoop True
NewOBJ .PlayAnimation AnimSpeed
NewOBJ .SetAnimationID 0
NewOBJ .SetRotationY Rotate
NewOBJ .SetScale UnitScale
Set Add = NewOBJ
Set NewOBJ = Nothing
Set UNIT= Nothing
'----------------------- end of Collection Add function ----------------
'----------------------- Start of Class Unit ------------------------------
Private mTVActor2 As TVActor2
Public Property Get TVActor2() As TVActor2
TVActor2 = mTVActor2 '<---------- DOES NOT WORK
End Property
Public Property Let TVActor2(ByVal vTVActor2 As TVActor2)
Set mTVActor2 = vTVActor2.Duplicate("Name")
End Property
Public Sub SetAnimationID(ByVal AnimID As Long)
mTVActor2.SetAnimationID AnimID
End Sub
etc ...
'----------------------- End of Class Unit -------------------------------
Any idea ?