public void launchMeteor() { GameObject newMetoer = Instantiate(meteor, Vector3.zero, Quaternion.identity); pathGenerator randomPathGen = possibleMeteorPaths[UnityEngine.Random.Range(0, possibleMeteorPaths.Count)]; newMetoer.GetComponent <meteorMovementManager>().intitialize(randomPathGen); }
//This should be called immediately upon instantiation public void intitialize(pathGenerator pathGen) { setUpRockRotation(); follower = GetComponent <pathFollower>(); follower.setPath(pathGen.bezierPath); originalSpeed = follower.speed; damager = GetComponent <meteorDamager>(); }
private void fireBullet() { pathGenerator gen = pathGens[Random.Range(0, pathGens.Count)]; Instantiate(releasePS, gen.transform.position, Quaternion.identity); GameObject madeBullet = Instantiate(bullet, gen.transform.position, Quaternion.identity); madeBullet.GetComponent <pathFollower>().setPath(gen.bezierPath); bulletStreakCounter.signalBulletLaunch(madeBullet); }