public void Fire() { GameObject projectile = Poolable.Instantiate(projectilePrefab, transform.position, transform.rotation); foreach (Transform item in projectile.GetComponentsInChildren <Transform>()) //All bullet will have the layer { item.gameObject.layer = gameObject.layer; } }
public void AttachSelector(Transform hexPos) { Transform selector = Poolable.Instantiate(selectorPrefab.gameObject, Vector3.zero, Quaternion.identity).transform;//Instantiate(selectorPrefab) as Transform; selector.localPosition = new Vector3(0, (float)(hexPos.GetChild(0).localScale.z * 2 + 0.1), 0); selectors.Push(selector); selector.SetParent(hexPos, false); selectableHexPos.Add(hexPos.GetHashCode(), hexPos); }
public void Fire() { GameObject obj = Poolable.Instantiate(projectile, transform.position, transform.rotation); foreach (Transform item in obj.GetComponentsInChildren <Transform>()) { item.gameObject.layer = gameObject.layer; } }
public override void Execute(GameObject obj) { GameObject drop = dropTable.GetItem(); try{ Poolable.Instantiate(drop, obj.transform.position, Quaternion.identity); } catch (System.NullReferenceException) { } }
private GameObject Spawn() { Vector3 pos = GetRandomPositionInZone(); if (pos != Vector3.zero) { return(Poolable.Instantiate(enemyPrefab, pos, transform.rotation)); } return(null); }
public void Fire() { shootingSound.Play(); GameObject obj = Poolable.Instantiate(projectile, transform.position, transform.rotation); obj.GetComponent <DirectionnalMovement>().direction = DirectionCalc(); foreach (Transform item in obj.GetComponentsInChildren <Transform>()) { item.gameObject.tag = gameObject.tag; } }
private void OnEnable() { Poolable.Instantiate(prefab, gameObject.transform.position, Quaternion.identity); }
public override void Execute(GameObject obj) { Poolable.Instantiate(explosionPrefab, obj.transform.position, Quaternion.identity); }
private GameObject Spawn() { enemiesToSpawn--; return(Poolable.Instantiate(enemyPrefab, GetRandomPositionInZone(), transform.rotation)); }
private void Spawn() { Vector3 pos = GetRandomPositionInZone(); Poolable.Instantiate(enemyPrefab, pos, transform.rotation); }