public bool IsInBox(ReactBox b) { if (Left >= b.Left && Right <= b.Right && Top <= b.Top && Bottom >= b.Bottom) { return(true); } return(false); }
public Quadtree(ReactBox spaceBox, Quadtree parent = null) { SpaceBox = spaceBox; Parent = parent; HitableCubes = new List <HitableCube>(); HitableSpheres = new List <HitableSphere>(); HitableCapsules = new List <HitableCapsule>(); }
protected virtual void Awake() { BoundingBox = new ReactBox(); if (m_HitEngint == null) { m_HitEngint = FindObjectOfType <CheckHitEngine>(); } }
public bool IsHit(ReactBox b) { if (Right >= b.Left && Left <= b.Right) { if (Bottom <= b.Top && Top >= b.Bottom) { return(true); } } return(false); }
internal void CreateChildRecursive(int depth) { if (depth == m_MaxDepth) { return; } var leftTopBox = new ReactBox { Left = SpaceBox.Left, Right = SpaceBox.MiddleLength + m_LooseSpacing, Top = SpaceBox.Top, Bottom = SpaceBox.MiddleHeight - m_LooseSpacing }; LeftTop = new Quadtree(leftTopBox, this); LeftTop.CreateChildRecursive(depth + 1); var rightTopBox = new ReactBox { Left = SpaceBox.MiddleLength - m_LooseSpacing, Right = SpaceBox.Right, Top = SpaceBox.Top, Bottom = SpaceBox.MiddleHeight - m_LooseSpacing }; RightTop = new Quadtree(rightTopBox, this); RightTop.CreateChildRecursive(depth + 1); var leftBottomBox = new ReactBox { Left = SpaceBox.Left, Right = SpaceBox.MiddleLength + m_LooseSpacing, Top = SpaceBox.MiddleHeight + m_LooseSpacing, Bottom = SpaceBox.Bottom }; LeftBottom = new Quadtree(leftBottomBox, this); LeftBottom.CreateChildRecursive(depth + 1); var rightBottomBox = new ReactBox { Left = SpaceBox.MiddleLength - m_LooseSpacing, Right = SpaceBox.Right, Top = SpaceBox.MiddleHeight + m_LooseSpacing, Bottom = SpaceBox.Bottom }; RightBottom = new Quadtree(rightBottomBox, this); RightBottom.CreateChildRecursive(depth + 1); }
private void Start() { var allSpace = new ReactBox { Left = -ReactBoxLength / 2, Right = ReactBoxLength / 2, Top = ReactBoxLength / 2, Bottom = -ReactBoxLength / 2 }; m_Quadtree = new Quadtree(allSpace); m_Quadtree.Init(FindObjectsOfType <Hitable>().ToList()); m_Cubes = FindObjectsOfType <HitableCube>().ToList(); m_Spheres = FindObjectsOfType <HitableSphere>().ToList(); m_Capsule = FindObjectsOfType <HitableCapsule>().ToList(); }
// Constructor public SettingStrip(MilkForm m, TabPage t, int swT, ShapeTabs sTabs, WaveTabs wTabs, Shape s, Wave w, Point tL, string tt, int tMin, int tMax, int tVal, int indx) { mForm = m; tab = t; shape = s; tBarTxt = " " + tt; shapeTabs = sTabs; waveTabs = wTabs; shape = s; wave = w; stripIndx = indx; swType = swT; Font tblFont = new Font("Arial", 8, FontStyle.Bold); // Initialize TrackBar tBar = new TrackBar(); tBar.Parent = tab; tBar.Text = tt; tBar.Orientation = Orientation.Horizontal; tBar.Size = new Size(84, 16); tBar.TickStyle = TickStyle.None; tBar.BackColor = Color.Black; tBar.ForeColor = Color.Black; tBar.Padding = new Padding(2, 2, 2, 2); tBar.Margin = new Padding(0, 5, 0, 5); tBar.Left = 1; tBar.TickFrequency = 10; tBar.Minimum = tMin; tBar.Maximum = tMax; tBar.Value = tVal; tBar.ValueChanged += new EventHandler(tick); // Create TrackBar Setting Label tBarSetL = new Label(); tBarSetL.Text = tBarTxt; tBarSetL.Location = new Point(tL.X - 105, tL.Y + 2); tBarSetL.Size = new Size(100, 20); tBarSetL.Font = tblFont; tBarSetL.Parent = tab; // Create TrackBar Value Label tBarValL = new Label(); if (tBarTxt.Contains("Sides")) { tBarValL.Text = tVal.ToString(); } else { tBarValL.Text = ((float)tVal / (float)100.0).ToString(); } tBarValL.Location = new Point(tL.X + 103, tL.Y + 3); tBarValL.Parent = tab; tBarValL.Size = new Size(28, 17); tBarValL.BorderStyle = BorderStyle.Fixed3D; // Ceate UserControl uControl = new UserControl(); uControl.Size = new Size(93, 27); uControl.BackColor = Color.Black; uControl.Location = new Point(tL.X + 5, tL.Y); uControl.Parent = tab; uControl.BorderStyle = BorderStyle.Fixed3D; uControl.Controls.Add(tBar); // Set TrackBar Location Inside UserControl tBar.Location = new Point(3, 0); // Create Reaction Button react = new Button(); react.Image = new Bitmap("C:\\Users\\User\\Desktop\\Dev\\Milkdrop\\react.jpg"); react.ImageAlign = ContentAlignment.MiddleCenter; react.UseVisualStyleBackColor = true; react.Width = 65; react.Height = 12; react.Location = new Point(tL.X + 139, tL.Y + 5); react.Parent = tab; react.Font = tblFont; react.TabStop = false; react.FlatStyle = FlatStyle.Flat; react.FlatAppearance.BorderSize = 0; react.Click += reactClick; // Create Reaction Box rBox = new ReactBox(mForm, tab, sTabs, wTabs, shape, wave, stripIndx, tt); }