Exemplo n.º 1
0
        //
        private void Start()
        {
            hitObj = new GameObject("tempLaser");
            hitObj.AddComponent <BoxCollider2D>().isTrigger = true;

            if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)
            {
                mobile = true;
            }
            else if (GameManager.Mobile)
            {
                mobile = true;
            }
            else
            {
                mobile = false;
            }
            if (enableAmmo)
            {
                _ammo = AmmoText.GetComponent <Ammo>();
            }
            holder       = GetComponentInParent <weaponHolder>();
            trigger      = GameManager._gameManager.shootOptions.shootTrigger;
            rt           = GameManager.fRt;
            m_Button     = GameManager._gameManager.shootOptions.shootButton.GetComponent <ShootButton>(); // Instance to RectTransform selected in GameManager,
            PlayerLasers = new GameObject("Player Lasers");                                                // create parent GameObject;
            PlayerLasers.transform.parent = GameManager._gameManager.PoolParent.transform;
            // Instantiate Lasers and add them to lasers list
            for (int i = 0; i < maxLasersAmount; i++)
            {
                GameObject las = Instantiate(laser);
                las.transform.parent = PlayerLasers.transform;
                las.SetActive(false);
                lasersPool.Add(las);
            }
            if (Poof)
            {
                PlayerPuffs = new GameObject("Player puffs"); // create parent GameObject;
                for (int i = 0; i < maxPuffAmount; i++)       // Instantiate Pufs and add them to puffs list
                {
                    GameObject puf = Instantiate(Puff);
                    puf.transform.parent = PlayerPuffs.transform;
                    puf.SetActive(true);

                    puf.SetActive(false);
                    Puffs.Add(puf);
                }
            }
            if (ImpactEffect)
            {
                PlayerImpactEffect = new GameObject("Player Impact Effect"); // create parent GameObject;
                for (int i = 0; i < maxImpactAmount; i++)                    // Instantiate Impact Effects and add them to effects list
                {
                    GameObject eff = Instantiate(Effect);
                    eff.transform.parent = PlayerImpactEffect.transform;
                    eff.SetActive(true);
                    eff.SetActive(false);
                    ImpactEffects.Add(eff);
                }
            }
            camShake = GameManager._gameManager.mainCamera.GetComponent <CameraShake>();
        }