/** * @brief Updates ball's movements and instantiates new ball objects when player press space. **/ public override void OnSyncedUpdate() { FP hor = (FP)TrueSyncInput.GetInt(INPUT_KEY_HORIZONTAL) / 100; FP ver = (FP)TrueSyncInput.GetInt(INPUT_KEY_VERTICAL) / 100; bool currentCreateState = TrueSyncInput.GetInt(INPUT_KEY_CREATE) == 1; // Instantiates a new ball belonging to current player if the following criteria is true if (!lastCreateState && currentCreateState && !createdRuntime) { SimpleControl otherSP = TrueSyncManager.SyncedInstantiate(prefab, tsTransform.position, tsTransform.rotation).GetComponent <SimpleControl>(); otherSP.createdRuntime = true; otherSP.owner = owner; lastCreateState = currentCreateState; return; } TSVector forceToApply = TSVector.zero; if (FP.Abs(hor) > FP.Zero) { forceToApply.x = hor / 3; } if (FP.Abs(ver) > FP.Zero) { forceToApply.z = ver / 3; } controlledBody.AddForce(forceToApply, ForceMode.Impulse); lastCreateState = currentCreateState; }
private void chbListProductTypes_SelectedIndexChanged(object sender, EventArgs e) { CheckedListBox checkList = (CheckedListBox)sender; string controlName = checkList.SelectedItem.ToString(); if (checkList.CheckedItems.Contains(controlName)) { ProductType productType = ProductType.OTHERS; if (controlName.ToUpper().Equals("APPAREL")) { productType = ProductType.APPAREL; } else if (controlName.ToUpper().Equals("PRINT")) { productType = ProductType.PRINTS; } var control = new SimpleControl(controlName, productType); SimpleControl.SimpleControlsList.Add(control); flowLayout.Controls.Add(control); } else { var control = SimpleControl.FindControl(controlName); flowLayout.Controls.Remove(control); SimpleControl.RemoveControl(controlName); } }
void Start() { lastFrameTime = Time.time; playerPoint = GameObject.Find ("CharacterCentralPoint"); GameObject.Find ("Player").GetComponent<Animator> ().Play ("Fly"); simpleControl = GameObject.Find ("CharacterCentralPoint").GetComponent<SimpleControl> (); if (simpleControl.isFacedRight) simpleControl.Flip (); }
private void OnMainFormLoad(object sender, EventArgs e) { var simpleControl = new SimpleControl(); // Create the element host wrapper var wpfElementHost = new ElementHost { Child = simpleControl, Size = new Size(WpfHostFlowLayoutPanel.Width, WpfHostFlowLayoutPanel.Height) }; WpfHostFlowLayoutPanel.Controls.Add(wpfElementHost); }
void Start () { diaryCanvas = GameObject.Find ("DiaryCanvas").GetComponent<Canvas> (); control = GameObject.Find ("CharacterCentralPoint").GetComponent<SimpleControl> (); this.enabled = false; }
public void ControlTestApi() { var testRect = new Rectangle(0, 5, 20, 25); var basic = new SimpleControl(true, 0, 5, 20, 25); var vec2 = new SimpleControl(true, new Vector2(0, 5), new Vector2(20, 25)); var rect = new SimpleControl(true, testRect); Assert.AreEqual(testRect.Location, basic.Location); Assert.AreEqual(testRect.Location, vec2.Location); Assert.AreEqual(testRect.Location, rect.Location); Assert.AreEqual(true, basic.AutoFocus); Assert.AreEqual(true, vec2.AutoFocus); Assert.AreEqual(true, rect.AutoFocus); Assert.AreEqual(testRect.Size, basic.Size); Assert.AreEqual(testRect.Size, vec2.Size); Assert.AreEqual(testRect.Size, rect.Size); Assert.AreEqual(testRect, basic.Bounds); Assert.AreEqual(testRect, vec2.Bounds); Assert.AreEqual(testRect, rect.Bounds); Assert.AreEqual(testRect.Top, rect.Top); Assert.AreEqual(testRect.Left, rect.Left); Assert.AreEqual(testRect.Right, rect.Right); Assert.AreEqual(testRect.Bottom, rect.Bottom); Assert.AreEqual(testRect.BottomRight, rect.BottomRight); Assert.AreEqual(testRect.BottomLeft, rect.BottomLeft); Assert.AreEqual(testRect.UpperLeft, rect.UpperLeft); Assert.AreEqual(testRect.UpperRight, rect.UpperRight); Assert.AreEqual(testRect.Center, rect.Center); Assert.AreEqual(testRect.Width, rect.Width); Assert.AreEqual(testRect.Height, rect.Height); Assert.AreEqual(testRect.X, rect.X); Assert.AreEqual(testRect.Y, rect.Y); testRect = new Rectangle(1, 6, 21, 26); rect.X = 1; rect.Y = 6; rect.Width = 21; rect.Height = 26; Assert.AreEqual(testRect, rect.Bounds); testRect = new Rectangle(2, 7, 22, 27); rect.Location = new Vector2(2, 7); rect.Size = new Vector2(22, 27); Assert.AreEqual(testRect, rect.Bounds); rect.BackgroundColor = Color.Azure; Assert.AreEqual(Color.Azure, rect.BackgroundColor); Assert.IsTrue(rect.Enabled); rect.Enabled = false; Assert.IsFalse(rect.Enabled); rect.Enabled = true; Assert.IsTrue(rect.Enabled); Assert.IsTrue(rect.Visible); rect.Visible = false; Assert.IsFalse(rect.Visible); rect.Visible = true; Assert.IsTrue(rect.Visible); }