private void SpawnVFX() { GameObject Vfx; if (firePoint) { Vfx = Instantiate(effectToSpawn, firePoint.transform.position, Quaternion.identity); if (rotateToMouse) { Vfx.transform.localRotation = rotateToMouse.getRotation(); } } }
void spawnVFX() { GameObject vfx; // i guess the way instantite() works this doesnt go out of scope //if(firePoint != null) { vfx = Instantiate(effectToSpawn, gameObject.transform.position, Quaternion.identity); //firePoint.transform.position, Quaternion.identity); //} vfx.transform.right = rotateToMouse.getRotation(); ProjectileMovement projectile = vfx.GetComponent <ProjectileMovement>(); projectile.timeCreated = Time.timeSinceLevelLoad; // Destroy(vfx, 2.0f); }
void SpawnVFX() { GameObject vfx; if (firePoint != null) { vfx = Instantiate(effectToSpawn, firePoint.transform.position, Quaternion.identity); ProjectileMove vfxMoveController = vfx.GetComponent <ProjectileMove>(); vfxMoveController.whoShooting = gameObject; if (rotateToMouse != null) { vfx.transform.localRotation = rotateToMouse.getRotation(); } } else { Debug.Log("no fire point"); } }