//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void Awake() { leftCollider = GameObject.Find("Left").transform; rightCollider = GameObject.Find("Right").transform; destroy_threshold = GameObject.Find("Down").transform.position.y; //spriteRenderer = transform.GetChild(0).GetComponent<SpriteRenderer>(); sphereCollider = GetComponent <SphereCollider>(); rotationScript = GetComponent <RotationScript>(); burstParticlesParent = GameObject.Find("BurstParticlesParent"); burstParticleInstance = Instantiate(burstParticle, new Vector3(10000, 10000, 1), Quaternion.identity) as GameObject; burstParticleInstance.transform.SetParent(burstParticlesParent.transform); particleAnim = burstParticleInstance.GetComponent <ParticleAnimator>(); particleAnim.autodestruct = false; particleEmit = burstParticleInstance.GetComponent <ParticleEmitter>(); particleEmit.emit = false; scoresParent = GameObject.Find("ScoresParent"); if (name != "DummyBall(Clone)") { scoreInstance = Instantiate(scorePrefab, new Vector3(10, 10, 1), Quaternion.identity) as GameObject; scoreInstance.transform.SetParent(scoresParent.transform); scoreInstance.transform.localScale = new Vector3(1, 1, 1); scoreText = scoreInstance.GetComponent <Text>(); //textMesh = scoreInstance.GetComponent<TextMesh>(); //textMesh.renderer.sortingLayerName = "MiddleLayer"; scoreLife = Random.Range(0.3f, 0.8f); } }
void Start() { canJump = true; //playerSpeed = 5f; //jumpSpeed = 25f; planet = ((Gravity)this.GetComponent("Gravity")).planet; rotationScript = (RotationScript)planet.GetComponent("RotationScript"); rb2d = GetComponent <Rigidbody2D>(); }
private void OnTriggerEnter(Collider other) { if (other.tag == m_rope.tag) //Play hit sound if the player is hit by the rope, reset rope rotation speed. { m_audio.PlayOneShot(m_hitSound); RotationScript ropeRot = other.GetComponentInParent <RotationScript>(); ropeRot.m_angle = ropeRot.m_minSpeed; } }
// Use this for initialization private void Awake() { RotationScript temp = gameObject.GetComponent <RotationScript>(); // Grab the Rotation Script temp.Axis = Vector3.up; // Set Axis temp.RotateSpace = Space.Self; // set rotation space temp.RotationSpeed = 200.0f; // set rotation speed gameObject.rigidbody.isKinematic = true; // Change to IsKinematic gameObject.rigidbody.useGravity = false; // Don't use Gravity IsEnabled = false; }
private bool mEnabled; // State of Planet #endregion #region Unity Function // Use this for initialization private void Awake() { gameObject.name = "planet"; // A random name mSpeed = PlanetManager.Instance.PlanetSpeed; // Set the Speed mDamage = PlanetManager.Instance.PlanetDamage; // Set the Damage IsEnabled = false; // Disable the Planet RotationScript temp = gameObject.GetComponent <RotationScript>(); // Grab the Rotation Script temp.Axis = Vector3.up; // Set Axis temp.RotateSpace = Space.Self; // set rotation space temp.RotationSpeed = 40.0f; // set rotation speed gameObject.rigidbody.isKinematic = true; // set rigid body settings gameObject.rigidbody.useGravity = false; // set rigid body settings gameObject.rigidbody.constraints = RigidbodyConstraints.FreezePositionY; // set rigid body settings gameObject.rigidbody.freezeRotation = true; // set rigid body settings }
public void PlanetStopper() { if (planetContainer.transform.GetChild(0).GetComponent <RotationScript>().actualRotationSpeed == 0) { for (int i = 0; i < planetContainer.transform.childCount; i++) { RotationScript rotator = planetContainer.transform.GetChild(i).GetComponent <RotationScript>(); rotator.actualRotationSpeed = rotator.baseSpeed; } } else { for (int i = 0; i < planetContainer.transform.childCount; i++) { RotationScript rotator = planetContainer.transform.GetChild(i).GetComponent <RotationScript>(); rotator.actualRotationSpeed = 0; } } }
// Start is called before the first frame update void Start() { startPosition = transform.position; rotationScript = indicator.GetComponent <RotationScript>(); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void Awake() { leftCollider = GameObject.Find("Left").transform; rightCollider = GameObject.Find("Right").transform; destroy_threshold = GameObject.Find("Down").transform.position.y; //spriteRenderer = transform.GetChild(0).GetComponent<SpriteRenderer>(); sphereCollider = GetComponent<SphereCollider>(); rotationScript = GetComponent<RotationScript>(); burstParticlesParent = GameObject.Find("BurstParticlesParent"); burstParticleInstance = Instantiate(burstParticle, new Vector3(10000,10000,1), Quaternion.identity) as GameObject; burstParticleInstance.transform.SetParent(burstParticlesParent.transform); particleAnim = burstParticleInstance.GetComponent<ParticleAnimator>(); particleAnim.autodestruct = false; particleEmit = burstParticleInstance.GetComponent<ParticleEmitter>(); particleEmit.emit = false; scoresParent = GameObject.Find("ScoresParent"); if(name!="DummyBall(Clone)"){ scoreInstance = Instantiate(scorePrefab, new Vector3(10,10,1), Quaternion.identity) as GameObject; scoreInstance.transform.SetParent(scoresParent.transform); scoreInstance.transform.localScale = new Vector3(1,1,1); scoreText = scoreInstance.GetComponent<Text>(); //textMesh = scoreInstance.GetComponent<TextMesh>(); //textMesh.renderer.sortingLayerName = "MiddleLayer"; scoreLife = Random.Range(0.3f, 0.8f); } }
private void Awake() { rotationScript = this; playerRb = gameObject.GetComponent <Rigidbody2D>(); }