Пример #1
0
        void Update()
        {
            if (Input.GetButtonDown("LayerUp") && m_currentLayer < 3)
            {
                m_currentLayer++;

                playerTransform.position = new Vector3(playerTransform.position.x, playerTransform.position.y + 10, playerTransform.position.z);

                m_cl.SetLayerRecursively(gameObject, SelectLayer());
                UpdateRenderLayers(m_currentLayer);

                // Set an amount for shield for when the player changes layer.
                m_pd.SetShieldStatus(1);
            }

            else if (Input.GetButtonDown("LayerDown") && m_currentLayer > 1)
            {
                m_currentLayer--;

                playerTransform.position = new Vector3(playerTransform.position.x, playerTransform.position.y - 10, playerTransform.position.z);

                m_cl.SetLayerRecursively(gameObject, SelectLayer());
                UpdateRenderLayers(m_currentLayer);

                // Set an amount for shield for when the player changes layer.
                m_pd.SetShieldStatus(1);
            }
        }
Пример #2
0
    void Start()
    {
        m_player      = GameObject.FindWithTag("Player");
        m_changeLayer = GameObject.FindWithTag("GameController").GetComponent <ChangeLayerScript>();

        m_changeLayer.SetLayerRecursively(gameObject, m_player.layer);

        InvokeRepeating("Attack", 2, 6);
    }
Пример #3
0
    // Finds the y position of the object and uses that to determine what layer it should be on.
    void CheckLayer()
    {
        if (m_isElite == false)
        {
            if (transform.position.y == 0)
            {
                m_cl.SetLayerRecursively(gameObject, 10);

                m_sprite[0].SetActive(true);
            }
            else if (transform.position.y == 10)
            {
                m_cl.SetLayerRecursively(gameObject, 9);

                m_sprite[1].SetActive(true);
            }
            else if (transform.position.y == 20)
            {
                m_cl.SetLayerRecursively(gameObject, 8);

                m_sprite[2].SetActive(true);
            }
        }
    }
Пример #4
0
    void Start()
    {
        // Find and make reference to the scripts at start so they can be accessed later.
        m_pd = GameObject.FindWithTag("Player").GetComponent <PlayerDamageScript>();
        m_ps = GameObject.FindWithTag("Player").GetComponent <LK.PlayerShootingScript>();
        m_gc = GameObject.FindWithTag("GameController").GetComponent <GameControllerScript>();
        m_cl = GameObject.FindWithTag("GameController").GetComponent <ChangeLayerScript>();

        m_powerupRB = GetComponent <Rigidbody>();

        m_gc.activePowerups++;

        m_powerupRB.velocity = -transform.right * speed;

        m_timeCreated = Time.time;

        m_cl.SetLayerRecursively(gameObject, SelectLayer());
    }
Пример #5
0
        void OnEnable()
        {
            // When the bullet/rocket is enabled give it a velocity at the speed put in the forward direction.
            bulletRB = GetComponent <Rigidbody>();

            m_cl = GameObject.FindWithTag("GameController").GetComponent <ChangeLayerScript>();

            if (!isRocket)
            {
                m_cl.SetLayerRecursively(gameObject, SelectLayer());
                bulletRB.velocity = transform.right * speed;
            }
            else if (isRocket)
            {
                bulletRB.velocity = transform.up * speed;
            }
            // Set the time created to the current time when the script is started.
            timeCreated = Time.time;
        }