} //END PlayOrFade //---------------------------------// protected override void OtherBlockButtonSelected( BlockButton block ) //---------------------------------// { if( showDebug ) Debug.Log( "BlockAudio.cs OtherComponentEntered( " + block.name + " ) readyToPlay = " + readyToPlay + ", activateOnBlockButtonSelect = " + activateOnBlockButtonSelect + ", IsBlockButtonNotNull() = " + IsBlockButtonNotNull() + ", foundEventTriggerOnBlockButtonCollider = " + foundEventTriggerOnBlockButtonCollider + ", blockGroup.IsBlockInGroup( block ) = " + blockGroup.IsInGroup( block ) ); if( readyToPlay ) { if( activateOnBlockButtonSelect && IsBlockButtonNotNull() ) { if( foundEventTriggerOnBlockButtonCollider && blockGroup.IsInGroup( block ) ) { if( showDebug ) Debug.Log( "BlockAudio.cs OtherComponentEntered( " + block.name + " ) calling Play()" ); Play(); } } } //If we've entered the BlockButton collider but we're not ready to begin playback, then when the source does finish loading, begin playback else if( !readyToPlay ) { if( activateOnBlockButtonSelect && IsBlockButtonNotNull() ) { if( foundEventTriggerOnBlockButtonCollider && blockGroup.IsInGroup( block ) ) { playRequested = true; } } } } //END OtherBlockButtonSelected
//---------------------------------------------------// /// <summary> /// When using a Gaze system for interaction, this function is called when a BlockButton has a players gaze exit the collider /// </summary> /// <param name="blockButton">Which BlockButton has the gaze exited the collider of?</param> public virtual void BlockButtonGazeExit( BlockButton blockButton ) //---------------------------------------------------// { //Perform different logic if the gaze exited this BlockButton, or if this block is different if( blockButton == this ) { ThisBlockButtonGazeExit(); } else { OtherBlockButtonGazeExit( blockButton ); } } //END BlockButtonGazeExit
//---------------------------------// /// <summary> /// When selecting a button (either through Gaze, Click, Touch, or button/trigger press), this function is called /// </summary> /// <param name="blockButton">Which BlockButton has been selected</param> public void BlockButtonSelected( BlockButton blockButton ) //---------------------------------// { //Perform different logic if the button selected is this Block, or a different block altogether if( blockButton == this ) { ThisBlockButtonSelected(); } else { OtherBlockButtonSelected( blockButton ); } } //END BlockButtonSelected
} //END AddPrefabManagerIfNeeded //---------------------------------------------------// /// <summary> /// When using a Gaze system for interaction, this function is called when a BlockButton has a players gaze enter it's collider /// </summary> /// <param name="blockButton">Which BlockButton has the gaze entered the collider of?</param> public virtual void BlockButtonGazeEnter( BlockButton blockButton ) //---------------------------------------------------// { //If the BlockButton in question is this block, perform different logic than if the BlockButton is NOT this block if( blockButton == this ) { ThisBlockButtonGazeEnter(); } else { OtherBlockButtonGazeEnter( blockButton ); } } //END BlockButtonGazeEnter
private static bool Prefix(ref BlockButton ___button_ChangeDirection) { if (MyInput.GetButton("Sprint")) { MoreSailsMoreSpeed.ToggleAllEnginesDir(); return(false); } return(true); }
public void AddItem(BlockButton bb) { BlockItem bi = blockItems[bb.id]; BlockItem newBi = Instantiate(bi); newBi.id = bb.id; newBi.transform.SetParent(container.transform); draggingBlockItem = newBi; draggingBlockItem.transform.localScale = Vector3.one; }
public void CreateTest() { var block = BlockModel.Create(0, 0); // Act var button = new BlockButton(block, Color.Black); // Assert Assert.AreEqual(Color.Black, button.ActiveColor); }
void Start() { health = 100; sound = Sound.Instance; canMove = true; block = BlockButton.Instance; player = Player.Instance; switcher = PlayerModelSwitcher.Instance; joystick = VirtualJoystick.Instance; }
// Start is called before the first frame update void Start() { Debug.Log("started"); yellowButton = GameObject.Find("YellowButton").GetComponent <BlockButton>(); redButton = GameObject.Find("RedButton").GetComponent <BlockButton>(); blueButton = GameObject.Find("BlueButton").GetComponent <BlockButton>(); yellowBlock = GameObject.Find("YellowBlock").GetComponent <MovableBlock>(); redBlock = GameObject.Find("RedBlock").GetComponent <MovableBlock>(); blueBlock = GameObject.Find("BlueBlock").GetComponent <MovableBlock>(); exitDoor = GameObject.Find("ExitDoor"); }
public void SetActiveColor() { var block = BlockModel.Create(0, 0); var button = new BlockButton(block, Color.Black); // Act button.ActiveColor = Color.Red; // Assert Assert.AreEqual(button.ActiveColor, Color.Red); }
void Start() { health = 100; sound = Sound.Instance; canMove = true; block = BlockButton.Instance; player = Player.Instance; switcher = PlayerModelSwitcher.Instance; joystick = VirtualJoystick.Instance; calculatedDamage = (int)(900.0f / ((float)player.Armor)); calculatedLifesteal = ((int)(player.Damage * (player.Lifesteal) * .3)); Debug.Log(calculatedLifesteal); }
} //END BlockButtonGazeExit //---------------------------------// public void BlockButtonSelected( BlockButton blockButton ) //---------------------------------// { //Inform other blocks that a button has been selected if( blocks != null && blocks.Count > 0 ) { foreach( Block block in blocks ) { block.BlockButtonSelected( blockButton ); } } } //END BlockButtonSelected
} //END SetBlockButtonColliders //--------------------------------// public void BlockButtonGazeEnter( BlockButton blockButton ) //--------------------------------// { if( blocks != null && blocks.Count > 0 ) { foreach( Block block in blocks ) { if( block != null ) { block.BlockButtonGazeEnter( blockButton ); } } } } //END BlockButtonGazeEnter
} //END BlockButtonGazeEnter //--------------------------------------------// /// <summary> /// Called by a BlockButton when the Gaze system has exited its collider, passes this message down to the Blocks contained within /// </summary> /// <param name="blockButton">The Block Button that the gaze system has exited</param> public void BlockButtonGazeExit( BlockButton blockButton ) //--------------------------------------------// { //Inform all other blocks that a button has been gazed at if( blockViews != null && blockViews.Count > 0 ) { foreach( BlockView blockView in blockViews ) { if( blockView != null ) { blockView.BlockButtonGazeExit( blockButton ); } } } } //END BlockButtonGazeExit
} //END BlockButtonGazeExit //--------------------------------------------// /// <summary> /// Called by a BlockButton it has been selected by the player, passes this message down to the Blocks contained within /// </summary> /// <param name="blockButton">The Block button that was selected</param> public void BlockButtonSelected( BlockButton blockButton ) //--------------------------------------------// { //Inform all other blocks that any button has been selected if( blockViews != null && blockViews.Count > 0 ) { foreach( BlockView blockView in blockViews ) { if( blockView != null ) { blockView.BlockButtonSelected( blockButton ); } } } } //END BlockButtonSelected
} //END OtherBlockButtonSelected //---------------------------------// protected override void OtherBlockButtonGazeExit( BlockButton blockButton ) //---------------------------------// { //If we've requested playback due to the BlockButton being selected, but the AudioClip is still loading, then we set the 'playRequested' flag to true and begin playback when the AudioClip becomes ready //However if we exit the BlockButton before the AudioClip has a chance to begin playback, then we set the 'playRequested' flag to false if( playRequested ) { if( activateOnBlockButtonSelect && IsBlockButtonNotNull() ) { if( foundEventTriggerOnBlockButtonCollider && blockGroup.IsInGroup( blockButton ) ) { playRequested = false; } } } } //END OtherBlockButtonGazeExit
void ReleaseDesignerOutlets() { if (BlockButton != null) { BlockButton.Dispose(); BlockButton = null; } if (ParallelButton != null) { ParallelButton.Dispose(); ParallelButton = null; } if (PoolButton != null) { PoolButton.Dispose(); PoolButton = null; } }
/* * Метод для добавления объектов в таблице */ private void CreateButtons() { Random rand = new Random(unchecked ((int)DateTime.Now.Ticks)); //проверка на существующие объекты if (Table.Children.Count == 0) { int treeIndex = 0; //цикл, по которому сгенерированные данные добавляются в кнопку и размещаются в таблице foreach (var data in model.NumberForButtons) { BlockButton button = new BlockButton() { Content = rand.Next(0, 5000), Height = 40, Opacity = 0.7d, BorderThickness = new Thickness(1, 1, 1, 1), StartTime = data.Item1, Width = data.Item2 - data.Item1, Background = new SolidColorBrush(Color.FromRgb((byte)rand.Next(256), (byte)rand.Next(256), (byte)rand.Next(256))), EndTime = data.Item2, Row = data.Item3 }; button.Click += Button_Click1; model.Tree.Insert(treeIndex, button); //задаем верхнюю левую точку объекта на полотне Canvas.SetTop(model.Tree.Last().Value, data.Item3); Canvas.SetLeft(model.Tree.Last().Value, data.Item1); Table.Children.Add(model.Tree.Last().Value); treeIndex++; } } else { //Если объекты уже существуют Table.Children.Clear(); //количетсво существующих объектов int countExistElem = model.Tree.Count(); //количество новых объектов int countNewElem = model.NumberForButtons.Count; //разница между количеством существующих и новых элементов int difference = countNewElem - countExistElem <= 0 ? 0 : countNewElem - countExistElem; //если новых объектов больше if (countExistElem < countNewElem) { //добавляем недостающее количество в дерево while (countExistElem != countNewElem) { model.Tree.Insert(countExistElem, new BlockButton()); countExistElem++; } } //иначе else if (countExistElem > countNewElem) { //удаляем из дерева лишнии while (countExistElem != countNewElem) { countExistElem--; model.Tree.Delete(countExistElem); } } //цикл, по которому идет переопределение данных и вывод объектов в таблицу for (int i = 0; i < model.Tree.Count(); i++) { model.Tree.ElementAt(i).Value.Content = rand.Next(0, 5000); model.Tree.ElementAt(i).Value.StartTime = model.NumberForButtons[i].Item1; model.Tree.ElementAt(i).Value.Width = model.NumberForButtons[i].Item2 - model.NumberForButtons[i].Item1; model.Tree.ElementAt(i).Value.EndTime = model.NumberForButtons[i].Item2; model.Tree.ElementAt(i).Value.Row = model.NumberForButtons[i].Item3; model.Tree.ElementAt(i).Value.Height = 40; model.Tree.ElementAt(i).Value.Opacity = 0.7d; model.Tree.ElementAt(i).Value.BorderThickness = new Thickness(1, 1, 1, 1); model.Tree.ElementAt(i).Value.EndTime = model.NumberForButtons[i].Item2; model.Tree.ElementAt(i).Value.Row = model.NumberForButtons[i].Item3; //проверка на новые объекты. Если в дерево нужно было добавить новые объекты, //то только для них нужно определить метод для ивента click if (model.Tree.Count() - difference == i && difference != 0) { model.Tree.ElementAt(i).Value.Click += Button_Click1; difference--; } model.Tree.ElementAt(i).Value.Background = new SolidColorBrush(Color.FromRgb((byte)rand.Next(256), (byte)rand.Next(256), (byte)rand.Next(256))); //задаем верхнюю левую точку объекта на полотне Canvas.SetTop(model.Tree.ElementAt(i).Value, model.NumberForButtons[i].Item3); Canvas.SetLeft(model.Tree.ElementAt(i).Value, model.NumberForButtons[i].Item1); Table.Children.Add(model.Tree.ElementAt(i).Value); } } }
protected virtual void OtherBlockButtonGazeExit( BlockButton otherBlockButton ) { }
protected virtual void OtherBlockButtonSelected( BlockButton otherBlockButton ) { }
void Start() { yellowButton = GameObject.Find("YellowButton").GetComponent <BlockButton>(); redButton = GameObject.Find("RedButton").GetComponent <BlockButton>(); blueButton = GameObject.Find("BlueButton").GetComponent <BlockButton>(); }