Example #1
0
        public void Start()
        {
            if (string.IsNullOrEmpty(hatchTransform))
            {
                JUtil.LogMessage(this, "Where's my transform?");
                return;
            }
            Transform actualTransform;

            if (internalProp == null)
            {
                actualTransform = internalModel.FindModelTransform(hatchTransform);
                if (!string.IsNullOrEmpty(internalAnimation))
                {
                    intAnim = internalModel.FindModelAnimators(internalAnimation)[0];
                }
            }
            else
            {
                actualTransform = internalProp.FindModelTransform(hatchTransform);
                if (!string.IsNullOrEmpty(internalAnimation))
                {
                    intAnim = internalProp.FindModelAnimators(internalAnimation)[0];
                }
            }
            if (!string.IsNullOrEmpty(internalAnimation) && intAnim == null)
            {
                JUtil.LogErrorMessage(this, "Animation name was not found.");
            }
            // Switching to using the stock button class because right now SmarterButton can't correctly handle doubleclick.
            InternalButton.Create(actualTransform.gameObject).OnDoubleTap(new InternalButton.InternalButtonDelegate(EVAClick));
        }
Example #2
0
        public override void OnAwake()
        {
            if (NavUtilLib.GlobalVariables.Settings.enableDebugging)
            {
                Transform[] t1 = internalProp.FindModelComponents <Transform>();
                foreach (Transform t0 in t1)
                {
                    if (NavUtilLib.GlobalVariables.Settings.enableDebugging)
                    {
                        Debug.Log("NavUtil: found " + t0.name);
                    }
                }
            }

            if (NavUtilLib.GlobalVariables.Settings.enableDebugging)
            {
                Debug.Log("NavUtil: Before compassObject");
            }
            compass     = internalProp.FindModelTransform(compassObject);
            compassInit = compass.transform.localRotation;

            if (NavUtilLib.GlobalVariables.Settings.enableDebugging)
            {
                Debug.Log("NavUtil: Before brgObject");
            }
            brgBug    = internalProp.FindModelTransform(brgObject);
            brgBugInt = brgBug.transform.localRotation;

            if (NavUtilLib.GlobalVariables.Settings.enableDebugging)
            {
                Debug.Log("NavUtil: Before locNeedleObject");
            }
            locNeedle = internalProp.FindModelTransform(locNeedleObject);

            locNeedle.parent = brgBug;

            locInit    = locNeedle.transform.localPosition;
            locInitRot = locNeedle.transform.localRotation;



            if (NavUtilLib.GlobalVariables.Settings.enableDebugging)
            {
                Debug.Log("NavUtil: Before gsNeedleObject");
            }
            gsNeedle = internalProp.FindModelTransform(gsNeedleObject);
            gsInit   = gsNeedle.transform.localPosition;

            if (NavUtilLib.GlobalVariables.Settings.enableDebugging)
            {
                Debug.Log("NavUtil: Before crsRotObject");
            }
            crsBug    = internalProp.FindModelTransform(crsRotObject);
            crsBugInt = crsBug.transform.localRotation;

            //UI
            crsKnob     = internalProp.FindModelTransform(crsObject);
            hdgKnob     = internalProp.FindModelTransform(hdgObject);
            crsKnobInit = crsKnob.transform.localRotation;
            hdgKnobInit = hdgKnob.transform.localRotation;

            InternalButton hdgBtn = InternalButton.Create(hdgKnob.gameObject);

            hdgBtn.OnDown(new InternalButton.InternalButtonDelegate(OnHdgBtnClick));



            InternalButton crsBtn = InternalButton.Create(crsKnob.gameObject);

            crsBtn.OnDown(new InternalButton.InternalButtonDelegate(OnCrsBtnClick));



            dme[0] = internalProp.FindModelTransform(dmeTenthsObject);
            dme[1] = internalProp.FindModelTransform(dmeOnesObject);
            dme[2] = internalProp.FindModelTransform(dmeTensObject);
            dme[3] = internalProp.FindModelTransform(dmeHundredsObject);

            dmeInt[0] = dme[0].transform.localRotation;
            dmeInt[1] = dme[1].transform.localRotation;
            dmeInt[2] = dme[2].transform.localRotation;
            dmeInt[3] = dme[3].transform.localRotation;



            if (GlobalVariables.Settings.enableDebugging)
            {
                Debug.Log("NavUtil: Starting systems...");
            }
            if (!NavUtilLib.GlobalVariables.Settings.navAidsIsLoaded)
            {
                NavUtilLib.GlobalVariables.Settings.loadNavAids();
            }

            if (!NavUtilLib.GlobalVariables.Materials.isLoaded)
            {
                NavUtilLib.GlobalVariables.Materials.loadMaterials();
            }



            if (GlobalVariables.Settings.enableDebugging)
            {
                Debug.Log("NavUtil: Systems started successfully!");
            }
        }