Exemple #1
0
    /// <summary>
    /// Callback for if the player doesn't get the target node in time
    /// </summary>
    public void FailedTarget(float _distance)
    {
        MyGameManager.NormalizeTime();
        Bomb  bomb        = SpawnBomb(bombPrefab, targetLocation);
        float offSetRange = 3f * (_distance + 0.15f);
        float x           = Random.Range(-offSetRange, offSetRange);
        float y           = Random.Range(-offSetRange, offSetRange);

        bomb.transform.Translate(x, y, 0f);
        shooting = false;

        foreach (Transform child in MyGameManager.TargettingNodes)
        {
            Destroy(child.gameObject);
        }

        TargettingLine.gameObject.SetActive(false);

        MyGameManager.IncreaseScore((int)((1f - _distance) * 10f));
        int resultText = 2;

        if (_distance > 0.8f)
        {
            resultText = 0;
        }
        else if (_distance > 0.5f)
        {
            resultText = 1;
        }
        ParticleText text = Instantiate(particleTextPrefab, textSpawnLocation.position, Quaternion.identity).GetComponent <ParticleText>();

        text.SetText(TargettingLineResults[resultText]);
        targetLocationCursor.Stop();
        finishTargetSound.Play();
    }
Exemple #2
0
    /// <summary>
    /// Callback for when the player selects the final node
    /// </summary>
    public void SuccessfulTarget()
    {
        SpawnBomb(bombPrefab, targetLocation);
        shooting = false;

        foreach (Transform child in MyGameManager.TargettingNodes)
        {
            Destroy(child.gameObject);
        }

        TargettingLine.gameObject.SetActive(false);

        MyGameManager.IncreaseScore(25);
        ParticleText text = Instantiate(particleTextPrefab, textSpawnLocation.position, Quaternion.identity).GetComponent <ParticleText>();

        text.SetText(TargettingLineResults[3]);
        targetLocationCursor.Stop();
        coolDownTimer = 0f;
        finishTargetSound.Play();
    }