Example #1
0
    private bool CheckCircleButton(Circle circle, InputController.ButtonInput buttonInput)
    {
        if (circle == null)
        {
            return(false);
        }

        return(circle.button == buttonInput);
    }
Example #2
0
    // Start is called before the first frame update
    void Start()
    {
        circleSpawner = transform.parent.GetComponent <CircleSpawner>();
        speed         = circleSpawner.speed;
        spawnTime     = Time.time;
        image         = GetComponent <Image>();

        int i = Random.Range(0, 4);

        button = (InputController.ButtonInput)i;

        image.sprite = sprites[i];
        // StartCoroutine(MoveToPosition(transform, hitCircle.transform));
    }
Example #3
0
    private void ButtonInput(InputController.ButtonInput buttonInput)
    {
        if (openMenu == MenuType.NONE || !canClick)
        {
            return;
        }

        if (openMenu == MenuType.INTRO)
        {
            ShowMenu(MenuType.NONE);
            uIElements.SetActive(true);
            gameManager.StartGame();
            return;
        }

        gameManager.RestartGame();
    }
Example #4
0
    private void ButtonInput(InputController.ButtonInput buttonInput)
    {
        if (GetActiveCircle() == null || player == null)
        {
            return;
        }
        Circle circle = GetActiveCircle();

        float distance = Vector3.Distance(transform.position, circle.transform.position);

        float points = 0;

        if (distance < 5 && points == 0)
        {
            points = 300;
        }
        if (distance < 20 && points == 0)
        {
            points = 100;
        }
        if (distance < 90 && points == 0)
        {
            points = 50;
        }

        if (points > 0)
        {
            if (CheckCircleButton(circle, buttonInput))
            {
                player.Correct(points);
            }
            else
            {
                // DAMAGE

                player.Damage();
            }
        }
        else
        {
            // DAMAGE
            player.Damage();
        }

        Destroy(circle.gameObject);
    }