void OnCollisionEnter2D(Collision2D collision) { if (collision.collider.CompareTag("Planet")) { if (hasJumped) { hasJumped = false; jumpLevel = 0; AudioSource source = GetComponent <AudioSource> (); source.clip = landSounds [Rnd.Int(0, landSounds.Length)]; source.pitch = Rnd.Float(0.95f, 1.05f); source.Play(); } PlanetView planet = collision.collider.gameObject.GetComponent <PlanetView> (); HaloBehaviour halo = planet.gravityField.GetComponent <HaloBehaviour>(); Dbg.Log(this, "halo", halo); halo.Highlight(); planet.hasBeenVisited = true; //// Dbg.Log (this, "collide", collision, collision.collider.tag); // //hasLanded = true; //// boost = 0; // currentNoJump = 0; } }
void Start() { // Note : the material is expected to have an additive shader material = this.GetComponent <MeshRenderer>().material; color = material.GetColor("_TintColor"); SetCloud(cloudObj); Transform child = transform.GetChild(0); if (child != null) { halo = child.GetComponent <HaloBehaviour>(); } // TODO random rotation }
void Start() { // Note : the material is expected to have an additive shader material = this.GetComponent <MeshRenderer>().material; color = material.GetColor("_TintColor"); material.SetColor("_TintColor", color * 0.3f); stars.Add(this); if (Settings.trailerMode) { powered = true; } Transform child = transform.GetChild(0); if (child != null) { halo = child.GetComponent <HaloBehaviour>(); } }
// Use this for initialization void Start() { if (targets == null) { Debug.LogError("Ladybird needs targets!"); } else { if (initialPositions == null) { Debug.LogError("Ladybird needs initialPositions!"); } else { transform.position = initialPositions[0].transform.position; state = STATE_SLEEPING; renderer.enabled = false; } } int nbChild = transform.GetChildCount(); for (int i = 0; i < nbChild; i++) { Transform child = transform.GetChild(i); if (child != null) { halo = child.GetComponent <HaloBehaviour>(); if (halo != null) { break; } } } originalRotation = transform.rotation; }