public Item(Things.Item I) { this.InitializeComponent(); this.ieEditor.Item = I; this.Size = this.ieEditor.Size; ++this.Height; }
public ThingPropertyPages(Things.IThing T) { this.InitializeComponent(); // Use the dummy page to get size deltas, then discard it this.DeltaW = this.Width - this.tabDummy.Width; this.DeltaH = this.Height - this.tabDummy.Height; this.tabPages.TabPages.Clear(); this.tabDummy.Dispose(); this.tabDummy = null; // Add pages as needed foreach (PropertyPages.IThing P in T.GetPropertyPages()) { P.Left = 0; P.Top = 0; if (this.tabPages.TabPages.Count == 0) { // Resize to match the first page (even if not fixed-size) this.Width = P.Width + this.DeltaW; this.Height = P.Height + this.DeltaH; } if (!P.IsFixedSize) { P.Dock = DockStyle.Fill; } TabPage TP = new ThemedTabPage(P.TabName); TP.UseVisualStyleBackColor = true; TP.Controls.Add(P); TP.Tag = P; this.tabPages.TabPages.Add(TP); } this.AdjustSize(); }
private void AddFieldEntries(Things.IThing T) { List<String> AllFields = T.GetAllFields(); foreach (string FieldName in AllFields) { if (T.HasField(FieldName)) { object V = T.GetFieldValue(FieldName); if (V is string && (V as string).Contains("\n")) { int LineCount = 0; foreach (string Line in (V as string).Split('\n')) { ListViewItem LVI = this.lstFields.Items.Add(String.Format("{0} [{1}]", FieldName, ++LineCount)); LVI.Tag = Line; LVI.SubItems.Add(Line); } } else { ListViewItem LVI = this.lstFields.Items.Add(FieldName); LVI.Tag = V; LVI.SubItems.Add(T.GetFieldText(FieldName)); if (V is Things.IThing) { LVI.Font = new Font(LVI.Font, FontStyle.Underline); } } } else { this.lstFields.Items.Add(FieldName).ForeColor = SystemColors.GrayText; } } }
public Yoyo CreateYoyo(Things.DTO.Yoyo yoyo) { return new Yoyo() { Id = yoyo.Id, BearingSize = yoyo.BearingSize, ColorWay = yoyo.ColorWay, Created = yoyo.Created, CurrentValue = yoyo.CurrentValue, Description = yoyo.Description, DiameterInMM = yoyo.DiameterInMM, EverOwned = yoyo.EverOwned, GapWidthInMM = yoyo.GapWidthInMM, Images = yoyo.Images, IsOwned = yoyo.IsOwned, Manufacturer = yoyo.Manufacturer, Modified = yoyo.Modified, Name = yoyo.Name, Notes = yoyo.Notes, OriginalCost = yoyo.OriginalCost, Response = yoyo.Response, SerialNumber = yoyo.SerialNumber, WeightInGrams = yoyo.WeightInGrams, WidthInMM = yoyo.WidthInMM }; }
public Thing(Things.IThing T) { InitializeComponent(); this.picIcon.Image = T.GetIcon() ?? Icons.POLViewer.ToBitmap(); this.lblText.Text = T.ToString(); this.lblTypeName.Text = T.TypeName; this.AddFieldEntries(T); }
public Graphic(Things.Graphic G) { InitializeComponent(); this.dlgSaveImage.FileName = G.ToString() + ".png"; this.picImage.Image = G.GetFieldValue("image") as Image; this.cmbViewMode.Items.Add(new NamedEnum(PictureBoxSizeMode.Normal)); this.cmbViewMode.Items.Add(new NamedEnum(PictureBoxSizeMode.CenterImage)); this.cmbViewMode.Items.Add(new NamedEnum(PictureBoxSizeMode.StretchImage)); this.cmbViewMode.Items.Add(new NamedEnum(PictureBoxSizeMode.Zoom)); this.cmbViewMode.SelectedIndex = 0; this.cmbBackColor.SelectedIndex = 0; }
public Manufacturer CreateManufacturer(Things.DTO.Manufacturer manufacturer) { return new Manufacturer() { Created = manufacturer.Created, CurrentlyActive = manufacturer.CurrentlyActive, Description = manufacturer.Description, Id = manufacturer.Id, Images = manufacturer.Images, Location = manufacturer.Location, Modified = manufacturer.Modified, Name = manufacturer.Name, Notes = manufacturer.Notes }; }
static void Main() { // Test the C# types customisation by modifying the default char * typemaps to return a single char Things things = new Things(); System.Text.StringBuilder initialLetters = new System.Text.StringBuilder(); char myChar = things.start("boo"); initialLetters.Append(myChar); myChar = Things.stop("hiss"); initialLetters.Append(myChar); myChar = csharp_typemaps.partyon("off"); initialLetters.Append(myChar); if (initialLetters.ToString() != "bho") throw new Exception("initial letters failed"); // $csinput expansion csharp_typemaps.myInt = 1; try { csharp_typemaps.myInt = -1; throw new Exception("oops"); } catch (ApplicationException) { } // Eager garbage collector test { const int NUM_THREADS = 8; Thread[] threads = new Thread[NUM_THREADS]; TestThread[] testThreads = new TestThread[NUM_THREADS]; // invoke the threads for (int i=0; i<NUM_THREADS; i++) { testThreads[i] = new TestThread(i); threads[i] = new Thread(new ThreadStart(testThreads[i].Run)); threads[i].Start(); } // wait for the threads to finish for (int i=0; i<NUM_THREADS; i++) { threads[i].Join(); } for (int i=0; i<NUM_THREADS; i++) { if (testThreads[i].Failed) throw new Exception("Test Failed"); } } }
// Add a GameObject if it respwan public void Connect(Things Who) { C_List.Add(Who); }
public IEnumerable <Intersection> Intersect(Ray r) { return(Things.Select(t => t.CalculateIntersection(r))); }
public void SetThing(Things thing) { _serverLogicManager.ThingsServerLogic.SetThing(thing); }
public DeviceLinkEvent(WebhookEventSource source, long timestamp, Things things) : base(source, timestamp, things) { }
public DeviceEvent(WebhookEventSource source, long timestamp, Things things) : base(WebhookEventType.Things, source, timestamp) { Things = things; }
public DeviceUnlinkEvent(WebhookEventSource source, long timestamp, Things things, string mode) : base(source, timestamp, things, mode) { }
public static BGGThings CreateThings(Things rawThings) { return(new BGGThings(rawThings)); }
IEnumerator FaceAnim02() { camMove = false; StartCoroutine(TextAway()); yield return(playerController.ForceLookPlayer(face, 30)); StartCoroutine(Things.PosSLerp(face, faceIdlePosition.position, 120)); StartCoroutine(ChangeAmbientNoise(bass01)); for (float f = 0f; f < 1f; f += 1f / 130f) { yield return(playerController.ForceLookPlayer(face, 0)); } yield return(dialogueManager.StartDialogue(Dialogue.Cutscene02FaceDialogue())); StartCoroutine(Things.PosSLerp(face, faceLSidePosition.position, 120)); StartCoroutine(Things.PosRotSLerp(handL, handIdlePos1, 20)); StartCoroutine(Things.PosRotSLerp(handR, handIdlePos2, 20)); yield return(playerController.ForceLookPlayer(playerGameLookPosition, 30)); //Round 1: apples, bananas - how many do { yield return(dialogueManager.StartDialogue(Dialogue.Cutscene02RoundXReady(1))); bool apples = Random.value < 0.5f; int fruitCount = Random.Range(8, 14); int appleCount = 0; int bananaCount = 0; for (int i = 0; i < fruitCount; i++) { yield return(RandomHandPosition()); if (Random.value < 0.6f) { appleCount++; InstantiateThrowObject(apple, 3f); } else { bananaCount++; InstantiateThrowObject(banana, 3f); } } yield return(new WaitForSeconds(3f)); yield return(dialogueManager.StartDialogue(Dialogue.Cutscene02Round1(apples, apples ? appleCount : bananaCount))); } while (dialogueManager.ending == "Wrong"); //Round 2: square, circle, triangle - more or less do { yield return(dialogueManager.StartDialogue(Dialogue.Cutscene02RoundXReady(2))); int typeA = Random.Range(0, 3); //0:sq, 1:ci; 2:tr int typeB = Random.Range(0, 3); typeB = typeA != typeB ? typeB : (typeB + 1) % 3; int shapeCount = Random.Range(8, 14); int[] counts = new int[] { 0, 0, 0 }; GameObject[] objects = new GameObject[] { square, circle, triangle }; for (int i = 0; i < shapeCount; i++) { yield return(RandomHandPosition()); int randomObjectValue = Random.Range(0, 3); InstantiateThrowObject(objects[randomObjectValue], 1f); counts[randomObjectValue]++; } if (counts[typeA] == counts[typeB]) { yield return(RandomHandPosition()); InstantiateThrowObject(objects[typeA], 1f); counts[typeA]++; } yield return(new WaitForSeconds(3f)); yield return(dialogueManager.StartDialogue(Dialogue.Cutscene02Round2(NumToStringShapes(typeA), NumToStringShapes(typeB), counts[typeA] > counts[typeB]))); } while (dialogueManager.ending == "Wrong"); //Round 3: cube, sphere, cylinder, square, circle, triangle - were there any circles/squares do { yield return(dialogueManager.StartDialogue(Dialogue.Cutscene02RoundXReady(3))); bool squares = Random.value < 0.5f; bool hasOne = Random.value < 0.5f; int shapeCount = Random.Range(12, 18); int whenMaybeObject = hasOne ? Random.Range(0, shapeCount) : -1; GameObject[] objects = new GameObject[] { squares?circle : square, triangle, cube, sphere, cylinder }; GameObject maybeObject = squares ? square : circle; for (int i = 0; i < shapeCount; i++) { yield return(RandomHandPosition()); int randomObjectValue = Random.Range(0, objects.Length); InstantiateThrowObject(i == whenMaybeObject ? maybeObject : objects[randomObjectValue], 1f); } yield return(new WaitForSeconds(3f)); yield return(dialogueManager.StartDialogue(Dialogue.Cutscene02Round3(squares ? "squares" : "circles", hasOne))); } while (dialogueManager.ending == "Wrong"); //Round 4.1: everything normal, one child, blood - whoops, did you see anything weird { yield return(dialogueManager.StartDialogue(Dialogue.Cutscene02RoundXReady(4))); int shapeCount = Random.Range(12, 18); int whenChild = Random.Range(11, shapeCount); GameObject[] objects = new GameObject[] { apple, banana, circle, square, triangle, cube, sphere, cylinder }; for (int i = 0; i < shapeCount; i++) { yield return(RandomHandPosition()); int randomObjectValue = Random.Range(0, objects.Length); if (i == whenChild) { InstantiateThrowObject(child, 1.3f); InstantiateThrowObject(blood, 1f); break; } else { InstantiateThrowObject(objects[randomObjectValue], randomObjectValue < 2 ? 3f : 1f); } } StartCoroutine(ChangeAmbientNoise(bass02)); faceAnim.SetTrigger("Eyes01"); camEffect.effectStep = 1; yield return(new WaitForSeconds(3f)); yield return(dialogueManager.StartDialogue(Dialogue.Cutscene02Round4Whoops())); } //Round 4.2: everything normal - how many or more or less or were there any circles do { yield return(dialogueManager.StartDialogue(Dialogue.Cutscene02RoundXReady(4))); int whichGame = Random.Range(0, 3); int itemCount = Random.Range(8, 14); GameObject[] objects = new GameObject[] { apple, banana, circle, square, triangle, cube, sphere, cylinder }; int[] counts = new int[objects.Length]; if (whichGame == 0) //How many { int type = Random.Range(0, objects.Length); for (int i = 0; i < itemCount; i++) { yield return(RandomHandPosition()); int randomObjectValue = Random.Range(0, objects.Length); InstantiateThrowObject(objects[randomObjectValue], 1f); counts[randomObjectValue]++; } yield return(new WaitForSeconds(3f)); yield return(dialogueManager.StartDialogue(Dialogue.Cutscene02Round4A(NumToStringAll(type), counts[type]))); } else if (whichGame == 1) //More or less { int typeA = Random.Range(0, objects.Length); int typeB = Random.Range(0, objects.Length); typeB = typeA != typeB ? typeB : (typeB + 1) % objects.Length; for (int i = 0; i < itemCount; i++) { yield return(RandomHandPosition()); int randomObjectValue = Random.Range(0, objects.Length); InstantiateThrowObject(objects[randomObjectValue], 1f); counts[randomObjectValue]++; } if (counts[typeA] == counts[typeB]) { yield return(RandomHandPosition()); InstantiateThrowObject(objects[typeA], 1f); counts[typeA]++; } yield return(new WaitForSeconds(3f)); yield return(dialogueManager.StartDialogue(Dialogue.Cutscene02Round4B(NumToStringAll(typeA), NumToStringAll(typeB), counts[typeA] > counts[typeB]))); } else //Were there any { bool hasOne = Random.value < 0.5f; int maybeObject = Random.Range(0, objects.Length); bool maybeObjectInstantiated = false; for (int i = 0; i < itemCount; i++) { yield return(RandomHandPosition()); int randomObjectValue = Random.Range(0, objects.Length); if (randomObjectValue == maybeObject) { if (hasOne && !maybeObjectInstantiated) { InstantiateThrowObject(objects[randomObjectValue], 1f); maybeObjectInstantiated = true; } else { InstantiateThrowObject(objects[(randomObjectValue + Random.Range(0, objects.Length - 1)) % objects.Length], 1f); } } else { InstantiateThrowObject(objects[randomObjectValue], 1f); } } yield return(new WaitForSeconds(3f)); yield return(dialogueManager.StartDialogue(Dialogue.Cutscene02Round4C(NumToStringAll(maybeObject), hasOne))); } } while (dialogueManager.ending == "Wrong"); //Round 5: blood, children - how many children did i kill for this blood yield return(dialogueManager.StartDialogue(Dialogue.Cutscene02RoundXReady(5))); for (int i = 0; i < Random.Range(4, 7); i++) { yield return(RandomHandPosition()); InstantiateThrowObject(child, Random.Range(0.8f, 1.5f)); InstantiateThrowObject(blood, Random.Range(0.8f, 1.2f)); } StartCoroutine(ChangeAmbientNoise(bass03)); faceAnim.SetTrigger("Eyes02"); camEffect.effectStep = 2; yield return(new WaitForSeconds(3f)); StartCoroutine(Things.PosSLerp(face, faceIdlePosition.position, 120)); StartCoroutine(Things.PosRotSLerp(handL, handIdlePos1, 120)); StartCoroutine(Things.PosRotSLerp(handR, handIdlePos2, 120)); yield return(dialogueManager.StartDialogue(Dialogue.Cutscene02Round5())); StartCoroutine(Things.PosSLerp(handL, handWavePos.position, 20)); yield return(Wave()); StartCoroutine(ChangeAmbientNoise(null)); camEffect.effectStep = 0; StartCoroutine(Things.PosSLerp(handL, faceByePosition.position, 20)); StartCoroutine(Things.PosSLerp(handR, faceByePosition.position, 20)); yield return(Things.PosSLerp(face, faceByePosition.position, 20)); face.gameObject.SetActive(false); handL.gameObject.SetActive(false); handR.gameObject.SetActive(false); playerController.UnRide(); }
public void CreateNothing() { last_item_spawned = Things.NOTHING; }
public static DeviceEvent Create(WebhookEventSource source, long timestamp, Things things, string mode, string webhookEventId, DeliveryContext deliveryContext) { return((things.Type == ThingsType.Link) ? new DeviceLinkEvent(source, timestamp, things, mode, webhookEventId, deliveryContext) as DeviceEvent : new DeviceUnlinkEvent(source, timestamp, things, mode, webhookEventId, deliveryContext) as DeviceEvent); }
public Thing(KaitaiStream io, Things parent = null, DoomWad root = null) : base(io) { m_parent = parent; m_root = root; _parse(); }
public int area = 5; //道具产生范围,必须为正数且保持在【3,无穷】较好 //public Map map;//获取地图 public Prop() { Random random = new Random(); thing = (Things)random.Next(0, 4); }
public static DeviceEvent Create(WebhookEventSource source, long timestamp, Things things) { return((things.Type == ThingsType.Link) ? new DeviceLinkEvent(source, timestamp, things) as DeviceEvent : new DeviceUnlinkEvent(source, timestamp, things) as DeviceEvent); }
public IEnumerable <string> Get() { return(Things.GetNames()); }
public DB() : base(Effort.DbConnectionFactory.CreateTransient(), contextOwnsConnection: true) { Things.RemoveRange(Things); SaveChanges(); }
public override void Notify_QuestSignalReceived(Signal signal) { base.Notify_QuestSignalReceived(signal); if (!(signal.tag == inSignal)) { return; } pawns.RemoveAll((Pawn x) => x.Destroyed); items.RemoveAll((Thing x) => x.Destroyed); Thing thing = Things.Where((Thing x) => x is Pawn).MaxByWithFallback((Thing x) => x.MarketValue); Thing thing2 = Things.MaxByWithFallback((Thing x) => x.MarketValue * (float)x.stackCount); if (mapParent != null && mapParent.HasMap && Things.Any()) { Map map = mapParent.Map; IntVec3 intVec = (dropSpot.IsValid ? dropSpot : GetRandomDropSpot()); if (sendStandardLetter) { TaggedString title; TaggedString text; if (joinPlayer && pawns.Count == 1 && pawns[0].RaceProps.Humanlike) { text = "LetterRefugeeJoins".Translate(pawns[0].Named("PAWN")); title = "LetterLabelRefugeeJoins".Translate(pawns[0].Named("PAWN")); PawnRelationUtility.TryAppendRelationsWithColonistsInfo(ref text, ref title, pawns[0]); } else { text = "LetterQuestDropPodsArrived".Translate(GenLabel.ThingsLabel(Things)); title = "LetterLabelQuestDropPodsArrived".Translate(); PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter(pawns, ref title, ref text, "LetterRelatedPawnsNeutralGroup".Translate(Faction.OfPlayer.def.pawnsPlural), informEvenIfSeenBefore: true); } title = (customLetterLabel.NullOrEmpty() ? title : customLetterLabel.Formatted(title.Named("BASELABEL"))); text = (customLetterText.NullOrEmpty() ? text : customLetterText.Formatted(text.Named("BASETEXT"))); Find.LetterStack.ReceiveLetter(title, text, customLetterDef ?? LetterDefOf.PositiveEvent, new TargetInfo(intVec, map), null, quest); } if (joinPlayer) { for (int i = 0; i < pawns.Count; i++) { if (pawns[i].Faction != Faction.OfPlayer) { pawns[i].SetFaction(Faction.OfPlayer); } } } else if (makePrisoners) { for (int j = 0; j < pawns.Count; j++) { if (pawns[j].RaceProps.Humanlike) { if (!pawns[j].IsPrisonerOfColony) { pawns[j].guest.SetGuestStatus(Faction.OfPlayer, prisoner: true); } HealthUtility.TryAnesthetize(pawns[j]); } } } for (int k = 0; k < pawns.Count; k++) { pawns[k].needs.SetInitialLevels(); } DropPodUtility.DropThingsNear(intVec, map, Things, 110, canInstaDropDuringInit: false, leaveSlag: false, !useTradeDropSpot, forbid: false); importantLookTarget = items.Find((Thing x) => x.GetInnerIfMinified() is MonumentMarker).GetInnerIfMinified(); items.Clear(); } if (!outSignalResult.NullOrEmpty()) { if (thing != null) { Find.SignalManager.SendSignal(new Signal(outSignalResult, thing.Named("SUBJECT"))); } else if (thing2 != null) { Find.SignalManager.SendSignal(new Signal(outSignalResult, thing2.Named("SUBJECT"))); } else { Find.SignalManager.SendSignal(new Signal(outSignalResult)); } } }
public void AddItem() { Thing newThing = new Thing(); Things.Add(newThing); SelectedThing = newThing; }
void SetUpDay() { // Wake up WaitForTime("7:55am", () => { Away = false; }); WaitForTime("8:00am", () => { Player.WakeUp(); Player.Unacquire(Things.FindByName("Bed With Player")); }); WaitForTime("8:04am", () => { Player.Say(Player.DialogueLines.WakingUp); }); // Walk to bathroom WaitForTime("8:10am", () => { Player.MoveTo("Sink"); if (PayDay) { Player.Say(Player.DialogueLines.PayDay); } }); WaitForTime("8:25am", () => { Player.MoveTo("Door"); WaitForMove(() => { Player.Hide(); }); }); WaitForTime("8:30am", () => { Away = true; }); WaitForTime("5:25pm", () => { Away = false; Player.Facing = Player.PlayerDirections.Left; }); WaitForTime("5:30pm", () => { Player.Say(Player.DialogueLines.GettingHome); Player.MoveTo("Computer"); WaitForMove(() => { Player.Sit(); }); }); WaitForTime("5:35pm", () => { Ui.WebBrowser.Open(); }); WaitForTime("9:30pm", () => { Player.Say(Player.DialogueLines.BedSoon); }); WaitForTime("9:50pm", () => { Ui.WebBrowser.Close(); }); WaitForTime("9:55pm", () => { Player.Stand(); }); WaitForTime("10:00pm", () => { Player.MoveTo(new Vector2(things.FindByName("Bed").transform.position.x + bedOffset, Player.transform.position.y)); WaitForMove(() => { // go to bed Player.Sleep(); }); }); WaitForTime("10:04pm", () => { Player.Acquire(Things.FindByName("Bed With Player")); }); WaitForTime("10:05pm", () => { Camera.FollowTarget = roomTransform; }); WaitForTime("10:10pm", () => { Away = true; }); }
public Thing Get(string name) { return(Things.Find(name)); }
public override void OnInspectorGUI() { // This can be replaced // base.OnInspectorGUI(); EditorGUILayout.PropertyField(propRadius); EditorGUILayout.PropertyField(propDamage); EditorGUILayout.PropertyField(propColor); //so.ApplyModifiedProperties(); if (so.ApplyModifiedProperties()) { ExplosiveBarrelManager.UpdateAllBarrelColors(); } GUILayout.Space(20); // Way 1: BeginHorizontal - EndHorizontal GUILayout.Label("Way 1: BeginHorizontal - EndHorizontal", EditorStyles.boldLabel); GUILayout.BeginHorizontal(); GUILayout.Label("Things: ", GUILayout.Width(60)); if (GUILayout.Button("Do a thing")) { Debug.Log("did the thing"); } things = (Things)EditorGUILayout.EnumPopup(things); GUILayout.EndHorizontal(); GUILayout.Space(20); // Way 2(safer): HorizontalScope GUILayout.Label("Way 2(safer): HorizontalScope", EditorStyles.boldLabel); using (new GUILayout.HorizontalScope()) { GUILayout.Label("Things: ", GUILayout.Width(60)); if (GUILayout.Button("Do a thing")) { Debug.Log("did the thing"); } things = (Things)EditorGUILayout.EnumPopup(things); } GUILayout.Space(20); // Example layout GUILayout.Label("Example layout", EditorStyles.boldLabel); using (new GUILayout.VerticalScope(EditorStyles.helpBox)) { using (new GUILayout.HorizontalScope()) { GUILayout.Label("SomeValue: ", GUILayout.Width(60)); someValue = GUILayout.HorizontalSlider(someValue, -1f, 1f); } GUILayout.Label("Things"); GUILayout.Label("Things", GUI.skin.button); EditorGUILayout.ObjectField("Assign here: ", null, typeof(Transform), true); } // explicit positioning using rect // GUI // EditorGUI // implicit positioning, auto-layout // GUILayout // EditorGUILayout }
void Update() { Debug.DrawLine(oculusCam.transform.position, oculusCam.transform.position + oculusCam.transform.forward, Color.red, 1 / 30); Debug.DrawLine(oculusCam.transform.position, oculusCam.transform.position + prevForwardVector, Color.green, 1 / 30); scoreMessage.text = "Halie: Number of Items Collected: " + numThingsCollected; // NEW CODE FOR A7 float howMuchUserRotated = angleBetweenVectors(prevForwardVector, oculusCam.transform.forward); if (howMuchUserRotated > 0.01f) { print("_____________________" + oculusCam.transform.forward); float directionUserRotated = (d(oculusCam.transform.position + prevForwardVector, oculusCam.transform.position, oculusCam.transform.position + oculusCam.transform.forward) > 0) ? 1 : -1; print("******************d is " + directionUserRotated + ", howmuch=" + howMuchUserRotated); float deltaYawRelativeToCenter = prevYawRelativeToCenter - angleBetweenVectors(oculusCam.transform.forward, VRTrackingOrigin.transform.position - oculusCam.transform.position); float distanceFromCenter = oculusCam.transform.localPosition.magnitude; print("distanceFromCenter" + distanceFromCenter); // Q: I'm thinking something it scaling wrong here b/c of parenting //float longestDimensionOfPE = VRTrackingOrigin.transform.localScale.x > VRTrackingOrigin.transform.localScale.z ? //VRTrackingOrigin.transform.localScale.x : VRTrackingOrigin.transform.localScale.z; float longestDimensionOfPE = 3.0f; float howMuchToAccelerate = ((deltaYawRelativeToCenter < 0) ? -0.13f : 0.30f) * howMuchUserRotated * directionUserRotated * Mathf.Clamp(distanceFromCenter / longestDimensionOfPE / 2, 0.0f, 1.0f); // Q: I just made pivot a empty GameObject in the scene, is that alright? // Q: how to make vr tracking origin child of pivot parent // make VRTrackingOrigin child of a pivot parent located at oculusCam.position print("howmuchaccel " + howMuchToAccelerate); if (Mathf.Abs(howMuchToAccelerate) >= 0.05f) { //pivot.transform.parent=null; //pivot.transform.position = oculusCam.transform.position; //this.transform.parent = pivot.transform; // Q: is pivot right? // pivot.transform.rotation.yaw += howMuchToAccelerate; // pivot.transform.rotation += howMuchToAccelerate //pivot.transform.eulerAngles=new Vector3(pivot.transform.eulerAngles.x, pivot.transform.eulerAngles.y+(float)howMuchToAccelerate, pivot.transform.eulerAngles.z); VRTrackingOrigin.transform.RotateAround(new Vector3(oculusCam.transform.position.x, 0, oculusCam.transform.position.z), new Vector3(0, 1.0f, 0), howMuchToAccelerate); //print("pivot transform "+pivot.transform.position+", "+oculusCam.transform.position); // unparent pivot // Q: do we need to make pivot child null as well? //this.transform.parent = null; } } prevForwardVector = oculusCam.transform.forward; prevYawRelativeToCenter = angleBetweenVectors(oculusCam.transform.forward, VRTrackingOrigin.transform.position - oculusCam.transform.position); // TRANSLATIONAL GAIN Vector3 trajectoryVector = oculusCam.transform.position - prevLocation; Vector3 howMuchToTranslate = (Vector3.Normalize(trajectoryVector)) * 0.75f; VRTrackingOrigin.transform.position += howMuchToTranslate; prevLocation = oculusCam.transform.position; if (justStarted) { winMessage.gameObject.SetActive(false); justStarted = false; } if (numThingsCollected >= 5) { winMessage.gameObject.SetActive(true); } // scoreMessage.text = "Halie\n# of Items Collected: " + numThingsCollected; if (OVRInput.GetDown(OVRInput.RawButton.RHandTrigger)) { Collider[] overlappingThings = Physics.OverlapSphere(rightPointerObject.transform.position, 0.01f, collectiblesMask); if (overlappingThings.Length > 0) { attachGameObjectToAChildGameObject(overlappingThings[0].gameObject, rightPointerObject, AttachmentRule.KeepWorld, AttachmentRule.KeepWorld, AttachmentRule.KeepWorld, true); thingIGrabbed = overlappingThings[0].gameObject.GetComponent <Things>(); } } else if (OVRInput.GetUp(OVRInput.RawButton.RHandTrigger)) { letGo(); } else if (OVRInput.GetDown(OVRInput.RawButton.LHandTrigger)) { Collider[] overlappingThings = Physics.OverlapSphere(leftPointerObject.transform.position, 0.01f, collectiblesMask); if (overlappingThings.Length > 0) { attachGameObjectToAChildGameObject(overlappingThings[0].gameObject, leftPointerObject, AttachmentRule.KeepWorld, AttachmentRule.KeepWorld, AttachmentRule.KeepWorld, true); thingIGrabbed = overlappingThings[0].gameObject.GetComponent <Things>(); } } else if (OVRInput.GetUp(OVRInput.RawButton.LHandTrigger)) { letGo(); } }
internal static WebhookEvent CreateFrom(dynamic dynamicObject) { if (dynamicObject == null) { throw new ArgumentNullException(nameof(dynamicObject)); } var eventSource = WebhookEventSource.CreateFrom(dynamicObject?.source); if (eventSource == null) { return(null); } if (!Enum.TryParse((string)dynamicObject.type, true, out WebhookEventType eventType)) { return(null); } switch (eventType) { case WebhookEventType.Message: EventMessage eventMessage = EventMessage.CreateFrom(dynamicObject); if (eventMessage == null) { return(null); } return(new MessageEvent(eventSource, (long)dynamicObject.timestamp, eventMessage, (string)dynamicObject.replyToken)); case WebhookEventType.Follow: return(new FollowEvent(eventSource, (long)dynamicObject.timestamp, (string)dynamicObject.replyToken)); case WebhookEventType.Unfollow: return(new UnfollowEvent(eventSource, (long)dynamicObject.timestamp)); case WebhookEventType.Join: return(new JoinEvent(eventSource, (long)dynamicObject.timestamp, (string)dynamicObject.replyToken)); case WebhookEventType.Leave: return(new LeaveEvent(eventSource, (long)dynamicObject.timestamp)); case WebhookEventType.Postback: var postback = new Postback( (string)dynamicObject.postback?.data, (string)dynamicObject.postback?.@params?.date, (string)dynamicObject.postback?.@params?.time, (string)dynamicObject.postback?.@params?.datetime); return(new PostbackEvent(eventSource, (long)dynamicObject.timestamp, (string)dynamicObject.replyToken, postback)); case WebhookEventType.Beacon: if (!Enum.TryParse((string)dynamicObject.beacon.type, true, out BeaconType beaconType)) { return(null); } return(new BeaconEvent(eventSource, (long)dynamicObject.timestamp, (string)dynamicObject.replyToken, (string)dynamicObject.beacon.hwid, beaconType, (string)dynamicObject.beacon.dm)); case WebhookEventType.AccountLink: var link = new Link((string)dynamicObject.link?.result, (string)dynamicObject.link?.nonce); return(new AccountLinkEvent(eventSource, (long)dynamicObject.timestamp, (string)dynamicObject.replyToken, link)); case WebhookEventType.Things: var thingsType = (ThingsType)Enum.Parse(typeof(ThingsType), (string)dynamicObject.things?.type, true); var things = new Things((string)dynamicObject.things?.deviceId, thingsType); return(DeviceEvent.Create(eventSource, (long)dynamicObject.timestamp, things)); case WebhookEventType.MemberJoined: var joinedMembers = new List <WebhookEventSource>(); foreach (var member in dynamicObject.joined.members) { joinedMembers.Add(WebhookEventSource.CreateFrom(member)); } return(new MemberJoinEvent(eventSource, (long)dynamicObject.timestamp, (string)dynamicObject.replyToken, joinedMembers)); case WebhookEventType.MemberLeft: var leftMembers = new List <WebhookEventSource>(); foreach (var member in dynamicObject.left.members) { leftMembers.Add(WebhookEventSource.CreateFrom(member)); } return(new MemberLeaveEvent(eventSource, (long)dynamicObject.timestamp, leftMembers)); default: return(null); } }
public void SetThingToCharacter(Things thing, CharacterWarehouse warehouse) { _serverLogicManager.CharacterThingsServerLogic.SetThingToWarehouse(thing, warehouse); }
protected override void AddMoreThings() { Things.Add(new ThingToDo("Completed Thing", true)); Things.Add(new ThingToDo("Another Completed Thing", true)); }
public DeviceLinkEvent(WebhookEventSource source, long timestamp, Things things, string mode, string webhookEventId, DeliveryContext deliveryContext) : base(source, timestamp, things, mode, webhookEventId, deliveryContext) { }
public void ThereShouldBeNoCompletedThings() { MainViewModel.ClearCompletedThings(); Things.Any(t => t.Completed).ShouldBe(false); }
public string ContentString() { return(Things == null ? "" : Things.Aggregate("", (r, i) => r + Environment.NewLine + i.Name + " x" + i.Count)); }
public bool HasBlocker() { return(Things.Any(t => Actor.GetAll().Single(a => a.ClassName == t.Type).IsSolid)); }
public DeviceEvent(WebhookEventSource source, long timestamp, Things things, string mode, string webhookEventId, DeliveryContext deliveryContext) : base(WebhookEventType.Things, source, timestamp, mode, webhookEventId, deliveryContext) { Things = things; }
private static void PrintThings(Things things) { Console.WriteLine("Things:"); foreach (var item in things.Items) { Console.WriteLine("========================="); Console.WriteLine($"ID: {item.Id}"); Console.WriteLine($"Description: {item.Description}"); Console.WriteLine($"Type: {item.Type}"); Console.WriteLine($"Thumbnail: {item.Thumbnail}"); Console.WriteLine($"Image: {item.Image}"); foreach (var name in item.Names) { Console.WriteLine($"Name: {name.Type} {name.SortIndex} {name.Value}"); } // Let op: alle onderstaande attributen kunnen null zijn if (item.YearPublished != null) { Console.WriteLine($"Year Published: {item.YearPublished.Value}"); } if (item.MinPlayers != null) { Console.WriteLine($"Min Players: {item.MinPlayers.Value}"); } if (item.MaxPlayers != null) { Console.WriteLine($"Max Players: {item.MaxPlayers.Value}"); } if (item.PlayingTime != null) { Console.WriteLine($"Playing Time: {item.PlayingTime.Value}"); } if (item.MinPlaytime != null) { Console.WriteLine($"Min Playtime: {item.MinPlaytime.Value}"); } if (item.MaxPlaytime != null) { Console.WriteLine($"Max Playtime: {item.MaxPlaytime.Value}"); } if (item.MinAge != null) { Console.WriteLine($"Min Age: {item.MinAge.Value}"); } // Let op: item.Polls kan null zijn. if (item.Polls != null) { foreach (var poll in item.Polls) { // Let op: poll.Results kan null zijn Console.WriteLine($"Poll: {poll.Name} {poll.Title} {poll.TotalVotes} ({(poll.Results == null ? 0 : poll.Results.Length)} poll results)"); } } foreach (var link in item.Links) { Console.WriteLine($"Link: {link.Type} {link.Id} {link.Value}"); } } }
public Thing GetThing(int id) { var repositoryThing = Things.First(t => t.Id == id); return(new Thing(repositoryThing.Type, repositoryThing.Name, repositoryThing.Effect, repositoryThing.Cost)); }
internal static HandleRef getCPtr(Things obj) { return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; }