void OnTriggerEnter2D(Collider2D other) { if (other.transform.name.Equals("Player")) { CarryWater water = other.transform.GetComponent <CarryWater>(); if (water.GetNote1().Equals(this.note1) && water.GetNote2().Equals(this.note2) && water.GetNote3().Equals(this.note3)) { if (!isUnlocked) { water.ReleaseAllNotes(); HOTween.To(water1Sprite, 0.3f, new TweenParms().Prop("color", new Color(1, 1, 1, 0))); HOTween.To(water2Sprite, 0.3f, new TweenParms().Prop("color", new Color(1, 1, 1, 0))); HOTween.To(water3Sprite, 0.3f, new TweenParms().Prop("color", new Color(1, 1, 1, 0))); isUnlocked = true; Destroy(transform.gameObject, 0.5f); } } else { water.ReleaseAllNotes(); } } }
void OnTriggerEnter2D(Collider2D other) { if (other.transform.name.Equals("Player")) { CarryWater water = other.transform.GetComponent <CarryWater>(); if (!isActivated) { if (this.note1.Equals(water.GetNote1()) && this.note2.Equals(water.GetNote2()) && this.note3.Equals(water.GetNote3())) { water.ReleaseAllNotes(); HOTween.To(water1Sprite, 0.3f, new TweenParms().Prop("color", new Color(1, 1, 1, 0))); HOTween.To(water2Sprite, 0.3f, new TweenParms().Prop("color", new Color(1, 1, 1, 0))); HOTween.To(water3Sprite, 0.3f, new TweenParms().Prop("color", new Color(1, 1, 1, 0))); isActivated = true; } else { water.ReleaseAllNotes(); } } if (isActivated) { other.transform.GetComponent <PlayerController>().Bounce(jumpForceModifier); Camera.main.GetComponent <CameraShake>().Shake(0.3f, 0.03f); audioSource.Play(); } } }
void OnTriggerEnter2D(Collider2D other) { if (other.transform.name.Equals("Player") && !isFired) { CarryWater water = other.transform.GetComponent <CarryWater>(); if (water != null) { if (water.GetNote1().Equals(this.note1) && water.GetNote2().Equals(this.note2) && water.GetNote3().Equals(this.note3)) { GetComponent <PlaySoundAndScale>().isEnabled = true; Music music = GameObject.Find("Music").GetComponent <Music> (); music.AddBox(); water.ReleaseAllNotes(); GetComponent <AudioSource>().Play(); foreach (tk2dSpriteAnimator child in transform.GetComponentsInChildren <tk2dSpriteAnimator>()) { child.Play(); } Camera.main.GetComponent <CameraShake>().Shake(0f, 0.2f, 0.003f, this.CompleteEvents); HOTween.To(water1Sprite, 0.3f, new TweenParms().Prop("color", new Color(1, 1, 1, 0))); HOTween.To(water2Sprite, 0.3f, new TweenParms().Prop("color", new Color(1, 1, 1, 0))); HOTween.To(water3Sprite, 0.3f, new TweenParms().Prop("color", new Color(1, 1, 1, 0))); isFired = true; } else { water.ReleaseAllNotes(); } } } }