public static void Make(GameObject body)
        {
            GameObject FieldDetector = new GameObject();

            FieldDetector.SetActive(false);
            FieldDetector.name             = "FieldDetector";
            FieldDetector.transform.parent = body.transform;
            FieldDetector.layer            = 20;

            ConstantForceDetector CFD = FieldDetector.AddComponent <ConstantForceDetector>();

            ForceVolume[] temp = new ForceVolume[1];
            temp[0] = Locator.GetAstroObject(AstroObject.Name.Sun).GetGravityVolume();
            CFD.SetValue("_detectableFields", temp);
            CFD.SetValue("_inheritElement0", false);
            FieldDetector.SetActive(true);
        }
예제 #2
0
        public static void Make(GameObject body, AstroObject primaryBody)
        {
            GameObject detectorGO = new GameObject();

            detectorGO.SetActive(false);
            detectorGO.name             = "FieldDetector";
            detectorGO.transform.parent = body.transform;
            detectorGO.layer            = 20;

            ConstantForceDetector CFD = detectorGO.AddComponent <ConstantForceDetector>();

            ForceVolume[] temp = new ForceVolume[1];
            temp[0] = primaryBody.GetAttachedOWRigidbody().GetAttachedGravityVolume();
            CFD.SetValue("_detectableFields", temp);
            CFD.SetValue("_inheritElement0", true);

            detectorGO.SetActive(true);
            Logger.Log("Finished building detector", Logger.LogType.Log);
        }