Пример #1
0
    public void TransformPlayer()
    {
        // Update state and counter
        inTransition = true;
        state        = ((state == TransformationState.BULLET) ? TransformationState.TANK : TransformationState.BULLET);
        counter      = 0f;

        // Play transformation sound
        if (transSource)
        {
            transSource.Play();
        }

        // Apply screen distortion effect
        Invoke("ApplyDistortion", 0f);

        // Update camera logic current zoom based on current transformation state
        cameraLogic.SetZoom((state == TransformationState.BULLET) ? cameraLogic.InitZoom : tankZoom);

        // Disable and enable current character colliders
        for (int i = 0; i < bulletColls.Length; i++)
        {
            bulletColls[i].enabled = state == TransformationState.BULLET;
        }
        for (int i = 0; i < tankColls.Length; i++)
        {
            tankColls[i].enabled = state == TransformationState.TANK;
        }

        // Update interface manager transformation state
        if (interfaceManager)
        {
            interfaceManager.FacesState = ((state == TransformationState.BULLET) ? 3 : 1);
        }

        // Play current state particle system
        particles[(int)state].Play();

        // Enable all renderers for transition
        for (int i = 0; i < tankRenderer.Length; i++)
        {
            tankRenderer[i].enabled = true;
        }
        for (int i = 0; i < bulletRenderer.Length; i++)
        {
            bulletRenderer[i].enabled = true;
        }

        // Enable all transformations game objects
        for (int i = 0; i < bulletObjs.Length; i++)
        {
            bulletObjs[i].SetActive(true);
        }
        for (int i = 0; i < tankObjs.Length; i++)
        {
            tankObjs[i].SetActive(true);
        }
    }