Exemplo n.º 1
0
        private void LoadAnimation(StringValue path)
        {
            Animation _kerbalanimation = null;

            shared.Vessel.GetComponentCached <Animation>(ref _kerbalanimation);
            var kerbaltransform        = shared.Vessel.transform;
            KerbalAnimationClip myclip = new KerbalAnimationClip();

            myclip.LoadFromURL(path.ToString());
            myclip.Initialize(_kerbalanimation, kerbaltransform);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Starts the fishing program.
        /// </summary>
        public void StartFishing(Vessel v, ProtoCrewMember pcm)
        {
            evaVessel    = v;
            kerbalFisher = pcm;
            fishingData  = SportsScenario.Instance.GetFishingData(pcm);

            SetState(FishingState.StartFishing);

            // Get the kerbal EVA
            KerbalEVA eva = evaVessel.GetComponent <KerbalEVA>();

            // Create the fishing pole object
            GameObject poleObject = new GameObject("fishingPole");

            fishingPole = poleObject.AddComponent <FishingPole>();
            fishingPole.referenceTransform = eva.transform.FindDeepChild("bn_r_mid_a01");
            poleObject.SetActive(true);

            // Initialize animations
            animation = eva.GetComponent <Animation>();
            castingClip.Initialize(animation, eva.transform);
            reelingClip.Initialize(animation, eva.transform);
            hookedClip.Initialize(animation, eva.transform);
            caughtClip.Initialize(animation, eva.transform);

            // Close the window that caused us to open
            UIPartActionWindow paw = UnityEngine.Object.FindObjectOfType <UIPartActionWindow>();

            if (paw != null)
            {
                paw.isValid = false;
            }

            // Determine the body difficulty
            double gravityModifier = evaVessel.mainBody.gravParameter / (evaVessel.mainBody.Radius * evaVessel.mainBody.Radius) / 9.81;
            double scienceModifier = evaVessel.mainBody.scienceValues.SplashedDataValue / 10.0f;

            bodyDifficulty     = gravityModifier + scienceModifier;
            hookedReelingSpeed = defaultHookedReelingSpeed / (float)bodyDifficulty;
            Debug.Log("Body difficulty for " + evaVessel.mainBody.name + " = " + bodyDifficulty);

            // Pop up the tutorial dialog
            if (firstTimeDialog == null && !SportsScenario.Instance.tutorialDialogShown)
            {
                firstTimeDialog = gameObject.AddComponent <GenericDialog>();
                firstTimeDialog.instructorName = "Strategy_MechanicGuy";
                firstTimeDialog.text           = tutorialText;
                firstTimeDialog.animation      = GenericDialog.Animation.true_nodA;

                SportsScenario.Instance.tutorialDialogShown = true;
            }
        }