Beispiel #1
0
 /// <summary>
 /// Tests level as the player.
 /// </summary>
 public static void TestLevel()
 {
     if (TMBAW_Game.CurrentGameMode != GameMode.Play && _switchEditAndPlayTimer.TimeElapsedInMilliSeconds > 1000)
     {
         try
         {
             SaveLevel();
             GameWorld.IsTestingLevel   = true;
             GameWorld.PlayerTrail      = new PlayerTrail();
             TMBAW_Game.CurrentGameMode = GameMode.Play;
             GameWorld.PrepareLevelForTesting();
             foreach (Player player in GameWorld.GetPlayers())
             {
                 player.ComplexAnimation.RemoveAllFromQueue();
                 player.SetVelX(0);
                 player.SetVelY(0);
             }
             Overlay.FlashWhite();
             _switchEditAndPlayTimer.Reset();
             _testSound.Play();
             Cursor.Hide();
             // DataFolder.PlayLevel(DataFolder.CurrentLevelFilePath);
         }
         catch (Exception e)
         {
             TMBAW_Game.MessageBox.Show(e.Message);
         }
     }
 }
Beispiel #2
0
        public static void ReplaceHotBarWithMiddleMouse(TileHolder tileHolder, TileType newId)
        {
            _deletedTile = new TileHolder(tileHolder.Id);
            _deletedTile.SetPosition(tileHolder.GetPosition());
            _deletedTile.MoveTo(new Vector2(_deletedTile.GetPosition().X, -_deletedTile.DrawRectangle.Height), 200);

            tileHolder.ChangeId(newId);
            tileHolder.SetPosition(tileHolder.GetPosition().X, -tileHolder.DrawRectangle.Height);
            tileHolder.ReturnToDefaultPosition();

            _swipeSound.Play();
        }
Beispiel #3
0
 void Update()
 {
     if (status.status == 1)
     {
         float fov = Camera.main.fieldOfView;
         fov -= Input.mouseScrollDelta.y * sensitivity;
         fov  = Mathf.Clamp(fov, minFov, maxFov);
         Camera.main.fieldOfView = fov;
         if (fov == minFov)
         {
             //Cat.SetFloat("Action", 1);
             status.status = 2;
             cursorController.SetScrollHint(false);
             findSomethingSound.Play();
         }
     }
     if (status.status == 2)
     {
         float fov = Camera.main.fieldOfView;
         fov -= Input.mouseScrollDelta.y * sensitivity;
         fov  = Mathf.Clamp(fov, minFov, maxFov);
         Camera.main.fieldOfView = fov;
         if (fov >= Jay)
         {
             Camera.main.fieldOfView = Jay;
             status.status           = 3;
         }
     }
 }
Beispiel #4
0
        /// <summary>
        /// Replace the tile in the hot bar with the tile hovered above it.
        /// </summary>
        /// <param name="tileHolder"></param>
        public static void ReplaceHotBar(TileHolder tileHolder)
        {
            for (int i = 0; i < _tileHolders.Count; i++)
            {
                if (tileHolder.IsIntersectingWithSlotOf(_tileHolders[i]))
                {
                    // It's all an optical illusion. The tile in the hot bar replaces the tile being moved, and a temporary tile is created to animate the deletion of the tile in the hotbar.

                    _deletedTile = new TileHolder(_tileHolders[i].Id);
                    _deletedTile.SetPosition(_tileHolders[i].GetPosition());
                    _deletedTile.MoveTo(new Vector2(_deletedTile.GetPosition().X, -_deletedTile.DrawRectangle.Height), 200);

                    _tileHolders[i].ChangeId(tileHolder.Id);
                    _tileHolders[i].SetPosition(tileHolder.GetPosition());
                    _tileHolders[i].ReturnToDefaultPosition();

                    tileHolder.SetPosition(TMBAW_Game.UserResWidth, TMBAW_Game.UserResHeight);
                    tileHolder.ReturnToDefaultPosition(500);

                    _swipeSound.Play();
                    _replaceSound.Play();
                    return;
                }
            }
            TileHolder.ReturnSound.Play();
        }
Beispiel #5
0
 private void TimePunchFireProjectile(FrameArgs e)
 {
     if (e.CurrentFrame == 1)
     {
         ProjectileSystem.Add(new BlueBlastProjectile(_player));
         _timeGunFireSound.Play();
         _player.ComplexAnimation.FrameChanged -= TimePunchFireProjectile;
     }
 }
Beispiel #6
0
        /// <summary>
        /// Default behavior for when the button is hovered. Override this method to remove default sound effects and color changes.
        /// </summary>
        protected virtual void OnMouseHover()
        {
            if (!_mouseIsOver)
            {
                CursorSound?.Play();
                _mouseIsOver = true;
            }

            CurrentColor = new Color(Color.R - 50, Color.G - 50, Color.B - 50);
        }
Beispiel #7
0
        /// <summary>
        ///     Shows a message to the user in a message box with an OK button.
        /// </summary>
        /// <param name="message"></param>
        public virtual void Show(string message)
        {
            Window.Show();
            _showSound.Play();
            Button.MouseClicked += Button_MouseClicked;
            var wrapped = FontHelper.WrapText(Font, message, Window.DrawRectangle.Width - BezelSize * 2);

            Message  = wrapped;
            IsActive = true;
        }
Beispiel #8
0
 public override void MoveTo(Vector2 position, int duration)
 {
     if (_oldPosition != position && _playSound)
     {
         _swooshSound.Play();
         _oldPosition = position;
     }
     position.X -= 12;
     position.Y -= 16;
     base.MoveTo(position, duration);
 }
Beispiel #9
0
 /// <summary>
 /// Does the animation for spell casting.
 /// </summary>
 private void CastSpell()
 {
     if (!castingSpell)
     {
         castingSpell = true;
         Entity.AddAnimationToQueue("castSpell");
         castingSpellTimer.ResetAndWaitFor(3000);
         castingSpellTimer.SetTimeReached += CastingSpellTimer_SetTimeReached;
         spawnSound.Play();
         laughSound.Play();
     }
 }
Beispiel #10
0
        public override void OnPlayerAction(Tile tile, Player player)
        {
            if (!_broken)
            {
                _breakSound.Play();
                _broken = true;
                Gem.GenerateIdentical(_gemId, _sourceTile, TMBAW_Game.Random.Next(4, 8));
                tile.IsHidden = true;
            }

            base.OnPlayerAction(tile, player);
        }
Beispiel #11
0
 private void TileHolder_WasClicked(TileHolder tile)
 {
     if (CanBeMoved && _wasMouseReleased)
     {
         _pickUpSound.Play();
         _isBeingMoved     = true;
         _wasMouseReleased = false;
         Rectangle mouse = InputSystem.GetMouseInUi();
         float     x     = mouse.X - Position.X;
         float     y     = mouse.Y - Position.Y;
         _mouseDifferential = new Vector2(x, y);
     }
 }
Beispiel #12
0
 void OnMouseDown()
 {
     if (Sta.status == 3)
     {
         GetComponent <Rigidbody>().velocity        = Roll;
         GetComponent <Rigidbody>().angularVelocity = Angular;
         Sta.status = 4;
         Invoke("CatRunOutOfWashingMachine", catRunOutDelay);
     }
     else
     {
         GetComponent <Rigidbody>().AddForce(Vector3.up * F, ForceMode.Impulse);
         ballJumpSound.Play();
     }
 }
        public Snapshot StartRewind()
        {
            IsRewinding = true;
            tracker     = new Tracker();
            TMBAW_Game.TimeFreeze.AddFrozenTime(1000);
            Overlay.ActivateRewindEffect();
            _startSound.Play();
            _stopSound.Play();

            if (snapshots.Count == 0)
            {
                return(new Snapshot());
            }
            return(snapshots[0]);
        }
Beispiel #14
0
 // Update is called once per frame
 void OnMouseUp()
 {
     y = Input.mousePosition.x;
     z = x - y;
     q = y - x;
     if (z >= Distance && Status.status == 0)
     {
         DoorMovement.SetBool("MoveDoor", true);
         Status.status = 1;
         cursorController.SetScrollHint(true);
         doorOpenSound.Play();
     }
     if (q >= Distance && Status.status == 5)
     {
         DoorMovement.SetBool("MoveDoor", false);
     }
 }
Beispiel #15
0
 void OnMouseUp()
 {
     if (trigger.Bill == this.GetComponent <BoxCollider>() && (Status.status == 1 || Status.status == 3))
     {
         //GetComponent<Rigidbody>().velocity = Vector3.zero;
         transform.position = new Vector3(0, 1, -1);
         GetComponent <Rigidbody>().velocity = new Vector3(0, 0, -1) * F;
     }
     else if (trigger.Bill == this.GetComponent <BoxCollider>() && (Status.status == 4))
     {
         transform.position = new Vector3(0, 0.8f, -0.7f);
         Status.status      = 5;
         clothesFallSound.Play();
         washingMachineWorkSound.Play();
     }
     else
     {
         GetComponent <Rigidbody>().velocity = Vector3.zero;
         transform.position = new Vector3(0, 0, -3);
     }
     bill.gameObject.SetActive(false);
     trigger.Bill = null;
 }
Beispiel #16
0
 /// <summary>
 /// Determines what happens to this entity when it jumps on another entity.
 /// </summary>
 /// <param name="other"></param>
 public virtual void OnJumpOnAnotherEntity(Entity other)
 {
     jumpOnEntitySound.Play();
     SetVelY(MushroomBooster.WeakBoost);
     SetY(other.GetCollRectangle().Y - GetCollRectangle().Height);
 }
Beispiel #17
0
 private void OnMouseClicked(Button button)
 {
     ConfirmSound.Play();
 }