public Dictionary <string, Queue <GameObject> > poolDict; //A dict so we can spawn a troop based on enemy troop name void Awake() { if (instance == null) { instance = this; } else { Destroy(this); } poolDict = new Dictionary <string, Queue <GameObject> >(); foreach (Pool pool in pools) { Queue <GameObject> objectPool = new Queue <GameObject>(); for (int i = 0; i < pool.size; i++) { GameObject obj = Instantiate(pool.prefab); if (obj.CompareTag("Bullet")) { obj.transform.parent = GameObject.Find("Bullets").transform; } obj.SetActive(false); objectPool.Enqueue(obj); } poolDict.Add(pool.name, objectPool); } }
private void Awake() { if (Instance == null) { Instance = this; } }
public GameObject CallingSpawnEnemy(EnemyType type) { Vector3 position = getRandomSpawnPosition(); EnemyPooler pool = EnemyPooler.Instance; return(pool.SpawnFromPool(type, position)); }
private void Start() { isAlive = true; currentHitPoints = hitPoints; rb = GetComponent <Rigidbody>(); pooler = EnemyPooler.Instance; player = FindObjectOfType <PlayerController>(); dropManager = DropManager.Instance; }
// Start is called before the first frame update void Start() { locked = false; doors = gameObject.GetComponent <Tilemap>(); MainCamera = GameObject.Find("Camera"); grid = MainCamera.GetComponent <GridMap>(); RoomMap = GameObject.Find("Camera").GetComponent <Roomsetup>(); enemyPooler = GameObject.Find("EnemyPooler").GetComponent <EnemyPooler>(); }
private void Start() { spellMana = GameObject.Find("RightHand").GetComponent <Spellcasting>(); enemyPooler = GameObject.Find("Enemies").GetComponent <EnemyPooler>(); explosionNoise = explosionEffect.GetComponent <AudioSource>(); rb = this.gameObject.GetComponent <Rigidbody>(); bridgePuzzleVar = GameObject.Find("BridgeAnchors").GetComponent <bridgePuzzle>(); gatePuzzle = GameObject.Find("Fortress Gate").GetComponent <KeyGatePuzzle>(); }
void Start() { // set health to 100 Health = 100; // set numeric health indicator's value to health value HealthBarIndicator.GetComponent <TextMesh>().text = Health.ToString(); //DiamondResourcesCount = 0; //GoldResourcesCount = 0; //BricksResourcesCount = 0; enemyPool = EnemyPooler.Instance; }
public void SpawnEnemy() { LevelManager manager = LevelManager.Instance; EnemyPooler pool = EnemyPooler.Instance; foreach (EnemyAmount eAmount in _enemyAmounts) { for (int i = 0; i < eAmount.Amount; i++) { Vector3 position = manager.getRandomSpawnPosition(); pool.SpawnFromPool(eAmount.Type, position); } } gameObject.SetActive(false); }
public void AwakeGeneralGameStatePoolers() { Data.ObjectPoolersHolder = this; BattleUnitPooler.AwakePooler(); RoadPooler.AwakePooler(); ObstaclePooler.AwakePooler(); StoneBlockagePooler.AwakePooler(); EffectPooler.AwakePooler(); EventPooler.AwakePooler(); TrucksFirePointPooler.AwakePooler(); RoadBlocksFirePointPooler.AwakePooler(); HelicoptersFirePointPooler.AwakePooler(); GunsPooler.AwakePooler(); TrucksPooler.AwakePooler(); EnemyPooler.AwakePooler(); }
void Start() { Camera.main.FadeIn(5f, Easing.Type.CircularIn); mobPooler = FindObjectOfType <EnemyPooler>(); health = GetComponent <Health>(); modifier = GetComponentInChildren <MaterialModifier>(); //Collect all tiles locations from patrol tilemap BoundsInt mapBounds = patrolMap.cellBounds; foreach (var pos in mapBounds.allPositionsWithin) { Vector3Int localPlace = new Vector3Int(pos.x, pos.y, pos.z); Vector3 place = patrolMap.CellToWorld(localPlace); if (patrolMap.HasTile(localPlace)) { tilemapLocations.Add(place); } } }
private void Start() { enemyPooler = EnemyPooler.instance; InvokeRepeating("spawnMob", 0, 0.5f); }
void Awake() { SharedInstance = this; }
private void Start() { pooler = EnemyPooler.Instance; }
private void Initialize(EnemyPooler enemyPooler) { _enemyPooler = enemyPooler; }
void Awake() { current = this; }
private void Start() { enemyPool = EnemyPooler.Instance; }
void Awake() { //need this for static NewObjectPoolingScript current = this; }
private void Awake() { current = this; }
private void Awake() { Instance = this; }
public void Initialize(EnemyPooler enemyPooler, EnemyWaypoints waypointProvider, Transform target) { this.enemyPooler = enemyPooler; this.waypointProvider = waypointProvider; Target = target; }