// Float variable declared to wait until the time to spawn the next ducks.
    // public static float spawnTime = 0;

    // Use this for initialization
    void Start()
    {
        //Abhi's Part
        m_Test = GetComponent <GunSelection_Controller>();
        m_Gun  = m_Test.m_GetGunNumber();

        // Invokes DuckMovement repeatedly until the duck is dead or shot.
        InvokeRepeating("duckMovement", 0.5f, 0.3f);
    }
Exemple #2
0
    // Choice of gun.

    // Use this for initialization.
    void Start()
    {
        Debug.Log("Begin");
        m_GunSound       = GetComponent <AudioSource>();
        m_Test           = GetComponent <GunSelection_Controller>();
        this.m_Gun       = m_Test.m_GetGunNumber();
        m_SpriteRenderer = GetComponent <SpriteRenderer>();
        Cursor.visible   = false;

        // Test gun selection.
        Debug.Log("Gun: " + this.m_Gun);

        if (this.m_Gun == 1)
        {
            m_SpriteRenderer.sprite = m_MySprite1;
            this.m_SpriteRenderer.transform.localScale -= new Vector3(0.01f, 0.01f, 0f);
            numBullets = 30;
        }
        else if (this.m_Gun == 2)
        {
            m_SpriteRenderer.sprite = m_MySprite2;
            this.m_SpriteRenderer.transform.localScale += new Vector3(0.03f, 0.03f, 0f);
            numBullets = 45;
        }
        else if (this.m_Gun == 3)
        {
            m_SpriteRenderer.sprite = m_MySprite3;
            this.m_SpriteRenderer.transform.localScale += new Vector3(0.04f, 0.04f, 0f);
            numBullets = 60;
        }
        else
        {
            m_SpriteRenderer.sprite = m_MySprite3;
            this.m_SpriteRenderer.transform.localScale += new Vector3(0.9f, 0.9f, 0f);
            numBullets = 500;
        }

        /*
         * Vector2 point = new Vector2();
         * point = Camera.main.ScreenToWorldPoint(new Vector2(Screen.width, Screen.height));
         * Debug.Log("World: " + point.ToString());*/
        // The commented code is for Chiru's reference.
    }