Beispiel #1
0
        //
        private void Start()
        {
            holder = GetComponentInParent <weaponHolder>();
            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>();
            }
            trigger  = GameManager._gameManager.shootOptions.shootTrigger;
            rt       = GameManager.fRt;
            m_Button = GameManager._gameManager.shootOptions.shootButton.GetComponent <ShootButton>();

            player = GameManager._player;
            // Object Pooling for bullets;
            PlayerBullets = new GameObject("Player bullets"); // create parent GameObject;
            PlayerPuffs   = new GameObject("Player puffs");   // create parent GameObject;
            PlayerBullets.transform.parent = GameManager._gameManager.PoolParent.transform;
            PlayerPuffs.transform.parent   = GameManager._gameManager.PoolParent.transform;
            // Instantiate bullets and add them to bullets list
            for (int i = 0; i < maxBulletAmount; i++)
            {
                GameObject bullet = Instantiate(bulletPrefab);
                bullet.transform.parent = PlayerBullets.transform;
                bullet.SetActive(true);
                bullet.SetActive(false);
                bullets.Add(bullet);
            }
            // Object Pooling for Shells;
            PlayerShells = new GameObject("Player shells"); // create parent GameObject;
            PlayerShells.transform.parent = GameManager._gameManager.PoolParent.transform;
            // Instantiate Shells and add them to Shells list
            for (int i = 0; i < maxShellsAmount; i++)
            {
                GameObject shell = Instantiate(ShellPrefab);
                shell.transform.parent = PlayerShells.transform;
                shell.SetActive(true);
                shell.SetActive(false);
                Shells.Add(shell);
            }
            for (int i = 0; i < maxPuffAmount; i++)
            {
                GameObject puf = Instantiate(Puff);
                puf.transform.parent = PlayerPuffs.transform;
                puf.SetActive(true);
                puf.SetActive(false);
                Puffs.Add(puf);
            }
            camShake = GameManager._gameManager.mainCamera.GetComponent <CameraShake>();
        }
Beispiel #2
0
 //
 //Setting Start bools to false.
 void Start()
 {
     //startLight = false;
     //startFlamethrower = false;
     if (enableAmmo)
     {
         ammo = AmmoText.GetComponent <LauncherAmmo>();
     }
     if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)
     {
         mobile = true;
     }
     else if (GameManager.Mobile)
     {
         mobile = true;
     }
     else
     {
         mobile = false;
     }
     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,
     camShake = GameManager._gameManager.mainCamera.GetComponent <CameraShake>();
 }
Beispiel #3
0
 //
 private void Awake()
 {
     temp = new GameObject("Grenades");
     if (enableAmmo)
     {
         ammo = AmmoText.GetComponent <Ammo>();
     }
     holder   = GetComponentInParent <weaponHolder>();
     camShake = GameManager._gameManager.mainCamera.GetComponent <CameraShake>();
 }
Beispiel #4
0
        //
        void Start()
        {
            tr = new GameObject("temp");
            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>();
            }
            trigger  = GameManager._gameManager.shootOptions.shootTrigger;
            rt       = GameManager.fRt;
            m_Button = GameManager._gameManager.shootOptions.shootButton.GetComponent <ShootButton>();// Instance to RectTransform selected in GameManager,
            if (Poof)
            {
                PlayerPuffs = new GameObject("Player puffs"); // create parent GameObject;
                PlayerPuffs.transform.parent = GameManager._gameManager.PoolParent.transform;
                for (int i = 0; i < maxPuffAmount; i++)
                {
                    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;
                PlayerImpactEffect.transform.parent = GameManager._gameManager.PoolParent.transform;
                for (int i = 0; i < maxImpactAmount; i++)
                {
                    GameObject eff = Instantiate(Effect);
                    eff.transform.parent = PlayerImpactEffect.transform;
                    eff.SetActive(true);
                    eff.SetActive(false);
                    ImpactEffects.Add(eff);
                }
            }
            holder   = GetComponentInParent <weaponHolder>();
            camShake = GameManager._gameManager.mainCamera.GetComponent <CameraShake>();
        }
Beispiel #5
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>();
        }