Beispiel #1
0
    void CheckBomb()
    {
        if (GameInputManager.GetKeyDown("Bomb"))
        {
            if (bombCooldown < 1)
            {
                Bomb    boom   = Instantiate(bomb).GetComponent <Bomb>();
                Vector3 offset = Vector3.zero;
                switch (GetFacingDirection())
                {
                case 0:
                    offset = Vector3.up;
                    break;

                case 1:
                    offset = Vector3.right;
                    break;

                case 2:
                    offset = Vector3.down;
                    break;

                case 3:
                    offset = Vector3.left;
                    break;
                }
                boom.Move(offset + transform.position + new Vector3(0, -0.5f, 0));
                bombCooldown = 100;
            }
        }
    }
Beispiel #2
0
 void CheckBow()
 {
     if (GameInputManager.GetKeyDown("Bow"))
     {
         if (bowCounter < 1)
         {
             Projectile shot = Instantiate(projectile).GetComponent <Projectile>();
             shot.Move(transform.position);
             if (playerFacing.y > 0)
             {
                 shot.direction     = "Up";
                 transform.position = transform.position + new Vector3(0, -bowKnockback, 0);
             }
             else if (playerFacing.x > 0)
             {
                 shot.direction     = "Right";
                 transform.position = transform.position + new Vector3(-bowKnockback, 0, 0);
             }
             else if (playerFacing.y < 0)
             {
                 shot.direction     = "Down";
                 transform.position = transform.position + new Vector3(0, bowKnockback, 0);
             }
             else if (playerFacing.x < 0)
             {
                 shot.direction     = "Left";
                 transform.position = transform.position + new Vector3(bowKnockback, 0, 0);
             }
             bowCounter = 60;
         }
     }
 }
Beispiel #3
0
    void Action()
    {
        print("Holdable Object Hold");

        this.transform.position = GetComponent <CameraController>().Target.transform.position;

        if (GameInputManager.GetKeyDown("EndHold"))
        {
            MB_Interactions isInteract = GetComponent <MB_Interactions>();
            isInteract.StopInteract();
        }
    }
Beispiel #4
0
    // Update is called once per frame
    void Update()
    {
        // If the player makes a mistake zet the Oops bool to true to stop all processes
        if (GameManager.instance.HasLevelStarted && (GameManager.instance.levelManager.PlayerMissedCustomer || GameManager.instance.levelManager.PlayerMissedEmptyMug || GameManager.instance.levelManager.PlayerThrewExtraMug))
        {
            GameManager.instance.Oops = true;
        }

        // If the level has started and Tapper hasn't won or lost yet he can move
        if (GameManager.instance.HasLevelStarted && !GameManager.instance.Oops && animator.GetBool("hasLost") == false && animator.GetBool("hasWon") == false)
        {
            // Set Running Bool to False to prevent move animation
            IsRunning = false;

            // Set Hortizontal Input and Vertical Input (WASD and Arrows)
            horizontalInput = (int)Input.GetAxisRaw("Horizontal");
            verticalInput   = (int)Input.GetAxisRaw("Vertical");

            // Set bool for Pour and Serving using to GameInputManager
            pourPressed  = GameInputManager.GetKeyDown("Pour");
            servePressed = GameInputManager.GetKeyDown("Serve");

            // If moving stop filling bottle
            StopFillingBeerIfMoving(horizontalInput, verticalInput);

            // Attempt Move if pressing the Horizontal or Vertical Input
            AttemptMove(horizontalInput, verticalInput);

            // Set IsRunning Animator Bool the same as the current local IsRunning Bool
            animator.SetBool("isRunning", IsRunning);

            // Check if Player is at the Tap with this function
            CheckIfAtBarTap();

            // Flip the Sprite using the Horizontalinput
            FlipSpriteBasedOnHorizontalInput(horizontalInput);
        }

        // If level has started and the player made mistake Trigger The Lost Animation
        else if (GameManager.instance.HasLevelStarted && GameManager.instance.Oops && !GameManager.instance.OopsC)
        {
            TriggerLostAnimation();
            // Set OopsC to true to not retrigger the Lost Animation
            GameManager.instance.OopsC = true;
        }
    }
Beispiel #5
0
    void CheckAttack()
    {
        if (GameInputManager.GetKeyDown("Attack"))
        {
            if (attackCooldown < 1)
            {
                attackCounter  = 5;
                attackCooldown = 5;
            }
        }

        if (attackCounter > 0)
        {
            List <Collider2D> targets = attackBox.Collisions();
            foreach (Collider2D coll in targets)
            {
                if (coll.GetComponent <Interactable>() != null)
                {
                    coll.GetComponent <Interactable>().OnHit();
                    cam.PlayClip(hitNoises[0]);
                }
            }
        }
    }