Esempio n. 1
0
        public override void OnStart(PartModule.StartState state)
        {
            DragManager = part.gameObject.GetComponent<DragManager>();

            if (DragManager == null) {
                DragManager = part.gameObject.AddComponent<DragManager>();
                DragManager.SetPart(part);
            }

            anim = part.FindModelAnimators(AnimationName)[0];
            animState = anim[AnimationName];
            animState.wrapMode = WrapMode.Clamp;

            if (FixAnimLayers) {
                int i = 0;
                foreach (AnimationState s in anim)
                    s.layer = i++;
            }

            animState.normalizedSpeed = 0;
            if (engaged) {
                animState.normalizedTime = Drag / 100;
                spoilerState = ModuleLandingGear.GearStates.DEPLOYED;
            }
            else {
                animState.normalizedTime = 0;
                spoilerState = ModuleLandingGear.GearStates.RETRACTED;
            }
            anim.Play(AnimationName);
        }
Esempio n. 2
0
        public override void OnStart(PartModule.StartState state)
        {
            DragManager = part.gameObject.GetComponent <DragManager>();

            if (DragManager == null)
            {
                DragManager = part.gameObject.AddComponent <DragManager>();
                DragManager.SetPart(part);
            }

            gearHandler.Start(ID, part);
            anim               = part.FindModelAnimators(AnimationName)[0];
            animState          = anim[AnimationName];
            animState.wrapMode = WrapMode.Clamp;

            if (FixAnimLayers)
            {
                int i = 0;
                foreach (AnimationState s in anim)
                {
                    s.layer = i++;
                }
            }

            part.PhysicsSignificance = 1;

            Transform bounds = part.FindModelTransform("Bounds");

            if (bounds != null)
            {
                UnityEngine.Object.DestroyImmediate(bounds.gameObject);
            }

            gearState = Deployed ? ModuleLandingGear.GearStates.DEPLOYED : ModuleLandingGear.GearStates.RETRACTED;

            animState.normalizedTime = Deployed ? 1 : 0;

            animState.speed = Deployed ? Mathf.Abs(animState.speed) : -Mathf.Abs(animState.speed);

            UpdateDrag();

            anim.Play(AnimationName);

            HashSet <WheelCollider> tmp = new HashSet <WheelCollider>();

            part.transform.FindWheelColliders(ref tmp);
            foreach (WheelCollider w in tmp)
            {
                w.enabled = true;
            }
        }
Esempio n. 3
0
        public override void OnStart(PartModule.StartState state)
        {
            DragManager = part.gameObject.GetComponent <DragManager>();

            if (DragManager == null)
            {
                DragManager = part.gameObject.AddComponent <DragManager>();
                DragManager.SetPart(part);
            }

            anim               = part.FindModelAnimators(AnimationName)[0];
            animState          = anim[AnimationName];
            animState.wrapMode = WrapMode.Clamp;

            if (FixAnimLayers)
            {
                int i = 0;
                foreach (AnimationState s in anim)
                {
                    s.layer = i++;
                }
            }


            animState.normalizedSpeed = 0;
            if (engaged)
            {
                animState.normalizedTime = Drag / 100;
                spoilerState             = ModuleLandingGear.GearStates.DEPLOYED;
            }
            else
            {
                animState.normalizedTime = 0;
                spoilerState             = ModuleLandingGear.GearStates.RETRACTED;
            }
            anim.Play(AnimationName);
        }
        public override void OnStart(PartModule.StartState state)
        {
            DragManager = part.gameObject.GetComponent<DragManager>();

            if (DragManager == null) {
                DragManager = part.gameObject.AddComponent<DragManager>();
                DragManager.SetPart(part);
            }

            gearHandler.Start(ID,part);
            anim = part.FindModelAnimators(AnimationName)[0];
            animState = anim[AnimationName];
            animState.wrapMode = WrapMode.Clamp;

            if (FixAnimLayers) {
                int i = 0;
                foreach (AnimationState s in anim)
                    s.layer = i++;
            }

            part.PhysicsSignificance = 1;

            Transform bounds = part.FindModelTransform("Bounds");
            if (bounds != null)
                UnityEngine.Object.DestroyImmediate(bounds.gameObject);

            gearState = Deployed ? ModuleLandingGear.GearStates.DEPLOYED : ModuleLandingGear.GearStates.RETRACTED;

            animState.normalizedTime = Deployed ? 1 : 0;

            animState.speed = Deployed ? Mathf.Abs(animState.speed) : -Mathf.Abs(animState.speed);

            UpdateDrag();

            anim.Play(AnimationName);

            HashSet<WheelCollider> tmp = new HashSet<WheelCollider>();
            part.transform.FindWheelColliders(ref tmp);
            foreach (WheelCollider w in tmp)
                w.enabled = true;
        }