Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Class Including the TVActor2 Class  (Read 1474 times)
Inquisitor
Community Member
*
Posts: 94


« on: April 29, 2004, 04:38:41 PM »

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 :
Code:


'----------------------- 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 ?
Logged
Inquisitor
Community Member
*
Posts: 94


« Reply #1 on: April 29, 2004, 05:22:53 PM »

Okay I got it ...

Instead of :

    Dim NewOBJ As ClsUnit
    Set NewOBJ = New ClsUnit
    Set UNIT= New TVActor2
    With UNIT



Replace by :

    Dim NewOBJ As ClsUnit
    Set NewOBJ = New ClsUnit
    Set NewOBJ .TVActor2 = TVScene.CreateActorTVM
    With NewOBJ .TVActor2
         .Load etc ....


I like posting here, this helps me finding my own bugs Smiley
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks