예제 #1
0
        } //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
예제 #2
0
파일: Block.cs 프로젝트: contrejo27/Jose
        //---------------------------------------------------//
        /// <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
예제 #3
0
파일: Block.cs 프로젝트: contrejo27/Jose
        //---------------------------------//
        /// <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
예제 #4
0
파일: Block.cs 프로젝트: contrejo27/Jose
        } //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
예제 #5
0
 private static bool Prefix(ref BlockButton ___button_ChangeDirection)
 {
     if (MyInput.GetButton("Sprint"))
     {
         MoreSailsMoreSpeed.ToggleAllEnginesDir();
         return(false);
     }
     return(true);
 }
예제 #6
0
 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;
 }
예제 #7
0
        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;
 }
예제 #9
0
 // 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");
 }
예제 #10
0
        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);
        }
예제 #11
0
 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);
 }
예제 #12
0
        } //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
예제 #13
0
        } //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
예제 #14
0
        } //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
예제 #15
0
        } //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
예제 #16
0
        } //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
예제 #17
0
        void ReleaseDesignerOutlets()
        {
            if (BlockButton != null)
            {
                BlockButton.Dispose();
                BlockButton = null;
            }

            if (ParallelButton != null)
            {
                ParallelButton.Dispose();
                ParallelButton = null;
            }

            if (PoolButton != null)
            {
                PoolButton.Dispose();
                PoolButton = null;
            }
        }
예제 #18
0
        /*
         * Метод для добавления объектов в таблице
         */
        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);
                }
            }
        }
예제 #19
0
파일: Block.cs 프로젝트: contrejo27/Jose
 protected virtual void OtherBlockButtonGazeExit( BlockButton otherBlockButton ) { }
예제 #20
0
파일: Block.cs 프로젝트: contrejo27/Jose
 protected virtual void OtherBlockButtonSelected( BlockButton otherBlockButton ) { }
예제 #21
0
 void Start()
 {
     yellowButton = GameObject.Find("YellowButton").GetComponent <BlockButton>();
     redButton    = GameObject.Find("RedButton").GetComponent <BlockButton>();
     blueButton   = GameObject.Find("BlueButton").GetComponent <BlockButton>();
 }