#****************************************************************************
#**
#**  Author(s):  William Holmes
#**
#**  Summary  :  UEF Railgun Tank Script
#**
#**  Copyright © 2008 Firebird Industries, Inc.  All rights reserved.
#****************************************************************************
local TLandUnit = import('/lua/terranunits.lua').TLandUnit
local TDFGaussCannonWeapon = import('/lua/terranweapons.lua').TDFLandGaussCannonWeapon

UEL0302 = Class(TLandUnit) {
    Weapons = {
        GaussGun = Class(TDFGaussCannonWeapon) {},
    },
    
    OnCreate = function(self,builder,layer)
        TLandUnit.OnCreate(self,builder,layer)
        self.AnimManip = CreateAnimator(self)
        self.AnimManip:PlayAnim(self:GetBlueprint().Display.AnimationOnLand, false):SetRate(0)
    end,
    
    OnLayerChange = function(self, new, old)
        TLandUnit.OnLayerChange(self, new, old)
            local myBlueprint = self:GetBlueprint()
            if( new == 'Land' ) then
                self.AT1 = self:ForkThread(self.TransformThread, false)
            elseif( new == 'Water' ) then
                self.AT1 = self:ForkThread(self.TransformThread, true)
            end
    end,
    
    TransformThread = function(self, land)
        if( land ) then
            self.AnimManip:SetRate(1)
            WaitFor(self.AnimManip)
            self.Walking = false
        else
            self.AnimManip:SetRate(-1)
            WaitFor(self.AnimManip)
            self.Walking = true
        end
    end,
    
}

TypeClass = UEL0302