Пример #1
0
    //antigo StartNewForms(), mas agora só roda uma vez (até dá pra juntar com a SpinForms, mas preguiça)
    void StartForms()
    {
        previewSpawner.GetComponent<Renderer>().enabled = true;
        shadowPreviewSpawner.GetComponent<Renderer>().enabled = true;

        int index = Random.Range(0, forms.Length - 3);
        GameObject form = (GameObject) Instantiate(forms[index].form, formSpawner.position, Quaternion.identity);
        GameObject shadow = (GameObject) Instantiate(forms[index].shadow, shadowSpawner.position, Quaternion.identity);

        currentForm = form.GetComponent<Form>();
        currentShadow = shadow.transform;

        float maxAngle = currentForm.getMaxAngle();
        Vector3 rot = Vector3.zero;
        int normalizedAngle = (int) (maxAngle / rotationSpeed);    //O angulo é normalizado para ser múltiplo
        rot.z = Random.Range(-normalizedAngle, normalizedAngle) * rotationSpeed; //da velocidade de rotação
        currentShadow.Rotate(rot);

        currentForm.GetComponent<SpriteRenderer>().color = RandColor();
        timerAccretionScale = currentForm.getBaseTimeAccretion () / (fitOffset * 2);

        CreatePreviews();
    }
Пример #2
0
    private void CreatePlayButtonForm()
    {
        GameObject form = (GameObject)Instantiate(playForm.form, playButtonSpawner.position, Quaternion.identity);
        GameObject shadow = (GameObject)Instantiate(playForm.shadow, shadowSpawner.position, Quaternion.identity);
        currentForm = form.GetComponent<Form>();
        currentShadow = shadow.transform;

        float maxAngle = currentForm.getMaxAngle();
        Vector3 rot = Vector3.zero;
        int normalizedAngle = (int)(maxAngle / rotationSpeed);    //O angulo é normalizado para ser múltiplo
        rot.z = Random.Range(-normalizedAngle, normalizedAngle) * rotationSpeed; //da velocidade de rotação
        currentShadow.Rotate(rot);

        timerAccretionScale = currentForm.getBaseTimeAccretion() / (fitOffset * 2);
    }