Example #1
0
    public static Vector2 GetAxis2D(VRAxis2D input, Handedness handedness)
    {
        float x = Input.GetAxis(handedness.ToString() + input + "Horizontal");
        float y = Input.GetAxis(handedness.ToString() + input + "Vertical");

        return(new Vector2(x, y));
    }
Example #2
0
 // output for debugging
 public override string ToString()
 {
     return("[ Head: " + HeadPos.ToString() + ", Hip: " + HipPos.ToString() +
            ", Ankles: " + AnklesPos.ToString() + ", Arm Lenght: " + ArmLength.ToString() +
            ", Height: " + Height.ToString() + ", Width: " + Width.ToString() +
            ", Handedness: " + Handedness.ToString() + "]");
 }
Example #3
0
        public override void Vibrate()
        {
            int    p    = rng.Next(minVibrate, maxVibrate);
            string text = Handedness.ToString() + " " + name + " vibrating for " + p.ToString() + "[s]";

            Console.WriteLine(text);
            Thread.Sleep(p * 1000);
            //throw new NotImplementedException();
        }
Example #4
0
    public void TentacleKilled()
    {
        print("Tentacle killed" + hand.ToString());
        KilledTime    = Time.time;
        TentacleAlive = false;
        GetComponent <Rigidbody>().useGravity  = true;
        GetComponent <Rigidbody>().isKinematic = false;

        //  StartCoroutine(TentacleStartOver());
    }
Example #5
0
    public static float GetAxis(GenericVRAxis input, Handedness handedness)
    {
        if (handedness == Handedness.None)
        {
            Debug.LogError("Handedness not set");
            return(0);
        }

        return(Input.GetAxis(handedness.ToString() + input.ToString()));
    }
Example #6
0
    public static bool Get(GenericVRButton input, Handedness handedness)
    {
        if (handedness == Handedness.None)
        {
            Debug.LogError("Handedness not set");
            return(false);
        }

        return(Math.Abs(Input.GetAxisRaw(handedness.ToString() + input.ToString())) > 0);
    }
Example #7
0
        /// <summary>
        /// Get the game object that represents the joint transforms
        /// <param name="joint">Joint to fetch</param>
        /// </summary>
        public GameObject GetJointObject(TrackedHandJoint joint)
        {
            GameObject retVal = null;
            int        index  = (int)joint;

            if ((index >= 0 && index < jointObjects.Length))
            {
                retVal = jointObjects[index];
            }

            if (retVal == null)
            {
                Debug.Log("Failed to get Joint Object" + " " + Hand.ToString() + " " + joint.ToString());
            }

            return(retVal);
        }
Example #8
0
        public override bool IsHeld()
        {
            if (type == "vive")
            {
                throw new NotImplementedException();
            }
            int    holding  = rng.Next(2);
            bool   holding_ = holding > 0 ? true : false;
            string text;

            text = Handedness.ToString() + " " + name + " is ";;
            if (!holding_)
            {
                text += "not ";
            }
            text += "held";
            Console.WriteLine(text);

            return(holding_);
        }
Example #9
0
    public static bool GetUp(GenericVRButton input, Handedness handedness)
    {
        VRButton vrButton = (VRButton)Enum.Parse(typeof(VRButton), handedness.ToString() + input.ToString());

        return(GetUp(vrButton));
    }
Example #10
0
    public static float GetAxisOnce(GenericVRAxis axisInput, Handedness handedness, float?inputThreshold = 0.75f)
    {
        VRAxis vrAxis = (VRAxis)Enum.Parse(typeof(VRAxis), handedness.ToString() + axisInput.ToString());

        return(GetAxisOnce(vrAxis, inputThreshold));
    }
        private OculusQuestArticulatedHand createArticulatedHand(Handedness handedness)
        {
            var inputSystem = Service as IMixedRealityInputSystem;
            var pointers    = RequestPointers(SupportedControllerType.ArticulatedHand, handedness);
            var inputSource = inputSystem?.RequestNewGenericInputSource($"Oculus Quest Hand Controller {handedness.ToString()}", pointers, InputSourceType.Hand);
            var hand        = new OculusQuestArticulatedHand(TrackingState.NotTracked, handedness, inputSource);

            hand.SetupConfiguration(typeof(OculusQuestArticulatedHand), InputSourceType.Hand);
            for (int i = 0; i < hand.InputSource?.Pointers?.Length; i++)
            {
                hand.InputSource.Pointers[i].Controller = hand;
            }
            inputSystem.RaiseSourceDetected(hand.InputSource, hand);
            return(hand);
        }
Example #12
0
        public override void Select(MainForm frm)
        {
            if (frm.grpItem.Text == ToString() && frm.MainTab.SelectedTab == frm.tabItem)
            {
                return;
            }
            Program.MakeSelected(frm.tabItem, frm.lstItem, this);

            frm.grpItem.Text = ToString();
            frm.grpItem.Show();
#if DEBUG
            frm.grpItem.Text += $" - ID: {Id}";
#endif
            frm.lblItemDescription.Text      = Description;
            frm.lblItemCoords.Text           = Coords.IsEmpty ? "Off Map" : Coords.ToString();
            frm.lblItemMaker.Data            = Maker;
            frm.lblItemMasterpieceEvent.Data = MasterpieceEvent;
            frm.lblItemMat.Text     = Mat.HasValue ? Materials[Mat.Value].ToTitleCase() : "";
            frm.lblItemType.Text    = ItemTypeId.HasValue ? ItemTypes[ItemTypeId.Value].ToTitleCase() : "";
            frm.lblItemSubType.Text = ItemSubTypeId.HasValue ? ItemSubTypes[ItemSubTypeId.Value].ToTitleCase() : "";
            frm.lblItemName.Text    = Name;
            frm.lblItemQuality.Text = Quality.ToString();
            frm.lblItemWeight.Text  = Weight.ToString();
            frm.lblItemSkill.Text   = SkillUsed.ToString();
            var AgeTime = new WorldTime(0, Age).ToString().Split('.').Select(x => Convert.ToInt32(x)).ToArray();

            if (AgeTime[2] > 0)
            {
                frm.lblItemAge.Text = AgeTime[2] + @" year" + (AgeTime[2] > 0 ? "s" : "");
            }
            else if (AgeTime[1] > 1)
            {
                frm.lblItemAge.Text = AgeTime[1] - 1 + @" month" + (AgeTime[1] > 1 ? "s" : "");
            }
            else if (AgeTime[0] > 1)
            {
                frm.lblItemAge.Text = AgeTime[0] - 1 + @" day" + (AgeTime[0] > 1 ? "s" : "");
            }
            else if (Age.HasValue)
            {
                frm.lblItemAge.Text = Age + @" seconds";
            }
            else
            {
                frm.lblItemAge.Text = "";
            }

            frm.lblItemWear.Text   = Wear.ToString();
            frm.lblItemHand.Text   = Handedness.ToString();
            frm.lblItemShape.Text  = Shape.ToString();
            frm.lblItemDyeMat.Text = DyeMat.HasValue ? Materials[DyeMat.Value] : "";
            frm.lblItemUnit.Data   = UnitId.HasValue && World.Units.ContainsKey(UnitId.Value)
                ? World.Units[UnitId.Value]
                : null;
            frm.lblItemHF.Data = HistFigureId.HasValue && World.HistoricalFigures.ContainsKey(HistFigureId.Value)
                ? World.HistoricalFigures[HistFigureId.Value]
                : null;
            frm.lblItemBoneMat.Text = BoneMat.HasValue ? Materials[BoneMat.Value] : "";

            frm.lblItemStockpile.Text       = StockpileId.ToString();
            frm.lblItemStockpileCoords.Text = StockpileCoords.IsEmpty ? "" : StockpileCoords.ToString();

            frm.grpItemImage.Visible = ImageId.HasValue;
            if (ImageId.HasValue)
            {
                frm.lblItemImageID.Text    = ImageId.ToString();
                frm.lblItemImageSubID.Text = ImageSubId.ToString();
                frm.lblItemImageCiv.Data   = ImageCivId.HasValue && World.Entities.ContainsKey(ImageCivId.Value)
                    ? World.Entities[ImageCivId.Value]
                    : null;
                frm.lblItemImageSIte.Data = ImageSiteId.HasValue && World.Sites.ContainsKey(ImageSiteId.Value)
                    ? World.Sites[ImageSiteId.Value]
                    : null;
            }

            frm.grpItemIngredient.FillListboxWith(frm.lstItemIngredient, Ingredients);
            frm.grpItemImprovement.FillListboxWith(frm.lstItemImprovement, Improvements);
            frm.grpItemReferences.FillListboxWith(frm.lstItemReferences, References);
        }
Example #13
0
        public override void Grab()
        {
            string text = Handedness.ToString() + " " + name + " grabbing object";

            Console.WriteLine(text);
        }