// Use this for initialization void Start() { objPool = GetComponent <ObjectPoolerScript>(); Player = GameObject.Find("Player"); InvokeRepeating("ShootToward", 1, 0.35f); }
void Awake() { bulletHitParticlesPooler = GameObject.Find("Bullet Hit Particles").GetComponent<ObjectPoolerScript>(); if (playerControlled) { } else { soldierScript = GetComponentInParent<Soldier>(); } audioSource = GetComponent<AudioSource> (); gunLine = GetComponent<LineRenderer> (); targetCircle = GameObject.Find("circle (outline)").transform; timer = 60/firingRPM; if (timer > 0.2f) effectsDisplayTime = 0.2f; else effectsDisplayTime = timer-0.1f; if(!hasLaser) { try{ transform.parent.FindChild("Laser").gameObject.SetActive(false);}catch{} } stealthScript = GameObject.FindGameObjectWithTag ("GameController").GetComponent<Stealth> (); shootNoise = audioSource.clip; }
void MakeInstance() { if (instance == null) { instance = this; } }
public IEnumerator Start() { // cache object gameObject, transform and renderer myGo = gameObject; myTr = transform; mySpriteRdr = myTr.GetComponent <SpriteRenderer>(); //cam = Camera.main; player = GameObject.FindWithTag("Player"); playerScript = player.GetComponent <PlayerScript>(); yield return(null); if (mySpriteRdr.isVisible == false) { OnBecameInvisible(); } GameObject impactPoolGO = GameObject.Find("ObjectPool Impacts"); impactPool = impactPoolGO.GetComponent <ObjectPoolerScript>() as ObjectPoolerScript; GameObject napalmPoolGO = GameObject.Find("ObjectPool PlayerNapalm"); napalmPool = napalmPoolGO.GetComponent <ObjectPoolerScript>() as ObjectPoolerScript; StartCoroutine(Prepare()); }
// Use this for initialization void Awake() { Player = this; if (objPool == null) { objPool = gameObject.GetComponent <ObjectPoolerScript>(); } }
// Use this for initialization void Start() { pooler = GameObject.FindObjectOfType <ObjectPoolerScript>(); playerCtrl = FindObjectOfType <PlayerControllerScript>(); uiCtrl = FindObjectOfType <UIControllerScript>(); spawnedEnemyList = new List <EnemyControllerScript>(); earnedCurrency = 200f; }
void Awake() { if(weaponTypeFromObjectPoolList == null) { weaponTypeFromObjectPoolList = GameObject.Find("Cannon Shot Pooler"); } cannonShotPoolerScript = weaponTypeFromObjectPoolList.GetComponent<ObjectPoolerScript> (); }
IEnumerator Spawn(ObjectPoolerScript objPool, Vector2 position, float time) { yield return(new WaitForSeconds(time)); GameObject NewEnemy = objPool.GetPooledObject(); NewEnemy.SetActive(true); NewEnemy.transform.position = position; }
void Awake() { theFirer = this.transform.parent.parent.gameObject; if(weaponTypeFromObjectPoolList == null) { weaponTypeFromObjectPoolList = GameObject.Find("Cannon Shot Pooler"); } cannonShotPoolerScript = weaponTypeFromObjectPoolList.GetComponent<ObjectPoolerScript> (); }
void Awake() { if(instance == null) { instance = this; } else Destroy(gameObject); explosionPoolerScript = GameObject.FindGameObjectWithTag ("ObjectPooler").transform.FindChild ("Explosion Pooler").GetComponent<ObjectPoolerScript> (); explosionMiniPoolerScript = GameObject.FindGameObjectWithTag ("ObjectPooler").transform.FindChild ("ExplosionMini Pooler").GetComponent<ObjectPoolerScript> (); if(GameObject.FindGameObjectWithTag("PlayerFighter") == null) { if(playerUI != null) playerUI.SetActive(false); BGScroller[] scrollers = Camera.main.GetComponentsInChildren<BGScroller>(); foreach(BGScroller scroller in scrollers) { scroller.basedOnPlayer = false; } } if (PlayerPrefsManager.GetVibrateKey() == "true") { allowVibrationThisSession = true; allowVibrationToggleSwitch.isOn = true; } else if(PlayerPrefsManager.GetVibrateKey() == "false") { allowVibrationThisSession = false; allowVibrationToggleSwitch.isOn = false; } else if(PlayerPrefsManager.GetVibrateKey() == "") { allowVibrationThisSession = allowVibrationToggleSwitch.isOn; if(allowVibrationThisSession) PlayerPrefsManager.SetVibrateKey("true"); else PlayerPrefsManager.SetVibrateKey("false"); } else { print(PlayerPrefsManager.GetVibrateKey()); Debug.LogError("Vibrate Key wasn't blank, true, or false. Something has set it incorrectly. Resetting.."); PlayerPrefsManager.SetVibrateKey(""); } }
public void Start() { explosionPool = GameObject.Find("ObjectPool EnemyExplosions").GetComponent <ObjectPoolerScript>(); coinPool = GameObject.Find("ObjectPool ItemCoins").GetComponent <ObjectPoolerScript>(); weaponPool = GameObject.Find("ObjectPool EnemyBullets").GetComponent <ObjectPoolerScript>(); // cache object components myTr = transform; mySpriteRdr = mySpriteTr.GetComponent <SpriteRenderer>(); // cache player components player = GameObject.FindWithTag("Player"); playerScript = player.GetComponent <PlayerScript>(); playerTr = player.transform; }
public void Start() { explosionPool = GameObject.Find("ObjectPool EnemyExplosions").GetComponent <ObjectPoolerScript>(); coinPool = GameObject.Find("ObjectPool ItemCoins").GetComponent <ObjectPoolerScript>(); // cache object transform and renderer myTr = transform; mySpriteRdr = myTr.GetComponent <SpriteRenderer>(); playerScript = GameObject.FindWithTag("Player").GetComponent <PlayerScript>(); // Set "basePosY" value to object Y position basePosY = myTr.position.y; StartCoroutine(DisableCollider()); }
void Start() { m_comboCount = 0; m_humanPool = GameObject.Find("HumanPool").GetComponent <ObjectPoolerScript>(); m_obstaclePool = GameObject.Find("ObstaclePool").GetComponent <ObjectPoolerScript>(); m_helperPool = GameObject.Find("HelperPool").GetComponent <ObjectPoolerScript>(); m_earth = GameObject.Find("Earth"); m_earth.GetComponent <Rigidbody>().angularDrag = GameDatabase.Instance().GetInitData("RotationAcceleStop"); m_sunAtk = GameDatabase.Instance().GetInitData("SunAtk"); m_sunRStart = GameDatabase.Instance().GetInitData("SunRangeStart"); m_sunREnd = GameDatabase.Instance().GetInitData("SunRangeEnd"); m_earthSpeed = 1f; m_stageNumber = 1; humanCount = 0; StageStart(); }
// Use this for initialization void Awake() { op = this; foreach (PooledGameObject pooledGO in pooledGOs) { objectPrefabDic.Add(pooledGO.gameObjectType, pooledGO.prefab); List <GameObject> pooledObjects = new List <GameObject>(); for (int i = 0; i < pooledGO.pooledAmount; i++) { GameObject obj = (GameObject)Instantiate(pooledGO.prefab); obj.SetActive(false); pooledObjects.Add(obj); } pooledObjectsDic.Add(pooledGO.gameObjectType, pooledObjects); } }
void Awake () { asteroidPoolerScript = GameObject.Find ("asteroid Pooler").GetComponent<ObjectPoolerScript> (); asteroidPoofPoolerScript = GameObject.Find ("asteroidPoof Pooler").GetComponent<ObjectPoolerScript> (); myRigidbody = GetComponent<Rigidbody2D> (); myCollider = GetComponent<Collider2D>(); myRenderer = GetComponent<SpriteRenderer>(); allSizes = new AsteroidSize[]{AsteroidSize.Large, AsteroidSize.Medium, AsteroidSize.Small}; startingHealth = health; startingMass = myRigidbody.mass; startColor = myRenderer.color; coloringSpeed = Random.Range (10, 21); }
public void Start() { explosionPool = GameObject.Find("ObjectPool EnemyExplosions").GetComponent <ObjectPoolerScript>(); coinPool = GameObject.Find("ObjectPool ItemCoins").GetComponent <ObjectPoolerScript>(); upgradePool = GameObject.Find("ObjectPool ItemUpgrades").GetComponent <ObjectPoolerScript>(); // Determine Y direction of the pattern by checking "targetYDist" if (targetYDist < 0) { goUp = false; } else { goUp = true; } }
void Awake() { theFirer = this.transform.parent.parent.gameObject; if(weaponTypeFromObjectPoolList == null) { weaponTypeFromObjectPoolList = GameObject.Find("Cannon Shot Pooler"); } cannonShotPoolerScript = weaponTypeFromObjectPoolList.GetComponent<ObjectPoolerScript> (); rotateDirection = Random.Range (1, 3); if(rotateDirection == 2) rotateDirection = -1; if(manualControl) { manualCrosshairs = GameObject.FindGameObjectWithTag("CrosshairCursor"); manualCrosshairs.GetComponent<SpriteRenderer>().enabled = true; } }
public void Start() { explosionPool = GameObject.Find("ObjectPool EnemyExplosions").GetComponent <ObjectPoolerScript>(); coinPool = GameObject.Find("ObjectPool ItemCoins").GetComponent <ObjectPoolerScript>(); weaponPool = GameObject.Find("ObjectPool EnemyBullets").GetComponent <ObjectPoolerScript>(); // We cache components, this is usefull for performance optimisation ! myTr = transform; // We will now use "myTr" instead of "transform" myRb = rigidbody2D; mySpriteRdr = myTr.GetComponent <SpriteRenderer>(); myAnimator = myTr.GetComponent <Animator>(); // Player cached components player = GameObject.FindWithTag("Player"); playerTr = player.transform; playerScript = player.GetComponent <PlayerScript>(); // If enemy is upside-down (transform Z rotation = 180), inverse gravity ! myRb.gravityScale = myRb.gravityScale * myTr.up.y; StartCoroutine(DisableCollider()); }
public void Start() { explosionPool = GameObject.Find("ObjectPool EnemyExplosions").GetComponent <ObjectPoolerScript>(); coinPool = GameObject.Find("ObjectPool ItemCoins").GetComponent <ObjectPoolerScript>(); upgradePool = GameObject.Find("ObjectPool ItemUpgrades").GetComponent <ObjectPoolerScript>(); // cache object transform and renderer myTr = transform; mySpriteRdr = myTr.GetComponent <SpriteRenderer>(); player = GameObject.FindWithTag("Player"); playerScript = player.GetComponent <PlayerScript>(); playerTr = player.transform; // If the enemy hold an upgrade, give the user a visual hint ! if (giveUpgrade == true) { mySpriteRdr.color = upgradeHolderColor; } StartCoroutine(DisableCollider()); }
public void Start() { explosionPool = GameObject.Find("ObjectPool EnemyExplosions").GetComponent<ObjectPoolerScript>(); coinPool = GameObject.Find("ObjectPool ItemCoins").GetComponent<ObjectPoolerScript>(); // cache object transform and renderer myTr = transform; mySpriteRdr = myTr.GetComponent<SpriteRenderer>(); playerScript = GameObject.FindWithTag ("Player").GetComponent<PlayerScript>(); // Set "basePosY" value to object Y position basePosY = myTr.position.y; StartCoroutine(DisableCollider()); }
// Use this for initialization void Awake() { current = this; }
public virtual void Start() { PreStart (); explosionPool = GameObject.Find("ObjectPool EnemyExplosions").GetComponent<ObjectPoolerScript>(); upgradePool = GameObject.Find("ObjectPool ItemUpgrades").GetComponent<ObjectPoolerScript>(); weapons = new EnemyWeapon[weaponNames.Count]; for (int i = 0; i < weaponNames.Count; ++i) { GameObject weapon = GameObject.Find ("EnemyWeapon Container/EnemyWeapon " + weaponNames [i]); EnemyWeapon script = null; if(weapon == null) Debug.LogError("Can't find EnemyWeapon Container/EnemyWeapon " + weaponNames [i]); else script = weapon.GetComponent<EnemyWeapon>(); if(script == null) Debug.LogError("Can't get weapon for index " + i); weapons[i] = script; } mySpriteRdr = GetComponent<SpriteRenderer>(); myAnim = GetComponent<Animator> (); myTr = transform; if (myTr.parent != null && myTr.parent.GetComponent<EnemyGroup> () != null) group = myTr.parent.GetComponent<EnemyGroup> (); myRb = GetComponent<Rigidbody2D>(); if(myRb != null) myRb.gravityScale *= myTr.up.y; GameObject player = GameObject.FindWithTag ("Player"); playerScript = player.GetComponent<PlayerScript>(); playerTr = player.transform; gamePause = false; asleep = true; hp = maxHp; StartCoroutine(DisableCollider()); PostStart (); }
void Awake() { m_Pooler = this; }
void Awake() { current = this; }
private void Awake() { current = this; }
void Awake() { sharedInstance = this; }
protected override void PostStart() { upgradePool = GameObject.Find ("ObjectPool ItemUpgrades").GetComponent<ObjectPoolerScript> (); visibilityStart = false; }
public virtual IEnumerator Start() { PreStart (); myGo = gameObject; // cache object gameObject myTr = transform; // cache transform /***********************/ cam = Camera.main; camTr = cam.transform; /***********************/ GameObject player = GameObject.FindWithTag ("Player"); playerScript = player.GetComponent<PlayerScript>(); playerTr = player.transform; imageTr = playerScript.imgTr; myAnimator = myTr.GetComponent<Animator> (); // Get animator mySpriteRdr = myTr.GetComponent<SpriteRenderer>(); // Get sprite renderer if (mySpriteRdr != null) { mySpriteRdr.sortingOrder = layer; mySpriteRdr.color = color; } myTr.eulerAngles = new Vector3 (0, 0, rotation); GameObject impactPoolGO = GameObject.Find("ObjectPool Impacts"); impactPool = impactPoolGO.GetComponent<ObjectPoolerScript>() as ObjectPoolerScript; AudioSource mySource = myTr.GetComponent<AudioSource> (); if (mySource != null && mySource.clip != null) mySource.Play (); yield return null; if (mySpriteRdr != null && mySpriteRdr.isVisible == false) { OnBecameInvisible (); } else ready = true; PostStart (); }
void Awake() { asteroidPoolerScript = GameObject.Find ("asteroid Pooler").GetComponent<ObjectPoolerScript> (); asteroidField = GameObject.Find ("Asteroid Field").GetComponent<CircleCollider2D>(); asteroidCount = 0; }
private void Awake() { currentObjectPoolerScript = this; }
public void Start() { myTr = transform; mySpriteRdr = myTr.GetComponent<SpriteRenderer>(); playerScript = GameObject.FindWithTag ("Player").GetComponent<PlayerScript>(); // if (gameObject.activeInHierarchy) // gameObject.SetActive(false); explosionPool = GameObject.Find("ObjectPool EnemyExplosions").GetComponent<ObjectPoolerScript>(); //StartCoroutine(LateCall()); }